Skip to content

Commit

Permalink
Updated to Python3 with 2to3
Browse files Browse the repository at this point in the history
  • Loading branch information
gatlinnewhouse authored Feb 22, 2017
1 parent eebdb27 commit 1c402d5
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions beetsplug/rymgenre/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __init__(self):
super(RymGenrePlugin, self).__init__()

self.config.add({
'separator': u', ',
'separator': ', ',
'classes': 'all',
'depth': 'all'
})
Expand All @@ -41,7 +41,7 @@ def build_parents(elem, path, parents):
path = []

if isinstance(elem, dict):
for (k, v) in elem.items():
for (k, v) in list(elem.items()):
parents[k] |= set(path)
build_parents(v, [k] + path, parents)
elif isinstance(elem, list):
Expand Down Expand Up @@ -127,7 +127,7 @@ def value_or_na(value):
return value if value is not None else 'N/A'

def format_rym_album(album):
return u'{0} - {1} ({2}, {3}, {4})'.format(
return '{0} - {1} ({2}, {3}, {4})'.format(
value_or_na(album['artist']),
value_or_na(album['album']),
value_or_na(album['format']),
Expand All @@ -138,12 +138,12 @@ def set_url():
url = ui.input_('Enter rateyourmusic url:')
return { 'href': url }

print(u'\nFetching genre for album:\n {0} - {1}'.format(
beets_album.albumartist, beets_album.album))
print(('\nFetching genre for album:\n {0} - {1}'.format(
beets_album.albumartist, beets_album.album)))

print(u'URL:\n %s' % albums[0]['href'])
print(('URL:\n %s' % albums[0]['href']))

print(format_rym_album(albums[0]))
print((format_rym_album(albums[0])))
res = ui.input_options(['apply', 'more candidates', 'set url', 'skip'])
if res == 'a':
return albums[0]
Expand All @@ -153,10 +153,10 @@ def set_url():
return None
else:
id = 1
print(u'Candidates for {0} - {1} ({2}):'.format(
beets_album.albumartist, beets_album.album, beets_album.year))
print(('Candidates for {0} - {1} ({2}):'.format(
beets_album.albumartist, beets_album.album, beets_album.year)))
for album in albums:
print(str(id) + u'. ' + format_rym_album(album))
print((str(id) + '. ' + format_rym_album(album)))
id += 1
res = ui.input_options(['set url', 'skip'], numrange=(1, len(albums)))
if res == 's':
Expand All @@ -170,12 +170,12 @@ def _get_genre(self, album):
if release:
genres = self._get_genres(release['href'])

log.info(u'genres for album {0} - {1}: {2}'.format(
log.info('genres for album {0} - {1}: {2}'.format(
album.albumartist,
album.album,
self.config['separator'].get(unicode).join(genres)))
self.config['separator'].get(str).join(genres)))

return self.config['separator'].get(unicode).join(genres)
return self.config['separator'].get(str).join(genres)
return None

def commands(self):
Expand All @@ -189,7 +189,7 @@ def rymgenre_func(lib, opts, args):
album.genre = genres
album.store()

for item in album.items():
for item in list(album.items()):
item.genre = genres
item.store()

Expand Down

1 comment on commit 1c402d5

@gatlinnewhouse
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps reverting all lines but 176 and 178 will fix it?

jcazevedo#6

Although my debugging suggests otherwise.

Please sign in to comment.