Fixed errors when uploading audio files without ID3 tags to VK
This commit is contained in:
parent
36b25e1c9f
commit
d1b11c0630
13
changelog.md
13
changelog.md
@ -4,6 +4,19 @@
|
||||
|
||||
### New additions
|
||||
|
||||
### bugfixes
|
||||
|
||||
* Fixed an error that was making Socializer unable to attach audio files from the computer, if the file does not include correct ID3 TAGS.
|
||||
* Fixed a traceback that was being logged when attempting to load an image but cancel the dialog for attaching it.
|
||||
|
||||
### Changes
|
||||
|
||||
* Less confidential user data will be send to the logs, so it will be much safer to pass logs publicly.
|
||||
|
||||
## changes in Versions 0.21 and 0.22 (14.07.2019)
|
||||
|
||||
### New additions
|
||||
|
||||
* Added "post in groups" feature. In order to do so, you need to load the posts for the group where you want to send something. Once loaded, go to the post button in the group's wall and select whether you want to post in the group's behalf or as yourself.
|
||||
* In all audio buffers, it is possible to select individual tracks to be played together. In order to do so, you need to press space to start the selection of items. When selected, the item will emit a sound to indicate the change. Press space in all items you want to select/unselect. When you're focusing an already selected item it will play a sound to indicate that it is already selected. Once you're done with your selection, pressing enter in the list of tracks will start the playback of the list of items you have selected. This is a very experimental feature. More actions can be supported based in this selection method if it proves to be useful.
|
||||
* In conversation buffers, it is possible to display and open wall posts sent as attachments in messages.
|
||||
|
@ -8,6 +8,7 @@ import logging
|
||||
import interactors
|
||||
import views
|
||||
from mutagen.id3 import ID3
|
||||
from mutagen.id3._util import ID3NoHeaderError
|
||||
from sessionmanager.utils import seconds_to_string
|
||||
from . import audioRecorder, base
|
||||
|
||||
@ -47,15 +48,19 @@ class attachPresenter(base.basePresenter):
|
||||
if audio != None:
|
||||
# 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.
|
||||
audio_tags = ID3(audio)
|
||||
if "TIT2" in audio_tags:
|
||||
title = audio_tags["TIT2"].text[0]
|
||||
else:
|
||||
title = _("Untitled")
|
||||
if "TPE1" in audio_tags:
|
||||
artist = audio_tags["TPE1"].text[0]
|
||||
else:
|
||||
try:
|
||||
audio_tags = ID3(audio)
|
||||
if "TIT2" in audio_tags:
|
||||
title = audio_tags["TIT2"].text[0]
|
||||
else:
|
||||
title = _("Untitled")
|
||||
if "TPE1" in audio_tags:
|
||||
artist = audio_tags["TPE1"].text[0]
|
||||
else:
|
||||
artist = _("Unknown artist")
|
||||
except ID3NoHeaderError: # File doesn't include ID3 tags so let's assume unknown artist.
|
||||
artist = _("Unknown artist")
|
||||
title = os.path.basename(audio).replace(".mp3", "")
|
||||
audioInfo = {"type": "audio", "file": audio, "from": "local", "title": title, "artist": artist}
|
||||
self.attachments.append(audioInfo)
|
||||
# Translators: This is the text displayed in the attachments dialog, when the user adds an audio file.
|
||||
|
@ -41,7 +41,7 @@ class attachDialog(widgetUtils.BaseDialog):
|
||||
def get_image(self):
|
||||
openFileDialog = wx.FileDialog(self, _("Select the picture to be uploaded"), "", "", _("Image files (*.png, *.jpg, *.gif)|*.png; *.jpg; *.gif"), wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)
|
||||
if openFileDialog.ShowModal() == wx.ID_CANCEL:
|
||||
return None
|
||||
return (None, None)
|
||||
dsc = self.ask_description()
|
||||
return (openFileDialog.GetPath(), dsc)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user