diff --git a/headphones/postprocessor.py b/headphones/postprocessor.py index 87cc50ac..a5fa3637 100644 --- a/headphones/postprocessor.py +++ b/headphones/postprocessor.py @@ -3,8 +3,9 @@ import time import urllib, shutil, re +import lib.beets as beets +from lib.beets import autotag from lib.beets.mediafile import MediaFile -import lib.musicbrainz2.webservice as ws import headphones from headphones import db, albumart, logger, helpers @@ -165,7 +166,19 @@ def moveFiles(albumpath, release, tracks): def correctMetadata(albumid, release, downloaded_track_list): - pass + logger.info('Writing metadata') + items = [] + for downloaded_track in downloaded_track_list: + items.append(beets.library.Item.from_path(downloaded_track)) + + cur_artist, cur_album, out_tuples, rec = autotag.tag_album(items, search_artist=release['ArtistName'], search_album=release['AlbumTitle']) + + distance, items, info = out_tuples[0] + + autotag.apply_metadata(items, info) + + for item in items: + item.write() def renameFiles(albumpath, downloaded_track_list, release): diff --git a/headphones/searcher.py b/headphones/searcher.py index 5ebe4790..30d5e8db 100644 --- a/headphones/searcher.py +++ b/headphones/searcher.py @@ -157,11 +157,11 @@ def searchNZB(albumid=None, new=False): try: d = minidom.parseString(data) + node = d.documentElement + items = d.getElementsByTagName("item") except ExpatError: logger.error('Unable to get the NZBs.org feed. Check that your settings are correct - post a bug if they are') - - node = d.documentElement - items = d.getElementsByTagName("item") + items = None if len(items): diff --git a/headphones/templates.py b/headphones/templates.py index bace7097..df64e4ab 100644 --- a/headphones/templates.py +++ b/headphones/templates.py @@ -309,7 +309,7 @@ configform = form = '''
Folder Format:
- Use: artist, album and year
+ Use: artist, album and year, '/' for directories.
E.g.: artist/album [year]
File Format:
diff --git a/lib/beets/autotag/__init__.py b/lib/beets/autotag/__init__.py
index 90584fe1..cca77f31 100644
--- a/lib/beets/autotag/__init__.py
+++ b/lib/beets/autotag/__init__.py
@@ -19,7 +19,7 @@ import logging
from collections import defaultdict
import re
from lib.munkres import Munkres
-from unidecode import unidecode
+#from unidecode import unidecode
from lib.beets.autotag import mb
from lib.beets import library, mediafile, plugins
@@ -119,8 +119,8 @@ def _string_dist_basic(str1, str2):
transliteration/lowering to ASCII characters. Normalized by string
length.
"""
- str1 = unidecode(str1)
- str2 = unidecode(str2)
+ # str1 = unidecode(str1)
+ # str2 = unidecode(str2)
str1 = re.sub(r'[^a-z0-9]', '', str1.lower())
str2 = re.sub(r'[^a-z0-9]', '', str2.lower())
if not str1 and not str2: