Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve efficiency of upload when not checking changes #38

Merged
merged 1 commit into from Feb 1, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 17 additions & 3 deletions uploadr.py 100644 → 100755
Expand Up @@ -373,11 +373,24 @@ def upload( self ):
print("*****Uploading files*****")

allMedia = self.grabNewFiles()
print("Found " + str(len(allMedia)) + " files")
# If managing changes, consider all files
if MANAGE_CHANGES:
changedMedia = allMedia
# If not, then get just the new and missing files
else:
con = lite.connect(DB_PATH)
with con:
cur = con.cursor()
cur.execute("SELECT path FROM files")
existingMedia = set(file[0] for file in cur.fetchall())
changedMedia = set(allMedia) - existingMedia

changedMedia_count = len(changedMedia)
print("Found " + str(changedMedia_count) + " files")
coun = 0;
for i, file in enumerate( allMedia ):
for i, file in enumerate( changedMedia ):
success = self.uploadFile( file )
if args.drip_feed and success and i != len( allMedia )-1:
if args.drip_feed and success and i != changedMedia_count-1:
print("Waiting " + str(DRIP_TIME) + " seconds before next upload")
time.sleep( DRIP_TIME )
coun = coun + 1;
Expand Down Expand Up @@ -436,6 +449,7 @@ def convertRawFiles( self ):
print ("Finished converting files with extension:" + ext + ".")

print "*****Completed converting files*****"

def grabNewFiles( self ):
""" grabNewFiles
"""
Expand Down