Simpler progress update
This commit is contained in:
@@ -210,14 +210,14 @@ class Manage(Plugin):
|
|||||||
'to_go': total_found,
|
'to_go': total_found,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
self.updateProgress(folder, to_go)
|
||||||
|
|
||||||
if group['media'] and group['identifier']:
|
if group['media'] and group['identifier']:
|
||||||
added_identifiers.append(group['identifier'])
|
added_identifiers.append(group['identifier'])
|
||||||
|
|
||||||
# Add it to release and update the info
|
# Add it to release and update the info
|
||||||
fireEvent('release.add', group = group, update_info = False)
|
fireEvent('release.add', group = group, update_info = False)
|
||||||
fireEvent('movie.update_info', identifier = group['identifier'], on_complete = self.createAfterUpdate(folder, group['identifier']))
|
fireEvent('movie.update_info', identifier = group['identifier'], on_complete = self.createAfterUpdate(folder, group['identifier']))
|
||||||
else:
|
|
||||||
self.updateProgress(folder)
|
|
||||||
|
|
||||||
return addToLibrary
|
return addToLibrary
|
||||||
|
|
||||||
@@ -228,7 +228,6 @@ class Manage(Plugin):
|
|||||||
if not self.in_progress or self.shuttingDown():
|
if not self.in_progress or self.shuttingDown():
|
||||||
return
|
return
|
||||||
|
|
||||||
self.updateProgress(folder)
|
|
||||||
total = self.in_progress[folder]['total']
|
total = self.in_progress[folder]['total']
|
||||||
movie_dict = fireEvent('media.get', identifier, single = True)
|
movie_dict = fireEvent('media.get', identifier, single = True)
|
||||||
|
|
||||||
@@ -236,10 +235,11 @@ class Manage(Plugin):
|
|||||||
|
|
||||||
return afterUpdate
|
return afterUpdate
|
||||||
|
|
||||||
def updateProgress(self, folder):
|
def updateProgress(self, folder, to_go):
|
||||||
|
|
||||||
pr = self.in_progress[folder]
|
pr = self.in_progress[folder]
|
||||||
pr['to_go'] -= 1
|
if to_go < pr['to_go']:
|
||||||
|
pr['to_go'] = to_go
|
||||||
|
|
||||||
avg = (time.time() - pr['started']) / (pr['total'] - pr['to_go'])
|
avg = (time.time() - pr['started']) / (pr['total'] - pr['to_go'])
|
||||||
pr['eta'] = tryInt(avg * pr['to_go'])
|
pr['eta'] = tryInt(avg * pr['to_go'])
|
||||||
|
|||||||
@@ -364,6 +364,7 @@ class Scanner(Plugin):
|
|||||||
|
|
||||||
if return_ignored is False and identifier in ignored_identifiers:
|
if return_ignored is False and identifier in ignored_identifiers:
|
||||||
log.debug('Ignore file found, ignoring release: %s', identifier)
|
log.debug('Ignore file found, ignoring release: %s', identifier)
|
||||||
|
total_found -= 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Group extra (and easy) files first
|
# Group extra (and easy) files first
|
||||||
@@ -384,6 +385,7 @@ class Scanner(Plugin):
|
|||||||
|
|
||||||
if len(group['files']['movie']) == 0:
|
if len(group['files']['movie']) == 0:
|
||||||
log.error('Couldn\'t find any movie files for %s', identifier)
|
log.error('Couldn\'t find any movie files for %s', identifier)
|
||||||
|
total_found -= 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
log.debug('Getting metadata for %s', identifier)
|
log.debug('Getting metadata for %s', identifier)
|
||||||
@@ -429,7 +431,7 @@ class Scanner(Plugin):
|
|||||||
|
|
||||||
# Notify parent & progress on something found
|
# Notify parent & progress on something found
|
||||||
if on_found:
|
if on_found:
|
||||||
on_found(group, total_found, total_found - len(processed_movies))
|
on_found(group, total_found, len(valid_files))
|
||||||
|
|
||||||
# Wait for all the async events calm down a bit
|
# Wait for all the async events calm down a bit
|
||||||
while threading.activeCount() > 100 and not self.shuttingDown():
|
while threading.activeCount() > 100 and not self.shuttingDown():
|
||||||
|
|||||||
Reference in New Issue
Block a user