Re-added SndUp's API key for audio uploads. Fixes #134

This commit is contained in:
Manuel Cortez 2017-05-06 19:40:31 +04:00
parent 43bdb358dd
commit 3cf6ac5c06
5 changed files with 15 additions and 3 deletions

View File

@ -6,6 +6,7 @@
* Removed TwUp as service as it no longer exists. ([#112](https://github.com/manuelcortez/TWBlue/issues/112)) * Removed TwUp as service as it no longer exists. ([#112](https://github.com/manuelcortez/TWBlue/issues/112))
* Release audio files after uploading them. ([#130](https://github.com/manuelcortez/TWBlue/issues/130)) * Release audio files after uploading them. ([#130](https://github.com/manuelcortez/TWBlue/issues/130))
* Now TWBlue will use Yandex's translation services instead microsoft translator. ([#132](https://github.com/manuelcortez/TWBlue/issues/132)) * Now TWBlue will use Yandex's translation services instead microsoft translator. ([#132](https://github.com/manuelcortez/TWBlue/issues/132))
* SndUp users will be able to upload audio in their account by using their API Key again. ([#134](https://github.com/manuelcortez/TWBlue/issues/134))
## Changes in version 0.90 ## Changes in version 0.90

View File

@ -25,6 +25,7 @@ current_soundpack = string(default="default")
indicate_audio = boolean(default=True) indicate_audio = boolean(default=True)
indicate_geo = boolean(default=True) indicate_geo = boolean(default=True)
indicate_img = boolean(default=True) indicate_img = boolean(default=True)
sndup_api_key = string(default="")
[other_buffers] [other_buffers]
timelines = list(default=list()) timelines = list(default=list())

View File

@ -166,6 +166,7 @@ class accountSettingsController(globalSettingsController):
self.dialog.set_value("sound", "indicate_geo", self.config["sound"]["indicate_geo"]) self.dialog.set_value("sound", "indicate_geo", self.config["sound"]["indicate_geo"])
self.dialog.set_value("sound", "indicate_img", self.config["sound"]["indicate_img"]) self.dialog.set_value("sound", "indicate_img", self.config["sound"]["indicate_img"])
self.dialog.create_extras(OCRSpace.translatable_langs) self.dialog.create_extras(OCRSpace.translatable_langs)
self.dialog.set_value("extras", "sndup_apiKey", self.config["sound"]["sndup_api_key"])
self.dialog.realize() self.dialog.realize()
self.dialog.set_title(_(u"Account settings for %s") % (self.user,)) self.dialog.set_title(_(u"Account settings for %s") % (self.user,))
self.response = self.dialog.get_response() self.response = self.dialog.get_response()
@ -238,9 +239,9 @@ class accountSettingsController(globalSettingsController):
self.config["sound"]["indicate_audio"] = self.dialog.get_value("sound", "indicate_audio") self.config["sound"]["indicate_audio"] = self.dialog.get_value("sound", "indicate_audio")
self.config["sound"]["indicate_geo"] = self.dialog.get_value("sound", "indicate_geo") self.config["sound"]["indicate_geo"] = self.dialog.get_value("sound", "indicate_geo")
self.config["sound"]["indicate_img"] = self.dialog.get_value("sound", "indicate_img") self.config["sound"]["indicate_img"] = self.dialog.get_value("sound", "indicate_img")
self.config["sound"]["sndup_api_key"] = self.dialog.get_value("extras", "apiKey")
self.buffer.session.sound.config = self.config["sound"] self.buffer.session.sound.config = self.config["sound"]
self.buffer.session.sound.check_soundpack() self.buffer.session.sound.check_soundpack()
self.config.write() self.config.write()
def toggle_state(self,*args,**kwargs): def toggle_state(self,*args,**kwargs):

View File

@ -52,7 +52,11 @@ class audioUploader(object):
self.uploaderDialog = wx_transfer_dialogs.UploadDialog(self.file) self.uploaderDialog = wx_transfer_dialogs.UploadDialog(self.file)
output.speak(_(u"Attaching...")) output.speak(_(u"Attaching..."))
if self.dialog.get("services") == "SNDUp": if self.dialog.get("services") == "SNDUp":
url = "http://sndup.net/post.php" base_url = "http://sndup.net/post.php"
if len(self.config["sound"]["sndup_api_key"]) > 0:
url = base_url + '?apikey=' + self.config['sound']['sndup_api_key']
else:
url = base_url
self.uploaderFunction = transfer.Upload(obj=self, field='file', url=url, filename=self.file, completed_callback=completed_callback) self.uploaderFunction = transfer.Upload(obj=self, field='file', url=url, filename=self.file, completed_callback=completed_callback)
pub.subscribe(self.uploaderDialog.update, "uploading") pub.subscribe(self.uploaderDialog.update, "uploading")
self.uploaderDialog.get_response(self.uploaderFunction.perform_threaded) self.uploaderDialog.get_response(self.uploaderFunction.perform_threaded)

View File

@ -304,7 +304,12 @@ class extrasPanel(wx.Panel):
ocrLanguageSizer = wx.StaticBoxSizer(OCRBox, wx.HORIZONTAL) ocrLanguageSizer = wx.StaticBoxSizer(OCRBox, wx.HORIZONTAL)
ocrLanguageSizer.Add(self.ocr_lang, 0, wx.ALL, 5) ocrLanguageSizer.Add(self.ocr_lang, 0, wx.ALL, 5)
mainSizer.Add(ocrLanguageSizer, 0, wx.ALL, 5) mainSizer.Add(ocrLanguageSizer, 0, wx.ALL, 5)
lbl = wx.StaticText(self, wx.NewId(), _(u"API Key for SndUp"))
self.sndup_apiKey = wx.TextCtrl(self, -1)
sndupBox = wx.BoxSizer(wx.HORIZONTAL)
sndupBox.Add(lbl, 0, wx.ALL, 5)
sndupBox.Add(self.sndup_apiKey, 0, wx.ALL, 5)
mainSizer.Add(sndupBox, 0, wx.ALL, 5)
self.SetSizer(mainSizer) self.SetSizer(mainSizer)
class configurationDialog(baseDialog.BaseWXDialog): class configurationDialog(baseDialog.BaseWXDialog):