本文整理汇总了Python中beets.ui.Subcommand类的典型用法代码示例。如果您正苦于以下问题:Python Subcommand类的具体用法?Python Subcommand怎么用?Python Subcommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Subcommand类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: commands
def commands(self):
lyrics_cmd = Subcommand('lyrics', help='fetch lyrics')
lyrics_cmd.func = self.lyrics_func
lyrics_cmd.parser.add_option('-f', '--force', action='store_true', default=None, help='overwrite tag updates')
lyrics_cmd.parser.add_option('-p', '--processes', dest='processes', help='number of concurrent threads to run')
return [lyrics_cmd]
示例2: commands
def commands(self):
play_command = Subcommand("play", help="send music to a player as a playlist")
play_command.parser.add_option(
"-a", "--album", action="store_true", default=False, help="query and load albums rather than tracks"
)
play_command.func = play_music
return [play_command]
示例3: commands
def commands(self):
play_command = Subcommand('play',
help='send query results to music player as playlist.')
play_command.parser.add_option('-a', '--album',
action='store_true', default=False,
help='query and load albums(folders) rather then tracks.')
play_command.func = play_music
return [play_command]
示例4: commands
def commands(self):
play_command = Subcommand(
'play',
help='send music to a player as a playlist'
)
play_command.parser.add_album_option()
play_command.func = self.play_music
return [play_command]
示例5: commands
def commands(self):
bad_command = Subcommand('bad',
help=u'check for corrupt or missing files')
bad_command.parser.add_option(
u'-v', u'--verbose',
action='store_true', default=False, dest='verbose',
help=u'view results for both the bad and uncorrupted files'
)
bad_command.func = self.command
return [bad_command]
示例6: commands
def commands(self):
mbupdate = Subcommand('mbupdate',
help=u'Update MusicBrainz collection')
mbupdate.parser.add_option('-r', '--remove',
action='store_true',
default=None,
dest='remove',
help='Remove albums not in beets library')
mbupdate.func = self.update_collection
return [mbupdate]
示例7: commands
def commands(self):
play_command = Subcommand(
'play',
help='send music to a player as a playlist'
)
play_command.parser.add_option(
'-a', '--album',
action='store_true', default=False,
help='query and load albums rather than tracks'
)
play_command.func = play_music
return [play_command]
示例8: commands
def commands(self):
zero_command = Subcommand('zero', help='set fields to null')
def zero_fields(lib, opts, args):
if not decargs(args) and not input_yn(
u"Remove fields for all items? (Y/n)",
True):
return
for item in lib.items(decargs(args)):
self.process_item(item)
zero_command.func = zero_fields
return [zero_command]
示例9: commands
def commands(self):
cmds = Subcommand('wlg', help='get genres with whatlastgenre')
cmds.parser.add_option(
'-v', '--verbose', dest='verbose', action='count',
default=0, help='verbose output (-vv for debug)')
cmds.parser.add_option(
'-f', '--force', dest='force', action='store_true',
default=False, help='force overwrite existing genres')
cmds.parser.add_option(
'-u', '--update-cache', dest='cache', action='store_true',
default=False, help='force update cache')
cmds.func = self.commanded
return [cmds]
示例10: commands
def commands(self):
play_command = Subcommand(
'play',
help=u'send music to a player as a playlist'
)
play_command.parser.add_album_option()
play_command.parser.add_option(
u'-A', u'--args',
action='store',
help=u'add additional arguments to the command',
)
play_command.func = self.play_music
return [play_command]
示例11: commands
def commands(self):
thumbnails_command = Subcommand("thumbnails",
help="Create album thumbnails")
thumbnails_command.parser.add_option(
'-f', '--force', dest='force', action='store_true', default=False,
help='force regeneration of thumbnails deemed fine (existing & '
'recent enough)')
thumbnails_command.parser.add_option(
'--dolphin', dest='dolphin', action='store_true', default=False,
help="create Dolphin-compatible thumbnail information (for KDE)")
thumbnails_command.func = self.process_query
return [thumbnails_command]
示例12: commands
def commands(self):
gupload = Subcommand('gmusic-upload',
help=u'upload your tracks to Google Play Music')
gupload.func = self.upload
search = Subcommand('gmusic-songs',
help=u'list of songs in Google Play Music library')
search.parser.add_option('-t', '--track', dest='track',
action='store_true',
help='Search by track name')
search.parser.add_option('-a', '--artist', dest='artist',
action='store_true',
help='Search by artist')
search.func = self.search
return [gupload, search]
示例13: commands
def commands(self):
play_command = Subcommand(
'play',
help=u'send music to a player as a playlist'
)
play_command.parser.add_album_option()
play_command.parser.add_option(
u'-A', u'--args',
action='store',
help=u'add additional arguments to the command',
)
play_command.parser.add_option(
u'-y', u'--yes',
action="store_true",
help=u'skip the warning threshold',
)
play_command.func = self._play_command
return [play_command]
示例14: commands
def commands(self):
thumbnails_command = Subcommand("thumbnails", help=u"Create album thumbnails")
thumbnails_command.parser.add_option(
u"-f",
u"--force",
dest="force",
action="store_true",
default=False,
help=u"force regeneration of thumbnails deemed fine (existing & " u"recent enough)",
)
thumbnails_command.parser.add_option(
u"--dolphin",
dest="dolphin",
action="store_true",
default=False,
help=u"create Dolphin-compatible thumbnail information (for KDE)",
)
thumbnails_command.func = self.process_query
return [thumbnails_command]
示例15: reverse_dict
genres = {}
def reverse_dict(orig):
reverse = {}
for (genre, artists) in orig.items():
for artist in artists:
reverse[artist]=genre
return reverse
def get_genre(artist, genre_dict):
try:
return genre_dict[artist]
except KeyError:
return None
update_cmd = Subcommand('update-genres', help='Update the genres of all media in library acording to the current genre list file')
def update_genres(lib, config, opts, args):
global genres
global fallback_str
for item in lib.items(ui.decargs(args)):
if item.album_id is not None:
continue
genre = get_genre(item.artist, genres)
log.warn("title: %s, artist: %s, genre: %s" % (item.title, item.artist, genre))
if not genre and fallback_str != None:
genre = fallback_str
log.warn(u'no genre for %s in list: fallback to %s' % (item.artist, genre))
if genre is not None:
log.warn(u'adding genre for %s from list: %s' % (item.artist, genre))
item.genre = genre
lib.store(item)