mirror of
https://github.com/beetbox/beets.git
synced 2026-01-08 17:08:12 +01:00
Removed import of unicode_literals from plugins
* rewrite * scrub * smartplaylist * spotify * the
This commit is contained in:
parent
456565b6f2
commit
30cf407074
5 changed files with 32 additions and 34 deletions
|
|
@ -16,8 +16,7 @@
|
|||
"""Uses user-specified rewriting rules to canonicalize names for path
|
||||
formats.
|
||||
"""
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
from __future__ import (division, absolute_import, print_function)
|
||||
|
||||
import re
|
||||
from collections import defaultdict
|
||||
|
|
@ -56,9 +55,9 @@ class RewritePlugin(BeetsPlugin):
|
|||
try:
|
||||
fieldname, pattern = key.split(None, 1)
|
||||
except ValueError:
|
||||
raise ui.UserError("invalid rewrite specification")
|
||||
raise ui.UserError(u"invalid rewrite specification")
|
||||
if fieldname not in library.Item._fields:
|
||||
raise ui.UserError("invalid field name (%s) in rewriter" %
|
||||
raise ui.UserError(u"invalid field name (%s) in rewriter" %
|
||||
fieldname)
|
||||
self._log.debug(u'adding template field {0}', key)
|
||||
pattern = re.compile(pattern.lower())
|
||||
|
|
|
|||
|
|
@ -17,8 +17,7 @@
|
|||
automatically whenever tags are written.
|
||||
"""
|
||||
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
from __future__ import (division, absolute_import, print_function)
|
||||
|
||||
from beets.plugins import BeetsPlugin
|
||||
from beets import ui
|
||||
|
|
@ -64,10 +63,11 @@ class ScrubPlugin(BeetsPlugin):
|
|||
util.displayable_path(item.path))
|
||||
self._scrub_item(item, opts.write)
|
||||
|
||||
scrub_cmd = ui.Subcommand('scrub', help='clean audio tags')
|
||||
scrub_cmd.parser.add_option('-W', '--nowrite', dest='write',
|
||||
action='store_false', default=True,
|
||||
help='leave tags empty')
|
||||
scrub_cmd = ui.Subcommand('scrub', help=u'clean audio tags')
|
||||
scrub_cmd.parser.add_option(
|
||||
u'-W', u'--nowrite', dest='write',
|
||||
action='store_false', default=True,
|
||||
help=u'leave tags empty')
|
||||
scrub_cmd.func = scrub_func
|
||||
|
||||
return [scrub_cmd]
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@
|
|||
"""Generates smart playlists based on beets queries.
|
||||
"""
|
||||
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
from __future__ import (division, absolute_import, print_function)
|
||||
|
||||
from beets.plugins import BeetsPlugin
|
||||
from beets import ui
|
||||
|
|
@ -46,9 +45,10 @@ class SmartPlaylistPlugin(BeetsPlugin):
|
|||
self.register_listener('database_change', self.db_change)
|
||||
|
||||
def commands(self):
|
||||
spl_update = ui.Subcommand('splupdate',
|
||||
help='update the smart playlists. Playlist '
|
||||
'names may be passed as arguments.')
|
||||
spl_update = ui.Subcommand(
|
||||
'splupdate',
|
||||
help=u'update the smart playlists. Playlist '
|
||||
u'names may be passed as arguments.')
|
||||
spl_update.func = self.update_cmd
|
||||
return [spl_update]
|
||||
|
||||
|
|
@ -64,9 +64,9 @@ class SmartPlaylistPlugin(BeetsPlugin):
|
|||
for name, q, a_q in self._unmatched_playlists
|
||||
if name in args)
|
||||
if not playlists:
|
||||
raise ui.UserError('No playlist matching any of {0} '
|
||||
'found'.format([name for name, _, _ in
|
||||
self._unmatched_playlists]))
|
||||
raise ui.UserError(
|
||||
u'No playlist matching any of {0} found'.format(
|
||||
[name for name, _, _ in self._unmatched_playlists]))
|
||||
|
||||
self._matched_playlists = playlists
|
||||
self._unmatched_playlists -= playlists
|
||||
|
|
@ -95,7 +95,7 @@ class SmartPlaylistPlugin(BeetsPlugin):
|
|||
|
||||
for playlist in self.config['playlists'].get(list):
|
||||
if 'name' not in playlist:
|
||||
self._log.warn("playlist configuration is missing name")
|
||||
self._log.warn(u"playlist configuration is missing name")
|
||||
continue
|
||||
|
||||
playlist_data = (playlist['name'],)
|
||||
|
|
@ -131,7 +131,7 @@ class SmartPlaylistPlugin(BeetsPlugin):
|
|||
playlist_data += (query_and_sort,)
|
||||
|
||||
except ParsingError as exc:
|
||||
self._log.warn("invalid query in playlist {}: {}",
|
||||
self._log.warn(u"invalid query in playlist {}: {}",
|
||||
playlist['name'], exc)
|
||||
continue
|
||||
|
||||
|
|
@ -151,14 +151,15 @@ class SmartPlaylistPlugin(BeetsPlugin):
|
|||
for playlist in self._unmatched_playlists:
|
||||
n, (q, _), (a_q, _) = playlist
|
||||
if self.matches(model, q, a_q):
|
||||
self._log.debug("{0} will be updated because of {1}", n, model)
|
||||
self._log.debug(
|
||||
u"{0} will be updated because of {1}", n, model)
|
||||
self._matched_playlists.add(playlist)
|
||||
self.register_listener('cli_exit', self.update_playlists)
|
||||
|
||||
self._unmatched_playlists -= self._matched_playlists
|
||||
|
||||
def update_playlists(self, lib):
|
||||
self._log.info("Updating {0} smart playlists...",
|
||||
self._log.info(u"Updating {0} smart playlists...",
|
||||
len(self._matched_playlists))
|
||||
|
||||
playlist_dir = self.config['playlist_dir'].as_filename()
|
||||
|
|
@ -196,4 +197,4 @@ class SmartPlaylistPlugin(BeetsPlugin):
|
|||
with open(syspath(m3u_path), 'w') as f:
|
||||
for path in m3us[m3u]:
|
||||
f.write(path + b'\n')
|
||||
self._log.info("{0} playlists updated", len(self._matched_playlists))
|
||||
self._log.info(u"{0} playlists updated", len(self._matched_playlists))
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
from __future__ import (division, absolute_import, print_function)
|
||||
|
||||
import re
|
||||
import webbrowser
|
||||
|
|
@ -41,17 +40,17 @@ class SpotifyPlugin(BeetsPlugin):
|
|||
self.output_results(results)
|
||||
spotify_cmd = ui.Subcommand(
|
||||
'spotify',
|
||||
help='build a Spotify playlist'
|
||||
help=u'build a Spotify playlist'
|
||||
)
|
||||
spotify_cmd.parser.add_option(
|
||||
'-m', '--mode', action='store',
|
||||
help='"open" to open Spotify with playlist, '
|
||||
'"list" to print (default)'
|
||||
u'-m', u'--mode', action='store',
|
||||
help=u'"open" to open Spotify with playlist, '
|
||||
u'"list" to print (default)'
|
||||
)
|
||||
spotify_cmd.parser.add_option(
|
||||
'-f', '--show-failures', action='store_true',
|
||||
help='list tracks that did not match a Spotify ID',
|
||||
dest='show_failures',
|
||||
u'-f', u'--show-failures',
|
||||
action='store_true', dest='show_failures',
|
||||
help=u'list tracks that did not match a Spotify ID'
|
||||
)
|
||||
spotify_cmd.func = queries
|
||||
return [spotify_cmd]
|
||||
|
|
|
|||
|
|
@ -15,8 +15,7 @@
|
|||
|
||||
"""Moves patterns in path formats (suitable for moving articles)."""
|
||||
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
from __future__ import (division, absolute_import, print_function)
|
||||
|
||||
import re
|
||||
from beets.plugins import BeetsPlugin
|
||||
|
|
|
|||
Loading…
Reference in a new issue