Explorar el Código

Customize comment tag

Deben Oldert hace 6 años
padre
commit
7d23f568fc
Se han modificado 2 ficheros con 6 adiciones y 3 borrados
  1. 1 1
      helper/settings.py
  2. 5 2
      helper/tagging.py

+ 1 - 1
helper/settings.py

@@ -54,4 +54,4 @@ class Settings:
     MinQuality = SettingEntry('minQuality', 'MD_QUALITY', 300, 'music-downloader', int)
 
     #Format for downloaded file ID3 comment
-    CommentFormat = SettingEntry('saveDir', 'MD_SAVEDIR', '~/Downloads', 'music-downloader')
+    CommentFormat = SettingEntry('commentFormat', 'MD_COMMENT', '', 'music-downloader')

+ 5 - 2
helper/tagging.py

@@ -4,6 +4,7 @@ from mutagen.id3 import ID3, TIT2, TALB, TPE1, COMM, TCON, APIC
 
 from helper.sites.request import RawRequest
 from tags import available
+from helper.settings import Settings
 
 
 def search_tags(item):
@@ -57,16 +58,18 @@ def write_tags_to_file(file, item):
     mp3['TIT2'] = TIT2(encoding=3, text=tagitem.title)
     mp3['TALB'] = TALB(encoding=3, text=tagitem.album)
     mp3['TPE1'] = TPE1(encoding=3, text=tagitem.artist)
-    mp3['COMM'] = COMM(encoding=3, text='LABEL:{0};'.format(tagitem.label))
     mp3['TCON'] = TCON(encoding=3, text=tagitem.genre)
-
     mp3['APIC'] = APIC(encoding=3,
                        mime='image/jpeg',
                        type=3,
                        desc='Cover',
                        data=tagitem.cover_image)
 
+    mp3.add(COMM(encoding=3, lang=u'eng', text=Settings.CommentFormat.get().format(**tagitem.__dict__)))
+
     mp3.save(file)
+    print(Settings.CommentFormat.get().format(**tagitem.__dict__))
+    print(mp3)
 
 
 def download_artwork(tag):