Replaced eyed3 for mutagen for tag parsing
This commit is contained in:
parent
527d4670d4
commit
b4adf42644
@ -9,8 +9,7 @@ requests-oauthlib
|
|||||||
future
|
future
|
||||||
arrow
|
arrow
|
||||||
yandex.translate
|
yandex.translate
|
||||||
eyed3
|
mutagen
|
||||||
python-magic-bin
|
|
||||||
# forked repositories previously found at http://q-continuum.net
|
# forked repositories previously found at http://q-continuum.net
|
||||||
git+https://code.manuelcortez.net/manuelcortez/libloader
|
git+https://code.manuelcortez.net/manuelcortez/libloader
|
||||||
git+https://code.manuelcortez.net/manuelcortez/platform_utils
|
git+https://code.manuelcortez.net/manuelcortez/platform_utils
|
||||||
|
@ -4,8 +4,8 @@ this controller will take care of preparing data structures to be uploaded later
|
|||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
import eyed3
|
|
||||||
import widgetUtils
|
import widgetUtils
|
||||||
|
from mutagen.id3 import ID3
|
||||||
from wxUI.dialogs import attach as gui
|
from wxUI.dialogs import attach as gui
|
||||||
from wxUI.dialogs import selector
|
from wxUI.dialogs import selector
|
||||||
from wxUI.menus import attachMenu
|
from wxUI.menus import attachMenu
|
||||||
@ -69,9 +69,15 @@ class attach(object):
|
|||||||
if audio != None:
|
if audio != None:
|
||||||
# Define data structure for this attachment, as will be required by VK API later.
|
# Define data structure for this attachment, as will be required by VK API later.
|
||||||
# Let's extract the ID3 tags to show them in the list and send them to VK, too.
|
# Let's extract the ID3 tags to show them in the list and send them to VK, too.
|
||||||
audio_tags = eyed3.load(audio)
|
audio_tags = ID3(audio)
|
||||||
title = audio_tags.tag.title
|
if "TIT2" in audio_tags:
|
||||||
artist = audio_tags.tag.artist
|
title = audio_tags["TIT2"].text[0]
|
||||||
|
else:
|
||||||
|
title = _(u"Untitled")
|
||||||
|
if "TPE1" in audio_tags:
|
||||||
|
artist = audio_tags["TPE1"].text[0]
|
||||||
|
else:
|
||||||
|
artist = _(u"Unknown artist")
|
||||||
audioInfo = {"type": "audio", "file": audio, "from": "local", "title": title, "artist": artist}
|
audioInfo = {"type": "audio", "file": audio, "from": "local", "title": title, "artist": artist}
|
||||||
self.attachments.append(audioInfo)
|
self.attachments.append(audioInfo)
|
||||||
# Translators: This is the text displayed in the attachments dialog, when the user adds an audio file.
|
# Translators: This is the text displayed in the attachments dialog, when the user adds an audio file.
|
||||||
|
Loading…
Reference in New Issue
Block a user