Commit aa0d1fa0 authored by Nitha Sagar Jayanna's avatar Nitha Sagar Jayanna
Browse files

presentation added

parent 0686b314
......@@ -10,6 +10,7 @@ import latestdate
import fileinput
import calendar
#importing the requirements from the config file
start = config.start_date
end = config.end_date
today = str(date.today())
......@@ -19,9 +20,13 @@ log_file = config.log_file
def clean_log(stripline):
with open(log_file,'r+') as f:
#read the log file and store in filedata
filedata = f.read()
#when f.read points to eof, the pointer is pointd to zeroth item of the file
f.seek(0)
#replacing the stripline(the line that needs to be stripped) with "\n"
filedata = filedata.replace(stripline,'\n')
#clean the logfile
f.truncate(0)
f.write(filedata)
......@@ -42,18 +47,21 @@ def clean_log(stripline):
def remove_empty_lines():
with open(log_file) as filehandle:
lines = filehandle.readlines()
#stripping the \n
with open(log_file, 'w') as filehandle:
lines = filter(lambda x: x.strip(), lines)
filehandle.writelines(lines)
#to check if the file present in the log
def filecheck(file):
try:
#open log file
with open(log_file, 'r') as read_obj:
for line in read_obj:
for line in read_obj:
#if the filename found
if file[0] in line:
#check for the size
memFile = line.split(" ")
sizeFile = memFile[1]
lenString = len(sizeFile)
......@@ -61,6 +69,8 @@ def filecheck(file):
siteFileSize = file[1]
lenSite = len(siteFileSize)
webFileSize = int(siteFileSize[0:lenSite-1])
#if size of the file present in web repository is bigger
#then download is required
if webFileSize > memFileSize:
#print("download required")
#print(memFile,webFileSize,memFileSize)
......@@ -275,9 +285,14 @@ def urlDownload(start,end):
#if start and end dates are specified
#download from start till end date specified
if start != "" and end != "":
urlDownload(start,end)
#if start date is not mentioned but end date is mentioned
#retreive the latest date
#start date == latest date
#download from start date to end date specified
elif start == "" and end != "":
startdate = latestdate.recent()
print(startdate)
......@@ -291,12 +306,15 @@ elif start == "" and end != "":
else:
urlDownload(startdate[0],end)
#if end date is not mentioned, download from the given end date
#till current date
elif end == "" and start != "":
#print("No end date")
enddate = str(today)
urlDownload(start,enddate)
else:
#default case
#print("No arguments")
startdate = latestdate.recent()
enddate = str(today)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment