[tuxdroid-svn] r5636 - in software_suite_v3/software/plugin/plugin-webradio/trunk: executables res
Status: Beta
Brought to you by:
ks156
|
From: remi <c2m...@c2...> - 2009-10-13 08:16:13
|
Author: remi Date: 2009-10-13 10:16:01 +0200 (Tue, 13 Oct 2009) New Revision: 5636 Removed: software_suite_v3/software/plugin/plugin-webradio/trunk/executables/WebRadioList.py Modified: software_suite_v3/software/plugin/plugin-webradio/trunk/executables/plugin-webradio.py software_suite_v3/software/plugin/plugin-webradio/trunk/resources/de.po software_suite_v3/software/plugin/plugin-webradio/trunk/resources/en.po software_suite_v3/software/plugin/plugin-webradio/trunk/resources/fr.po software_suite_v3/software/plugin/plugin-webradio/trunk/resources/nl.po software_suite_v3/software/plugin/plugin-webradio/trunk/resources/plugin.pot software_suite_v3/software/plugin/plugin-webradio/trunk/resources/plugin.xml Log: * Get radio urls from kysoh ftp * Avoiding radios with url marked as "DISABLED" (Configured in the ftp file) * Added message about internet connection error (radios list not retrieved from ftp) * Radios list defined by gadgets * Radios list can be specific to a language * Radio name can be != than radio tts name (Configured in the ftp file) * Not compatible with the previous version ! Deleted: software_suite_v3/software/plugin/plugin-webradio/trunk/executables/WebRadioList.py =================================================================== --- software_suite_v3/software/plugin/plugin-webradio/trunk/executables/WebRadioList.py 2009-10-12 13:33:20 UTC (rev 5635) +++ software_suite_v3/software/plugin/plugin-webradio/trunk/executables/WebRadioList.py 2009-10-13 08:16:01 UTC (rev 5636) @@ -1,12 +0,0 @@ -# Web radios dictionary -WEBRADIO = [ - ["France-Inter", "http://viphttp.yacast.net/V4/radiofrance/franceinter_hd.m3u"], - ["RMC-Info", "http://cache.yacast.fr/V4/rmc/rmc.m3u"], - ["France-Info", "http://viphttp.yacast.net/V4/radiofrance/franceinfo_bd.m3u"], - ["France-Culture", "http://viphttp.yacast.net/V4/radiofrance/franceculture_hd.m3u"], - ["Le-Mouv", "http://viphttp.yacast.net/V4/radiofrance/lemouv_hd.m3u"], - ["France-Musique", "http://viphttp.yacast.net/V4/radiofrance/francemusique_hd.m3u"], - ["France-Bleu-Ile-de-France", "http://viphttp.yacast.net/V4/radiofrance/francebleu_idf_hd.m3u"], - ["Fun-Radio", "http://92.61.164.12:80/fun-1-44-96"], - ["Skyrock", "mms://vipmms9.yacast.net/encoderskyrock"], -] Modified: software_suite_v3/software/plugin/plugin-webradio/trunk/executables/plugin-webradio.py =================================================================== --- software_suite_v3/software/plugin/plugin-webradio/trunk/executables/plugin-webradio.py 2009-10-12 13:33:20 UTC (rev 5635) +++ software_suite_v3/software/plugin/plugin-webradio/trunk/executables/plugin-webradio.py 2009-10-13 08:16:01 UTC (rev 5636) @@ -55,9 +55,17 @@ 2009/06/29 - version 0.0.8: - Added support of webradio address - + 2009/08/31 - version 0.0.9: - Added method to clean mplayer instances at plugin exit (Windows) +2009/08/31 - version 0.0.10: + - Get radio urls from kysoh ftp + - Avoiding radios with url marked as "DISABLED" (Configured in the ftp file) + - Added message about internet connection error (radios list not retrieved from ftp) + - Radios list defined by gadgets + - Radios list can be specific to a language + - Radio name can be != than radio tts name (Configured in the ftp file) + - Not compatible with the previous version ! """ __author__ = "Eric Lescaudron AKA Gwadavel" @@ -76,7 +84,8 @@ from util.SimplePlugin.SimplePluginConfiguration import SimplePluginConfiguration from util.SimplePlugin.SimplePlugin import SimplePlugin from util.player.mplayer.Mplayer import Mplayer -from WebRadioList import WEBRADIO +from util.misc.URLTools import * +from util.misc.DirectoriesAndFilesTools import * class Configuration(SimplePluginConfiguration): @@ -85,6 +94,7 @@ self.__radio = "France-Inter" self.__url = "http://viphttp.yacast.net/V4/radiofrance/franceinter_hd.m3u" self.__modeUrl = False + self.__radios = "NRJ,Skyrock,Fun radio,France-Inter,RFM,France-Info,France-Culture" def getRadio(self): return self.__radio @@ -92,6 +102,12 @@ def setRadio(self, radio): self.__radio = radio + def getRadios(self): + return self.__radios + + def setRadios(self, radios): + self.__radios = radios + def getUrl(self): return self.__url @@ -110,8 +126,12 @@ SimplePlugin.__init__(self) self.__player = Mplayer() self.__currentRadioIndex = -1 + self.__onlineRadiosList = None + self.__radiosList = [] + self.__getRadioListFromFtp() def start(self): + self.__buildRadiosList() if self.getCommand() == "run": self.run() else: @@ -120,6 +140,42 @@ def run(self): self.__doExecute() + def __getRadioListFromFtp(self): + if self.__onlineRadiosList == None: + # Download radios list + RMFile("radiosList") + URLDownloadToFile("http://ftp.kysoh.com/misc/other/web_radios/radiosList", "radiosList") + if not os.path.isfile("radiosList"): + return + # Load radios list + try: + f = open("radiosList", "r") + try: + self.__onlineRadiosList = eval(f.read()) + + finally: + f.close() + except: + return + + def __buildRadiosList(self): + self.__radiosList = [] + if self.__onlineRadiosList != None: + radios = self.configuration().getRadios().split(",") + for radio in radios: + for oradio in self.__onlineRadiosList: + oradioName = oradio[0] + oradioUrl = oradio[1] + oradioTts = oradio[2] + if oradioUrl == "DISABLED": + continue + if oradioName == radio: + if oradioTts == "": + oradioTts = oradioName + self.__radiosList.append([oradioName, oradioUrl, oradioTts]) + else: + self.throwMessage("Sorry, I could not connect to the webradio. Please check your internet connection or try again later.") + def __doExecute(self): self.__defaultWebRadio() @@ -135,21 +191,28 @@ self.__currentRadioIndex = 0 myRadio = self.configuration().getRadio() radioUrl = myRadio - for i, radio in enumerate(WEBRADIO): + for i, radio in enumerate(self.__radiosList): if radio[0] == myRadio: self.__currentRadioIndex = i radioUrl = radio[1] + if radioUrl == myRadio: + if len(self.__radiosList) > 0: + myRadio = self.__radiosList[0][2] + radioUrl = self.__radiosList[0][1] + self.__currentRadioIndex = 0 + else: + return self.__speakRadioName(myRadio) self.__player.start(radioUrl, True) def __nextWebRadio(self): # Get next webradio url nextIndex = self.__currentRadioIndex + 1 - if nextIndex >= len(WEBRADIO): + if nextIndex >= len(self.__radiosList): nextIndex = 0 self.__currentRadioIndex = nextIndex - radioUrl = WEBRADIO[self.__currentRadioIndex][1] - radioName = WEBRADIO[self.__currentRadioIndex][0] + radioUrl = self.__radiosList[self.__currentRadioIndex][1] + radioName = self.__radiosList[self.__currentRadioIndex][2] # Stop current web radio self.__player.stop() self.__speakRadioName(radioName) @@ -159,10 +222,10 @@ # Get next webradio url nextIndex = self.__currentRadioIndex - 1 if nextIndex < 0: - nextIndex = len(WEBRADIO) - 1 + nextIndex = len(self.__radiosList) - 1 self.__currentRadioIndex = nextIndex - radioUrl = WEBRADIO[self.__currentRadioIndex][1] - radioName = WEBRADIO[self.__currentRadioIndex][0] + radioUrl = self.__radiosList[self.__currentRadioIndex][1] + radioName = self.__radiosList[self.__currentRadioIndex][2] # Stop current web radio self.__player.stop() self.__speakRadioName(radioName) Modified: software_suite_v3/software/plugin/plugin-webradio/trunk/resources/de.po =================================================================== --- software_suite_v3/software/plugin/plugin-webradio/trunk/resources/de.po 2009-10-12 13:33:20 UTC (rev 5635) +++ software_suite_v3/software/plugin/plugin-webradio/trunk/resources/de.po 2009-10-13 08:16:01 UTC (rev 5636) @@ -21,3 +21,9 @@ msgid "Uses webradio as alarm" msgstr "Nutzt das Webradio als Radiowecker" + +msgid "enum_radios_list" +msgstr "NRJ,Skyrock,Fun radio,France-Inter,RFM,France-Info,France-Culture" + +msgid "Sorry, I could not connect to the webradio. Please check your internet connection or try again later." +msgstr "Sorry, Verbindung zum Webradio nicht möglich. Prüfen Sie die Internet-Verbindung oder versuchen Sie es später." Modified: software_suite_v3/software/plugin/plugin-webradio/trunk/resources/en.po =================================================================== --- software_suite_v3/software/plugin/plugin-webradio/trunk/resources/en.po 2009-10-12 13:33:20 UTC (rev 5635) +++ software_suite_v3/software/plugin/plugin-webradio/trunk/resources/en.po 2009-10-13 08:16:01 UTC (rev 5636) @@ -14,10 +14,16 @@ msgstr "Webradio address url" msgid "Using the webradio URL" -msgstr "Use address url" +msgstr "Use address url" msgid "Clock radio" msgstr "Clock radio" msgid "Uses webradio as alarm" msgstr "Use the webradio as a clock radio" + +msgid "enum_radios_list" +msgstr "NRJ,Skyrock,Fun radio,France-Inter,RFM,France-Info,France-Culture" + +msgid "Sorry, I could not connect to the webradio. Please check your internet connection or try again later." +msgstr "Sorry, I could not connect to the webradio. Please check your internet connection or try again later." Modified: software_suite_v3/software/plugin/plugin-webradio/trunk/resources/fr.po =================================================================== --- software_suite_v3/software/plugin/plugin-webradio/trunk/resources/fr.po 2009-10-12 13:33:20 UTC (rev 5635) +++ software_suite_v3/software/plugin/plugin-webradio/trunk/resources/fr.po 2009-10-13 08:16:01 UTC (rev 5636) @@ -21,3 +21,9 @@ msgid "Uses webradio as alarm" msgstr "Utiliser une webradio en tant que réveil" + +msgid "enum_radios_list" +msgstr "NRJ,Skyrock,Fun radio,France-Inter,RFM,France-Info,France-Culture" + +msgid "Sorry, I could not connect to the webradio. Please check your internet connection or try again later." +msgstr "Désolé, je ne peux pas me connecter à la radio internet. Merci de controler votre connexion internet ou de réessayer plus tard." Modified: software_suite_v3/software/plugin/plugin-webradio/trunk/resources/nl.po =================================================================== --- software_suite_v3/software/plugin/plugin-webradio/trunk/resources/nl.po 2009-10-12 13:33:20 UTC (rev 5635) +++ software_suite_v3/software/plugin/plugin-webradio/trunk/resources/nl.po 2009-10-13 08:16:01 UTC (rev 5636) @@ -14,10 +14,16 @@ msgstr "Webradio adres url" msgid "Using the webradio URL" -msgstr "Gebruik adres url" +msgstr "Gebruik adres url" msgid "Clock radio" msgstr "Klok radio" msgid "Uses webradio as alarm" msgstr "Gebruik de webradio als alarm klok" + +msgid "enum_radios_list" +msgstr "NRJ,Skyrock,Fun radio,France-Inter,RFM,France-Info,France-Culture" + +msgid "Sorry, I could not connect to the webradio. Please check your internet connection or try again later." +msgstr "Sorry, ik kan geen connectie maken met de webradio. Controleer je internet connectie of probeer later opnieuw." Modified: software_suite_v3/software/plugin/plugin-webradio/trunk/resources/plugin.pot =================================================================== --- software_suite_v3/software/plugin/plugin-webradio/trunk/resources/plugin.pot 2009-10-12 13:33:20 UTC (rev 5635) +++ software_suite_v3/software/plugin/plugin-webradio/trunk/resources/plugin.pot 2009-10-13 08:16:01 UTC (rev 5636) @@ -14,10 +14,16 @@ msgstr "" msgid "Using the webradio URL" -msgstr "" +msgstr "" msgid "Clock radio" msgstr "" msgid "Uses webradio as alarm" msgstr "" + +msgid "enum_radios_list" +msgstr "" + +msgid "Sorry, I could not connect to the webradio. Please check your internet connection or try again later." +msgstr "Sorry, I could not connect to the webradio. Please check your internet connection or try again later." Modified: software_suite_v3/software/plugin/plugin-webradio/trunk/resources/plugin.xml =================================================================== --- software_suite_v3/software/plugin/plugin-webradio/trunk/resources/plugin.xml 2009-10-12 13:33:20 UTC (rev 5635) +++ software_suite_v3/software/plugin/plugin-webradio/trunk/resources/plugin.xml 2009-10-13 08:16:01 UTC (rev 5636) @@ -17,7 +17,7 @@ <parameter name="radio" description="Select a webradio" - type="enum(France-Bleu-Ile-de-France,France-Culture,France-Info,France-Inter,France-Musique,Le-Mouv,RMC-Info,Fun-Radio,Skyrock)" + type="enum(enum_radios_list)" defaultValue="France-Inter" /> <parameter name="url" @@ -29,6 +29,12 @@ description="Using the webradio URL" type="boolean" defaultValue="false" /> + <parameter + name="radios" + description="Internal" + type="string" + defaultValue="enum_radios_list" + visible="false" /> </parameters> <commands> <command |