* morituri/common/task.py:
Add a 'described' method so listeners can get proper notification of description changes, and update their description in between progress changes. Add a MultiCombinedTask that reports on progress over all tasks combined. * examples/trm.py: Add a playlist option to the example. Still needs to store results to pickles, preferably after each completed task. * morituri/common/checksum.py: Add audioconvert to make sure we can trm ogg files.
This commit is contained in:
@@ -54,16 +54,26 @@ def main(argv):
|
||||
action="store", dest="runner",
|
||||
help="runner ('cli' or 'gtk', defaults to %s)" % default,
|
||||
default=default)
|
||||
parser.add_option('-p', '--playlist',
|
||||
action="store", dest="playlist",
|
||||
help="playlist to analyze files from")
|
||||
|
||||
|
||||
options, args = parser.parse_args(argv[1:])
|
||||
|
||||
try:
|
||||
path = sys.argv[1]
|
||||
except IndexError:
|
||||
sys.stderr.write('Please give a file to trm!\n')
|
||||
return
|
||||
paths = []
|
||||
if len(args) > 0:
|
||||
paths.extend(args[0:])
|
||||
if options.playlist:
|
||||
paths.extend(open(options.playlist).readlines())
|
||||
|
||||
mtask = task.MultiCombinedTask()
|
||||
for path in paths:
|
||||
path = path.rstrip()
|
||||
trmtask = checksum.TRMTask(path)
|
||||
mtask.addTask(trmtask)
|
||||
mtask.description = 'Fingerprinting files'
|
||||
|
||||
trmtask = checksum.TRMTask(path)
|
||||
|
||||
if options.runner == 'cli':
|
||||
runner = task.SyncRunner()
|
||||
@@ -72,9 +82,10 @@ def main(argv):
|
||||
runner = task.GtkProgressRunner()
|
||||
function = gtkmain
|
||||
|
||||
function(runner, trmtask)
|
||||
function(runner, mtask)
|
||||
|
||||
print
|
||||
print trmtask.trm
|
||||
for trmtask in mtask:
|
||||
print trmtask.trm
|
||||
|
||||
main(sys.argv)
|
||||
|
||||
Reference in New Issue
Block a user