Working "full/quick" scan

This commit is contained in:
Ruud
2012-06-10 21:58:07 +02:00
parent 9018d5a585
commit f410ba13f4
3 changed files with 25 additions and 11 deletions
+16 -3
View File
@@ -103,14 +103,14 @@ class Scanner(Plugin):
if group['library']:
fireEvent('release.add', group = group)
def scanFolderToLibrary(self, folder = None, newer_than = None, simple = True):
def scanFolderToLibrary(self, folder = None, newer_than = 0, simple = True):
folder = os.path.normpath(folder)
if not os.path.isdir(folder):
return
groups = self.scan(folder = folder, simple = simple)
groups = self.scan(folder = folder, simple = simple, newer_than = newer_than)
added_identifier = []
while True and not self.shuttingDown():
@@ -131,7 +131,7 @@ class Scanner(Plugin):
return added_identifier
def scan(self, folder = None, files = [], simple = False):
def scan(self, folder = None, files = [], simple = False, newer_than = 0):
folder = os.path.normpath(folder)
@@ -312,6 +312,19 @@ class Scanner(Plugin):
del group['unsorted_files']
continue
# Only process movies newer than x
if newer_than and newer_than > 0:
for cur_file in group['unsorted_files']:
file_time = [os.path.getmtime(cur_file), os.path.getctime(cur_file)]
if file_time[0] > time.time() or file_time[1] > time.time():
break
log.debug('None of the files have changed since %s for %s, skipping.' % (time.ctime(newer_than), identifier))
# Delete the unsorted list
del group['unsorted_files']
continue
# Group extra (and easy) files first