Author: remi
Date: 2009-03-28 19:32:24 +0100 (Sat, 28 Mar 2009)
New Revision: 4243
Added:
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/branches/
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/tags/
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/build.py
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/GadgetPackager.py
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/__init__.py
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/util/
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/util/__init__.py
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/util/misc/
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/util/misc/DirectoriesAndFilesTools.py
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/util/misc/__init__.py
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/util/misc/test_DirectoriesAndFilesTools.py
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/util/misc/version.py
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/version.py
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/dos.bat
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/executables/
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/executables/WebRadioList.py
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/executables/tux-gadget-webradio.py
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/resources/
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/resources/clockradio.png
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/resources/gadget.pot
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/resources/gadget.xml
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/resources/help.html
Log:
* gadget webradio is the new name of the gadget clockradio.
- Bumped the version to 0.0.5
- Now uses the Tux Droid server modules.
- Tgf size is now very small (~7Ko)
- Only compatible with the new server !
- Old project is still alive for the compatibility with the java framework in
the CC.
Added:
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/build.py
===================================================================
--- software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/build.py
(rev 0)
+++ software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/build.py
2009-03-28 18:32:24 UTC (rev 4243)
@@ -0,0 +1,11 @@
+# -*- coding: utf-8 -*-
+
+# Copyleft (C) 2009 C2ME Sa
+# Remi Jocaille <[email protected]>
+# Distributed under the terms of the GNU General Public License
+# http://www.gnu.org/copyleft/gpl.html
+
+from builder.GadgetPackager import GadgetPackager
+
+if __name__ == "__main__":
+ GadgetPackager().createTgf("tuxdroid-gadget-webradio.tgf")
Property changes on:
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/build.py
___________________________________________________________________
Name: svn:keywords
+ Id
Added:
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/GadgetPackager.py
===================================================================
---
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/GadgetPackager.py
(rev 0)
+++
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/GadgetPackager.py
2009-03-28 18:32:24 UTC (rev 4243)
@@ -0,0 +1,78 @@
+# -*- coding: utf-8 -*-
+
+import version
+__author__ = version.author
+__date__ = version.date
+__version__ = version.version
+__licence__ = version.licence
+del version
+
+# Copyleft (C) 2009 C2ME Sa
+# Remi Jocaille <[email protected]>
+# Distributed under the terms of the GNU General Public License
+# http://www.gnu.org/copyleft/gpl.html
+
+import os
+from zipfile import *
+
+from util.misc.DirectoriesAndFilesTools import *
+
+#
------------------------------------------------------------------------------
+# Class to create a TGF file from the main directory of a python gadget
project.
+#
------------------------------------------------------------------------------
+class GadgetPackager(object):
+ """Class to create a TGF file from the main directory of a python gadget
+ project.
+ """
+
+ #
--------------------------------------------------------------------------
+ # Create a tgf file.
+ #
--------------------------------------------------------------------------
+ def createTgf(self, tgfFileName):
+ """Create a tgf file.
+ @param tgfFileName: Tux Gadget Format file name.
+ @return: The success of the file creation.
+ """
+ self.__sourcePath = os.path.realpath("")
+ if not os.path.isdir(self.__sourcePath):
+ return False
+ if not os.path.isdir(os.path.join(self.__sourcePath, "executables")):
+ return False
+ if not os.path.isdir(os.path.join(self.__sourcePath, "resources")):
+ return False
+ # Get some paths
+ SRC_EXECUTABLES_PATH = os.path.join(self.__sourcePath, "executables")
+ SRC_RESOURCES_PATH = os.path.join(self.__sourcePath, "resources")
+ TMP_BUILD_PATH = os.path.join(self.__sourcePath, "tmp")
+ DEST_EXECUTABLES_PATH = os.path.join(TMP_BUILD_PATH, "executables")
+ DEST_RESOURCES_PATH = os.path.join(TMP_BUILD_PATH, "resources")
+ DEST_TGF_FILENAME = os.path.join(self.__sourcePath, tgfFileName)
+ # Create the temporary build path
+ MKDirsF(TMP_BUILD_PATH)
+ # Copy "executables" directory
+ CPDir(SRC_EXECUTABLES_PATH, DEST_EXECUTABLES_PATH)
+ # Copy "resources" directory
+ CPDir(SRC_RESOURCES_PATH, DEST_RESOURCES_PATH)
+ # Filtering the content of temporary path
+ RMWithFilters(TMP_BUILD_PATH, filters = ['.svn', '.pyc'])
+ # Create a zip file
+ directory = TMP_BUILD_PATH
+ last_cwd = os.getcwd()
+ os.chdir(TMP_BUILD_PATH)
+ zf = ZipFile(DEST_TGF_FILENAME, 'w', compression = ZIP_DEFLATED)
+ def walker(zip, directory, files, root = directory):
+ for file in files:
+ file = os.path.join(directory, file)
+ name = file[len(TMP_BUILD_PATH) + 1:]
+ if os.path.isfile(file):
+ zip.write(file, name, ZIP_DEFLATED)
+ elif os.path.isdir(file):
+ file = os.path.join(file, "")
+ name = os.path.join(name, "")
+ zip.writestr(name, name)
+ os.path.walk(TMP_BUILD_PATH, walker, zf)
+ zf.close()
+ os.chdir(os.path.abspath(last_cwd))
+ # Remove the temporary directory
+ RMDirs(TMP_BUILD_PATH)
+ return True
Property changes on:
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/GadgetPackager.py
___________________________________________________________________
Name: svn:keywords
+ Id
Added:
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/__init__.py
===================================================================
Property changes on:
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/__init__.py
___________________________________________________________________
Name: svn:keywords
+ Id
Added:
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/util/__init__.py
===================================================================
Property changes on:
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/util/__init__.py
___________________________________________________________________
Name: svn:keywords
+ Id
Added:
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/util/misc/DirectoriesAndFilesTools.py
===================================================================
---
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/util/misc/DirectoriesAndFilesTools.py
(rev 0)
+++
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/util/misc/DirectoriesAndFilesTools.py
2009-03-28 18:32:24 UTC (rev 4243)
@@ -0,0 +1,161 @@
+# -*- coding: utf-8 -*-
+
+import version
+__author__ = version.author
+__date__ = version.date
+__version__ = version.version
+__licence__ = version.licence
+del version
+
+# Copyleft (C) 2008 Acness World
+# Remi Jocaille <[email protected]>
+# Distributed under the terms of the GNU General Public License
+# http://www.gnu.org/copyleft/gpl.html
+
+import os
+import shutil
+
+if os.name == 'nt':
+ import win32con
+ import win32file
+
+#
==============================================================================
+# Public functions
+#
==============================================================================
+
+#
------------------------------------------------------------------------------
+# Force to create a directories tree if not exists.
+#
------------------------------------------------------------------------------
+def MKDirs(path):
+ """Force to create a directories tree if not exists.
+ @param path: Directory path.
+ """
+ if not os.path.isdir(path):
+ try:
+ os.makedirs(path)
+ except:
+ pass
+
+#
------------------------------------------------------------------------------
+# Force to create a directories tree after having deleted the old one.
+#
------------------------------------------------------------------------------
+def MKDirsF(path):
+ """Force to create a directories tree after having deleted the old one.
+ @param path: Directory path.
+ """
+ if os.path.isdir(path):
+ RMDirs(path)
+ os.makedirs(path)
+
+#
------------------------------------------------------------------------------
+# Remove directories and files recursively.
+#
------------------------------------------------------------------------------
+def RMDirs(path):
+ """Remove directories and files recursively.
+ @param path: Path of the base directory.
+ """
+ if not os.path.isdir(path):
+ return
+ for root, dirs, files in os.walk(path, topdown = False):
+ for d in dirs:
+ try:
+ os.removedirs(os.path.join(root, d))
+ except:
+ pass
+ for f in files:
+ try:
+ if os.name == 'nt':
+ win32file.SetFileAttributesW(os.path.join(root, f),
+ win32con.FILE_ATTRIBUTE_NORMAL)
+ os.remove(os.path.join(root, f))
+ except:
+ pass
+ if os.path.isdir(path):
+ try:
+ os.removedirs(path)
+ except:
+ pass
+
+#
------------------------------------------------------------------------------
+# Remove directories and files recursively with filters.
+#
------------------------------------------------------------------------------
+def RMWithFilters(path, filters = ['.pyc', '.pyo']):
+ """Remove directories and files recursively with filters.
+ @param path: Path of the base directory.
+ @param filters: Filters as list.
+ """
+ def checkFilter(name):
+ for filter in filters:
+ if name.lower().find(filter.lower()) == (len(name) - len(filter)):
+ return True
+ return False
+
+ if not os.path.isdir(path):
+ return
+
+ for root, dirs, files in os.walk(path, topdown = False):
+ for d in dirs:
+ if checkFilter(os.path.join(root, d)):
+ try:
+ RMDirs(os.path.join(root, d))
+ except:
+ pass
+ for f in files:
+ if checkFilter(os.path.join(root, f)):
+ try:
+ if os.name == 'nt':
+ win32file.SetFileAttributesW(os.path.join(root, f),
+ win32con.FILE_ATTRIBUTE_NORMAL)
+ os.remove(os.path.join(root, f))
+ except:
+ pass
+
+#
------------------------------------------------------------------------------
+# Remove a file.
+#
------------------------------------------------------------------------------
+def RMFile(path):
+ """Remove a file.
+ @param path: File path.
+ """
+ if os.path.isfile(path):
+ try:
+ if os.name == 'nt':
+ win32file.SetFileAttributesW(path,
+ win32con.FILE_ATTRIBUTE_NORMAL)
+ os.remove(path)
+ except:
+ pass
+
+#
------------------------------------------------------------------------------
+# Copy a directories tree to another directory.
+#
------------------------------------------------------------------------------
+def CPDir(src, dest):
+ """Copy a directories tree to another directory.
+ @param src: Source path.
+ @param dest: Destination path.
+ """
+ if not os.path.isdir(src):
+ return
+ if os.path.isdir(dest):
+ RMDirs(dest)
+ shutil.copytree(src, dest)
+
+#
------------------------------------------------------------------------------
+# Retrieve the OS temporary directory.
+#
------------------------------------------------------------------------------
+def GetOSTMPDir():
+ """Retrieve the OS temporary directory.
+ @return: The OS temporary directory.
+ """
+ result = None
+ # On Windows
+ if os.name == 'nt':
+ result = os.environ.get('tmp')
+ if result == None:
+ result = os.environ.get('temp')
+ if result == None:
+ result = "c:\\windows\\temp"
+ # On linux
+ else:
+ result = "/tmp"
+ return result
Property changes on:
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/util/misc/DirectoriesAndFilesTools.py
___________________________________________________________________
Name: svn:keywords
+ Id
Added:
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/util/misc/__init__.py
===================================================================
Property changes on:
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/util/misc/__init__.py
___________________________________________________________________
Name: svn:keywords
+ Id
Added:
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/util/misc/test_DirectoriesAndFilesTools.py
===================================================================
---
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/util/misc/test_DirectoriesAndFilesTools.py
(rev 0)
+++
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/util/misc/test_DirectoriesAndFilesTools.py
2009-03-28 18:32:24 UTC (rev 4243)
@@ -0,0 +1,173 @@
+# -*- coding: utf-8 -*-
+
+import version
+__author__ = version.author
+__date__ = version.date
+__version__ = version.version
+__licence__ = version.licence
+del version
+
+# Copyleft (C) 2008 C2ME Sa
+# Remi Jocaille <[email protected]>
+# Distributed under the terms of the GNU General Public License
+# http://www.gnu.org/copyleft/gpl.html
+
+import unittest
+import os
+
+import DirectoriesAndFilesTools
+
+#
==============================================================================
+# Public class
+#
==============================================================================
+
+#
------------------------------------------------------------------------------
+# A test class for DirectoriesAndFilesTools module.
+#
------------------------------------------------------------------------------
+class testDirectoriesAndFilesTools(unittest.TestCase):
+ """A test class for DirectoriesAndFilesTools module.
+ """
+
+ #
--------------------------------------------------------------------------
+ # Initialization.
+ #
--------------------------------------------------------------------------
+ def setUp(self):
+ """Initialization.
+ """
+ self.tmpDirectory = ""
+
+ #
--------------------------------------------------------------------------
+ # Test the retrieving of the temporary directory.
+ #
--------------------------------------------------------------------------
+ def test00GetOSTMPDir(self):
+ """Test the retrieving of the temporary directory.
+ """
+ # Retrieve the temporary directory of the OS.
+ self.tmpDirectory = DirectoriesAndFilesTools.GetOSTMPDir()
+ self.assertNotEqual(self.tmpDirectory, "")
+ # Check the creation of a file in the retrieved directory
+ work = True
+ try:
+ f = open(os.path.join(self.tmpDirectory, "test.tmp"), 'wb')
+ f.write("\n")
+ f.close()
+ os.remove(os.path.join(self.tmpDirectory, "test.tmp"))
+ except:
+ work = False
+ self.assertEqual(work, True)
+
+ #
--------------------------------------------------------------------------
+ # Test the creation of a new directories tree.
+ #
--------------------------------------------------------------------------
+ def test01CreateDirectoriesTree(self):
+ """Test the creation of a new directories tree.
+ """
+ # Create a directories tree
+ self.tmpDirectory = DirectoriesAndFilesTools.GetOSTMPDir()
+ extTree = os.path.join(self.tmpDirectory, 'test', 'test2', 'test3')
+ DirectoriesAndFilesTools.MKDirs(extTree)
+ # Check if the last directory exists
+ self.assertTrue(os.path.isdir(extTree))
+ # Create a file
+ try:
+ f = open(os.path.join(extTree, 'myfile.tmp'), 'wb')
+ f.close()
+ except:
+ pass
+ self.assertTrue(os.path.isfile(os.path.join(extTree, 'myfile.tmp')))
+
+ #
--------------------------------------------------------------------------
+ # Test the creation of a clean directories tree (Erase the old one).
+ #
--------------------------------------------------------------------------
+ def test02CreateDirectoriesTreeFFS(self):
+ """Test the creation of a clean directories tree (Erase the old one).
+ """
+ # Create a directories tree
+ self.tmpDirectory = DirectoriesAndFilesTools.GetOSTMPDir()
+ extTree = os.path.join(self.tmpDirectory, 'test', 'test2', 'test3')
+ DirectoriesAndFilesTools.MKDirsF(extTree)
+ # Check if the last directory exists
+ self.assertTrue(os.path.isdir(extTree))
+ # Check if the previously created file still exists
+ self.assertFalse(os.path.isfile(os.path.join(extTree, 'myfile.tmp')))
+
+ #
--------------------------------------------------------------------------
+ # Test the removing of directories and files with a name filter.
+ #
--------------------------------------------------------------------------
+ def test03RemoveDAFRecWF(self):
+ """Test the removing of directories and files with a name filter.
+ """
+ self.tmpDirectory = DirectoriesAndFilesTools.GetOSTMPDir()
+ extTree = os.path.join(self.tmpDirectory, 'test', 'test2', 'test3')
+ # Create some files
+ try:
+ f = open(os.path.join(extTree, 'myfile.tmp'), 'wb')
+ f.close()
+ f = open(os.path.join(extTree, 'myfile2.tmp'), 'wb')
+ f.close()
+ f = open(os.path.join(extTree, 'myfile.ttt'), 'wb')
+ f.close()
+ f = open(os.path.join(extTree, 'myfile.h'), 'wb')
+ f.close()
+ except:
+ pass
+ self.assertTrue(os.path.isfile(os.path.join(extTree, 'myfile.tmp')))
+ # Create a directory called '.tmp'
+ DirectoriesAndFilesTools.MKDirs(os.path.join(extTree, 'truc.tmp'))
+ self.assertTrue(os.path.isdir(os.path.join(extTree, 'truc.tmp')))
+ # Remove files and directories with 'tmp' extention
+ DirectoriesAndFilesTools.RMWithFilters(extTree, filters = ['.tmp', ])
+ self.assertFalse(os.path.isfile(os.path.join(extTree, 'myfile.tmp')))
+ self.assertFalse(os.path.isfile(os.path.join(extTree, 'myfile2.tmp')))
+ self.assertFalse(os.path.isdir(os.path.join(extTree, 'truc.tmp')))
+ self.assertTrue(os.path.isdir(extTree))
+
+ #
--------------------------------------------------------------------------
+ # Test the copying of directories tree.
+ #
--------------------------------------------------------------------------
+ def test04CopyTree(self):
+ """Test the copying of directories tree.
+ """
+ self.tmpDirectory = DirectoriesAndFilesTools.GetOSTMPDir()
+ extTree = os.path.join(self.tmpDirectory, 'test2', 'test2', 'test3')
+ DirectoriesAndFilesTools.CPDir(os.path.join(self.tmpDirectory, 'test'),
+ os.path.join(self.tmpDirectory, 'test2'))
+ self.assertTrue(os.path.isfile(os.path.join(extTree, 'myfile.ttt')))
+
+ #
--------------------------------------------------------------------------
+ # Test the removing of directories tree with files.
+ #
--------------------------------------------------------------------------
+ def test05RemoveDAFRec(self):
+ """Test the removing of directories tree with files.
+ """
+ self.tmpDirectory = DirectoriesAndFilesTools.GetOSTMPDir()
+ baseTree = os.path.join(self.tmpDirectory, 'test')
+ DirectoriesAndFilesTools.RMDirs(baseTree)
+ self.assertFalse(os.path.isdir(baseTree))
+ baseTree = os.path.join(self.tmpDirectory, 'test2')
+ DirectoriesAndFilesTools.RMDirs(baseTree)
+ self.assertFalse(os.path.isdir(baseTree))
+
+#
==============================================================================
+# Public functions
+#
==============================================================================
+
+#
------------------------------------------------------------------------------
+# Unitest suite for the module 'DirectoriesAndFilesTools'
+#
------------------------------------------------------------------------------
+def suite():
+ """Unitest suite for the module 'DirectoriesAndFilesTools'
+ """
+ print "\n" + "".join("=" * 70)
+ print "Test the 'DirectoriesAndFilesTools' Module"
+ print "".join("=" * 70) + "\n"
+
+ suite = unittest.TestSuite()
+ suite.addTest(unittest.makeSuite(testDirectoriesAndFilesTools))
+ return suite
+
+#
------------------------------------------------------------------------------
+# Main
+#
------------------------------------------------------------------------------
+if __name__ == '__main__':
+ unittest.TextTestRunner(verbosity=2).run(suite())
Property changes on:
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/util/misc/test_DirectoriesAndFilesTools.py
___________________________________________________________________
Name: svn:keywords
+ Id
Added:
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/util/misc/version.py
===================================================================
---
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/util/misc/version.py
(rev 0)
+++
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/util/misc/version.py
2009-03-28 18:32:24 UTC (rev 4243)
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+
+"""Version data for tuxisalive.lib.Util"""
+
+__author__ = "Remi Jocaille ([email protected])"
+
+# Copyleft (C) 2008 C2ME Sa
+# Remi Jocaille <[email protected]>
+# Distributed under the terms of the GNU General Public License
+# http://www.gnu.org/copyleft/gpl.html
+
+name = 'util.misc'
+version = '0.0.1'
+author = "Remi Jocaille ([email protected])"
+
+description = "Utilities libraries."
+
+licence = "GPL"
+date = "December 2008"
Property changes on:
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/util/misc/version.py
___________________________________________________________________
Name: svn:keywords
+ Id
Added:
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/version.py
===================================================================
---
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/version.py
(rev 0)
+++
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/version.py
2009-03-28 18:32:24 UTC (rev 4243)
@@ -0,0 +1,9 @@
+# Copyleft (C) 2009 C2ME Sa
+# Remi Jocaille <[email protected]>
+# Distributed under the terms of the GNU General Public License
+# http://www.gnu.org/copyleft/gpl.html
+
+version = '0.0.1'
+author = "Remi Jocaille ([email protected])"
+licence = "GPL"
+date = "2009"
Property changes on:
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/builder/version.py
___________________________________________________________________
Name: svn:keywords
+ Id
Added: software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/dos.bat
===================================================================
--- software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/dos.bat
(rev 0)
+++ software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/dos.bat
2009-03-28 18:32:24 UTC (rev 4243)
@@ -0,0 +1 @@
+python build.py
\ No newline at end of file
Property changes on:
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/dos.bat
___________________________________________________________________
Name: svn:keywords
+ Id
Added:
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/executables/WebRadioList.py
===================================================================
---
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/executables/WebRadioList.py
(rev 0)
+++
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/executables/WebRadioList.py
2009-03-28 18:32:24 UTC (rev 4243)
@@ -0,0 +1,13 @@
+# 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",
+ "BBC2" : "http://bbc.co.uk/radio/listen/live/r2.ram",
+ "RFM" : "mms://viplagardere.yacast.net/encoderrfm",
+ "Click'And'rock" :
"http://240plan.ovh.net/~clicknro/_www/www/dwd/player/hautdebit_wmp.wax"
+}
Property changes on:
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/executables/WebRadioList.py
___________________________________________________________________
Name: svn:keywords
+ Id
Added:
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/executables/tux-gadget-webradio.py
===================================================================
---
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/executables/tux-gadget-webradio.py
(rev 0)
+++
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/executables/tux-gadget-webradio.py
2009-03-28 18:32:24 UTC (rev 4243)
@@ -0,0 +1,120 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# -----------------------------------------------------------------------------
+# Gadget à placer dans mes alerts pour que Tux vous réveille avec une webradio
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+# -----------------------------------------------------------------------------
+# $Id$
+# -----------------------------------------------------------------------------
+
+"""
+CHANGES
+=======
+
+2009/03/11 - version 0.0.1:
+ - Initial version
+
+2009/03/12 - version 0.0.2:
+ - Add tgp_radio for select radio from the control center
+ - Add dictionary for webradio
+
+2009/03/12 - version 0.0.3:
+ - Add test for playing mms:
+
+2009/03/16 - version 0.0.4:
+ - Add a wrapper to mplayer
+ - Add compatibility with Windows
+ - Add SimpleGadget module
+ - Add a pid file for mplayer sub-process
+
+2009/03/28 - version 0.0.5:
+ - Renamed the gadget to tuxdroid-gadget-webradio
+ - Now uses the mplayer module from the Tux Droid server
+
+TODO LIST
+=========
+- Add more webradio
+- Fip mms
+- BFM mms
+"""
+
+__author__ = "Eric Lescaudron AKA Gwadavel"
+__appname__ = "tux web radio"
+__version__ = "0.0.5"
+__date__ = "2009/03/28"
+__license__ = "GPL"
+
+import os
+import time
+import sys
+
+sys.path.append(os.environ['TUXDROID_SERVER_PYTHON_UTIL'])
+
+from util.SimpleGadget.SimpleGadgetConfiguration import
SimpleGadgetConfiguration
+from util.SimpleGadget.SimpleGadget import SimpleGadget
+from util.player.mplayer.Mplayer import Mplayer
+from WebRadioList import WEBRADIO
+
+class Configuration(SimpleGadgetConfiguration):
+
+ def __init__(self):
+ SimpleGadgetConfiguration.__init__(self)
+ self.__radio = "France-Inter"
+
+ def getRadio(self):
+ return self.__radio
+
+ def setRadio(self, radio):
+ self.__radio = radio
+
+class WebRadioGadget(SimpleGadget):
+
+ def __init__(self):
+ SimpleGadget.__init__(self)
+ # Create a mplayer wrapper object
+ self.__player = Mplayer()
+
+ def start(self):
+ if self.getCommand() == "check":
+ self.check()
+ else:
+ self.run()
+
+ def run(self):
+ self.__doExecute()
+
+ def check(self):
+ self.__doExecute()
+
+ def __doExecute(self):
+ myRadio = self.configuration().getRadio()
+ radioUrl = myRadio
+ if myRadio in WEBRADIO.keys():
+ radioUrl = WEBRADIO[myRadio]
+ self.throwMessage("Web radio \"{0}\".", myRadio)
+ # Start mplayer
+ self.__player.start(radioUrl, True)
+
+ def onGadgetStop(self):
+ """Event on gadget stop.
+ """
+ self.__player.stop()
+
+if __name__ == "__main__":
+ gadget = WebRadioGadget()
+ gadget.boot(sys.argv[1:], Configuration())
Property changes on:
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/executables/tux-gadget-webradio.py
___________________________________________________________________
Name: svn:keywords
+ Id
Added:
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/resources/clockradio.png
===================================================================
(Binary files differ)
Property changes on:
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/resources/clockradio.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Name: svn:keywords
+ Id
Added:
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/resources/gadget.pot
===================================================================
---
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/resources/gadget.pot
(rev 0)
+++
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/resources/gadget.pot
2009-03-28 18:32:24 UTC (rev 4243)
@@ -0,0 +1,14 @@
+msgid "Clock Radio"
+msgstr ""
+
+msgid "Use tux as webradio or clock radio"
+msgstr ""
+
+msgid "Webradio"
+msgstr ""
+
+msgid "Clock Radio"
+msgstr ""
+
+msgid "Select radio"
+msgstr ""
Property changes on:
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/resources/gadget.pot
___________________________________________________________________
Name: svn:keywords
+ Id
Added:
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/resources/gadget.xml
===================================================================
---
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/resources/gadget.xml
(rev 0)
+++
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/resources/gadget.xml
2009-03-28 18:32:24 UTC (rev 4243)
@@ -0,0 +1,32 @@
+<gadget>
+ <interpreter
+ kind="python">
+ <executable>executables/tux-gadget-webradio.py</executable>
+ </interpreter>
+ <description>
+ <name>Clock Radio</name>
+ <description>Use tux as webradio</description>
+ <author>Gwadavel</author>
+ <version>0.0.5</version>
+ <iconFile>resources/clockradio.png</iconFile>
+ <executionMode>command</executionMode>
+ <uuid>8349ed52-572d-4c3f-a7b8-05c2a8aec2c6</uuid>
+ </description>
+ <parameters>
+ <parameter
+ name="radio"
+ description="Select radio"
+
type="enum(BBC2,France-Bleu-Ile-de-France,France-Culture,France-Info,France-Inter,France-Musique,Le-Mouv,RFM,RMC-Info,Click'And'rock)"
+ defaultValue="France-Inter" />
+ </parameters>
+ <commands>
+ <command
+ name="run"
+ description="Webradio"
+ daemon="true" />
+ <command
+ name="check"
+ description="Clock Radio"
+ daemon="true" />
+ </commands>
+</gadget>
Property changes on:
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/resources/gadget.xml
___________________________________________________________________
Name: svn:keywords
+ Id
Added:
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/resources/help.html
===================================================================
---
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/resources/help.html
(rev 0)
+++
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/resources/help.html
2009-03-28 18:32:24 UTC (rev 4243)
@@ -0,0 +1,6 @@
+<html>
+<body>
+<font size="2" face="Verdana, Arial, Helvetica, sans-serif">This gadget will
make Tux Droid play radio. Drag-and-drop the gadget into "My Favorites" to
enable Webradio or into "My Alerts" to enable Clock Radio. <br>
+</font>
+</body>
+</html>
Property changes on:
software_suite_v2/software/gadgets/tuxdroid-gadget-webradio/trunk/resources/help.html
___________________________________________________________________
Name: svn:keywords
+ Id
------------------------------------------------------------------------------
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn