示例#1
0
 def _cmd(self, history, args):
     OUTPUT.list_start("Source-Info")
     for fn in args:
         OUTPUT.dict_start(fn)
         if not history.is_processed(fn):
             OUTPUT.dict_item('marked', False)
             sn = history.get_source_file_for_transcoded_filename(fn)
             OUTPUT.dict_item('transcoded_from', sn)
             continue
         OUTPUT.dict_item('marked', True)
         OUTPUT.dict_item('transcoded_to', history.get_transcoded_to(fn))
         fn_keys = history.get_keywords_for(fn)
         dups = history.get_duplicates(fn)
         OUTPUT.dict_start('duplicates')
         for dn in dups:
             OUTPUT.dict_start(dn)
             dn_keys = history.get_keywords_for(dn)
             OUTPUT.list_section('common_keywords',
                                 list(dn_keys.intersection(fn_keys)))
             OUTPUT.dict_end()
         OUTPUT.dict_end()
         OUTPUT.dict_section('tags', history.get_tags_for(fn))
         OUTPUT.list_section('keywords', list(fn_keys))
         OUTPUT.dict_end()
     return 0
示例#2
0
 def _cmd(self, history, args):
     tags = {}
     match_all = False
     match_exact = False
     for a in args:
         if a == '-a':
             match_all = True
         elif a == '-e':
             match_exact = True
         else:
             p = a.find('=')
             if p > 0:
                 tag = a[0:p]
                 value = a[p + 1:]
                 tags[tag] = value
             else:
                 OUTPUT.error('Invalid argument format: {0}'.format(a))
     if match_all:
         matches = history.get_tag_matches(tags, match_exact)
     else:
         matches = set()
         for k, v in tags.items():
             m = history.get_tag_matches({k: v}, match_exact)
             matches = matches.union(m)
     OUTPUT.dict_start('Tag Matches')
     OUTPUT.list_section('Source Files', matches)
     OUTPUT.dict_end()
示例#3
0
 def _cmd(self, history, args):
     if len(args) == 0:
         args = history.get_transcoded_filenames()
     OUTPUT.dict_start('transcoded_from')
     for tn in args:
         sources = []
         sn = history.get_source_file_for_transcoded_filename(tn)
         if sn is not None:
             sources.append(sn)
             # Get the duplicates, so it traces all the files.
             sources.extend(history.get_duplicate_filenames(sn))
         OUTPUT.list_section(tn, sources)
     OUTPUT.dict_end()
示例#4
0
 def _cmd(self, history, args):
     count = 0
     if len(args) > 0:
         names = set()
         for name_like in args:
             names = names.union(history.get_source_files(name_like))
     else:
         names = history.get_source_files()
     OUTPUT.dict_start('Sources')
     for fn in names:
         count += 1
         OUTPUT.dict_start(fn)
         OUTPUT.dict_item('transcode', repr(history.get_transcoded_to(fn)))
         OUTPUT.list_section('duplicates',
                             history.get_duplicate_filenames(fn))
         OUTPUT.dict_end()
     if count <= 0:
         OUTPUT.error('No matching files in database')
     OUTPUT.dict_end()
     return 0