Merge with bugfix-0.5 0.5.12
/mp3togo/tags.py
blob:41c38e52135dd61eb50fff6d27d716768b0df691 -> blob:3ec89c08ab32e92c5219bc227d36ace99b32559a
--- mp3togo/tags.py
+++ mp3togo/tags.py
@@ -94,7 +94,7 @@ class Tags(UserDict.DictMixin):
o['GENRE'] = 'Other'
return o
- if self._type == 'mp3' and HAVE_ID3:
+ if self._type == 'mp3':
rok = False
if HAVE_eyeD3:
eye = eyeD3.Tag()
@@ -112,10 +112,9 @@ class Tags(UserDict.DictMixin):
except eyeD3.tag.GenreException:
self._tags['GENRE'] = 'Other'
del eye
- rok = True
except eyeD3.tag.TagException:
pass
- if HAVE_ID3 and not rok:
+ elif HAVE_ID3:
info = ID3.ID3(self._file, as_tuple=1).as_dict()
self._tags = copytags(info)
del info
@@ -141,10 +140,15 @@ class Tags(UserDict.DictMixin):
path = path.replace('_', ' ')
for id, depth in [('ARTIST', -3), ('ALBUM', -2), ('TITLE', -1)]:
if not id in self._tags or self._tags[id][0] == '':
- try:
- self._tags[id] = [path.split(os.sep)[depth]]
- except IndexError:
- self._tags[id] = "%s unknown" % id.lower()
+ if self._opts['noguesstags']:
+ self._tags[id] = ['']
+ else:
+ try:
+ self._tags[id] = [path.split(os.sep)[depth]]
+ self._opts.log(1, "Missing %s tag, guessing %s from file name." %
+ (id, self._tags[id][0]))
+ except IndexError:
+ self._tags[id] = "%s unknown" % id.lower()
self._readok.set()
self._lock.release()