[InternetRadio] initial commit of InternetRadio plugin (with music-visualization...
[enigma2-plugins.git] / internetradio / src / InternetRadioOledDisplay.py
1 #
2 # InternetRadio E2
3 #
4 # Coded by Dr.Best (c) 2012
5 # Support: www.dreambox-tools.info
6 # E-Mail: dr.best@dreambox-tools.info
7 #
8 # This plugin is open source but it is NOT free software.
9 #
10 # This plugin may only be distributed to and executed on hardware which
11 # is licensed by Dream Multimedia GmbH.
12 # In other words:
13 # It's NOT allowed to distribute any parts of this plugin or its source code in ANY way
14 # to hardware which is NOT licensed by Dream Multimedia GmbH.
15 # It's NOT allowed to execute this plugin and its source code or even parts of it in ANY way
16 # on hardware which is NOT licensed by Dream Multimedia GmbH.
17 #
18 # If you want to use or modify the code or parts of it,
19 # you have to keep MY license and inform me about the modifications by mail.
20 #
21
22 from Screens.Screen import Screen
23 from Components.ProgressBar import ProgressBar
24 from Components.Pixmap import Pixmap
25 from Components.Label import Label
26 from InternetRadioVisualization import InternetRadioVisualization
27
28 class InternetRadioOledDisplay(Screen, InternetRadioVisualization):
29
30                 # helper for skinning
31 #               skincontent = ""
32 #               skincontent2 = ""
33 #               count = 16
34 #               x = 0
35 #               posx = 1
36 #               skinid = 0
37 #               while True:
38 #                       skincontent += "<widget name=\"progress_%d\" zPosition=\"3\" position=\"%d,5\" size=\"5,50\" transparent=\"1\" orientation=\"orBottomToTop\" pixmap=\"/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/bar_oled-fs8.png\" />\n" % (x,posx)
39 #                       skincontent2 += "<widget name=\"top_%d\" position=\"%d,5\" zPosition=\"6\" size=\"5,2\" transparent=\"1\" pixmap=\"/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/bar_oled_top-fs8.png\" />\n" % (x,posx)
40 #                       posx += 6
41 #                       x += 1
42 #                       if x == count:
43 #                               break
44
45         skin = ("""
46                 <screen name="InternetRadioOledDisplay" position="0,0" size="96,64" id="2">
47                         <widget name="text1" position="4,0" size="96,14" font="Regular;12" halign="center" valign="center"/>
48                         <widget name="text2" position="4,14" size="96,49" font="Regular;10" halign="center" valign="center"/>
49                         <widget name="progress_0" zPosition="3" position="1,5" size="5,50" transparent="1" orientation="orBottomToTop" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/bar_oled-fs8.png" />
50                         <widget name="progress_1" zPosition="3" position="7,5" size="5,50" transparent="1" orientation="orBottomToTop" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/bar_oled-fs8.png" />
51                         <widget name="progress_2" zPosition="3" position="13,5" size="5,50" transparent="1" orientation="orBottomToTop" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/bar_oled-fs8.png" />
52                         <widget name="progress_3" zPosition="3" position="19,5" size="5,50" transparent="1" orientation="orBottomToTop" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/bar_oled-fs8.png" />
53                         <widget name="progress_4" zPosition="3" position="25,5" size="5,50" transparent="1" orientation="orBottomToTop" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/bar_oled-fs8.png" />
54                         <widget name="progress_5" zPosition="3" position="31,5" size="5,50" transparent="1" orientation="orBottomToTop" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/bar_oled-fs8.png" />
55                         <widget name="progress_6" zPosition="3" position="37,5" size="5,50" transparent="1" orientation="orBottomToTop" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/bar_oled-fs8.png" />
56                         <widget name="progress_7" zPosition="3" position="43,5" size="5,50" transparent="1" orientation="orBottomToTop" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/bar_oled-fs8.png" />
57                         <widget name="progress_8" zPosition="3" position="49,5" size="5,50" transparent="1" orientation="orBottomToTop" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/bar_oled-fs8.png" />
58                         <widget name="progress_9" zPosition="3" position="55,5" size="5,50" transparent="1" orientation="orBottomToTop" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/bar_oled-fs8.png" />
59                         <widget name="progress_10" zPosition="3" position="61,5" size="5,50" transparent="1" orientation="orBottomToTop" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/bar_oled-fs8.png" />
60                         <widget name="progress_11" zPosition="3" position="67,5" size="5,50" transparent="1" orientation="orBottomToTop" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/bar_oled-fs8.png" />
61                         <widget name="progress_12" zPosition="3" position="73,5" size="5,50" transparent="1" orientation="orBottomToTop" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/bar_oled-fs8.png" />
62                         <widget name="progress_13" zPosition="3" position="79,5" size="5,50" transparent="1" orientation="orBottomToTop" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/bar_oled-fs8.png" />
63                         <widget name="progress_14" zPosition="3" position="85,5" size="5,50" transparent="1" orientation="orBottomToTop" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/bar_oled-fs8.png" />
64                         <widget name="progress_15" zPosition="3" position="91,5" size="5,50" transparent="1" orientation="orBottomToTop" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/bar_oled-fs8.png" />
65                         <widget name="top_0" position="1,5" zPosition="6" size="5,2" transparent="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/bar_oled_top-fs8.png" />
66                         <widget name="top_1" position="7,5" zPosition="6" size="5,2" transparent="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/bar_oled_top-fs8.png" />
67                         <widget name="top_2" position="13,5" zPosition="6" size="5,2" transparent="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/bar_oled_top-fs8.png" />
68                         <widget name="top_3" position="19,5" zPosition="6" size="5,2" transparent="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/bar_oled_top-fs8.png" />
69                         <widget name="top_4" position="25,5" zPosition="6" size="5,2" transparent="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/bar_oled_top-fs8.png" />
70                         <widget name="top_5" position="31,5" zPosition="6" size="5,2" transparent="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/bar_oled_top-fs8.png" />
71                         <widget name="top_6" position="37,5" zPosition="6" size="5,2" transparent="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/bar_oled_top-fs8.png" />
72                         <widget name="top_7" position="43,5" zPosition="6" size="5,2" transparent="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/bar_oled_top-fs8.png" />
73                         <widget name="top_8" position="49,5" zPosition="6" size="5,2" transparent="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/bar_oled_top-fs8.png" />
74                         <widget name="top_9" position="55,5" zPosition="6" size="5,2" transparent="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/bar_oled_top-fs8.png" />
75                         <widget name="top_10" position="61,5" zPosition="6" size="5,2" transparent="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/bar_oled_top-fs8.png" />
76                         <widget name="top_11" position="67,5" zPosition="6" size="5,2" transparent="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/bar_oled_top-fs8.png" />
77                         <widget name="top_12" position="73,5" zPosition="6" size="5,2" transparent="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/bar_oled_top-fs8.png" />
78                         <widget name="top_13" position="79,5" zPosition="6" size="5,2" transparent="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/bar_oled_top-fs8.png" />
79                         <widget name="top_14" position="85,5" zPosition="6" size="5,2" transparent="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/bar_oled_top-fs8.png" />
80                         <widget name="top_15" position="91,5" zPosition="6" size="5,2" transparent="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/bar_oled_top-fs8.png" />
81                 </screen>""","""
82                 <screen name="InternetRadioOledDisplay" position="0,0" size="132,64" id="1">
83                         <widget name="text1" position="4,0" size="132,14" font="Regular;12" halign="center" valign="center"/>
84                         <widget name="text2" position="4,14" size="132,49" font="Regular;10" halign="center" valign="center"/>
85                         <widget name="progress_0" zPosition="3" position="2,5" size="7,50" transparent="1" orientation="orBottomToTop" />
86                         <widget name="progress_1" zPosition="3" position="10,5" size="7,50" transparent="1" orientation="orBottomToTop" />
87                         <widget name="progress_2" zPosition="3" position="18,5" size="7,50" transparent="1" orientation="orBottomToTop" />
88                         <widget name="progress_3" zPosition="3" position="26,5" size="7,50" transparent="1" orientation="orBottomToTop" />
89                         <widget name="progress_4" zPosition="3" position="34,5" size="7,50" transparent="1" orientation="orBottomToTop" />
90                         <widget name="progress_5" zPosition="3" position="42,5" size="7,50" transparent="1" orientation="orBottomToTop" />
91                         <widget name="progress_6" zPosition="3" position="50,5" size="7,50" transparent="1" orientation="orBottomToTop" />
92                         <widget name="progress_7" zPosition="3" position="58,5" size="7,50" transparent="1" orientation="orBottomToTop" />
93                         <widget name="progress_8" zPosition="3" position="66,5" size="7,50" transparent="1" orientation="orBottomToTop" />
94                         <widget name="progress_9" zPosition="3" position="74,5" size="7,50" transparent="1" orientation="orBottomToTop" />
95                         <widget name="progress_10" zPosition="3" position="82,5" size="7,50" transparent="1" orientation="orBottomToTop" />
96                         <widget name="progress_11" zPosition="3" position="90,5" size="7,50" transparent="1" orientation="orBottomToTop" />
97                         <widget name="progress_12" zPosition="3" position="98,5" size="7,50" transparent="1" orientation="orBottomToTop" />
98                         <widget name="progress_13" zPosition="3" position="106,5" size="7,50" transparent="1" orientation="orBottomToTop" />
99                         <widget name="progress_14" zPosition="3" position="114,5" size="7,50" transparent="1" orientation="orBottomToTop" />
100                         <widget name="progress_15" zPosition="3" position="122,5" size="7,50" transparent="1" orientation="orBottomToTop" />
101                         <widget name="top_0" position="2,5" zPosition="6" size="7,2" transparent="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/topvalue-lcd-fs8.png" />
102                         <widget name="top_1" position="10,5" zPosition="6" size="7,2" transparent="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/topvalue-lcd-fs8.png" />
103                         <widget name="top_2" position="18,5" zPosition="6" size="7,2" transparent="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/topvalue-lcd-fs8.png" />
104                         <widget name="top_3" position="26,5" zPosition="6" size="7,2" transparent="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/topvalue-lcd-fs8.png" />
105                         <widget name="top_4" position="34,5" zPosition="6" size="7,2" transparent="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/topvalue-lcd-fs8.png" />
106                         <widget name="top_5" position="42,5" zPosition="6" size="7,2" transparent="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/topvalue-lcd-fs8.png" />
107                         <widget name="top_6" position="50,5" zPosition="6" size="7,2" transparent="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/topvalue-lcd-fs8.png" />
108                         <widget name="top_7" position="58,5" zPosition="6" size="7,2" transparent="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/topvalue-lcd-fs8.png" />
109                         <widget name="top_8" position="66,5" zPosition="6" size="7,2" transparent="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/topvalue-lcd-fs8.png" />
110                         <widget name="top_9" position="74,5" zPosition="6" size="7,2" transparent="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/topvalue-lcd-fs8.png" />
111                         <widget name="top_10" position="82,5" zPosition="6" size="7,2" transparent="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/topvalue-lcd-fs8.png" />
112                         <widget name="top_11" position="90,5" zPosition="6" size="7,2" transparent="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/topvalue-lcd-fs8.png" />
113                         <widget name="top_12" position="98,5" zPosition="6" size="7,2" transparent="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/topvalue-lcd-fs8.png" />
114                         <widget name="top_13" position="106,5" zPosition="6" size="7,2" transparent="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/topvalue-lcd-fs8.png" />
115                         <widget name="top_14" position="114,5" zPosition="6" size="7,2" transparent="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/topvalue-lcd-fs8.png" />
116                         <widget name="top_15" position="122,5" zPosition="6" size="7,2" transparent="1" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/InternetRadio/images/topvalue-lcd-fs8.png" />
117                 </screen>""")
118
119
120         def __init__(self, session, parent):
121                 Screen.__init__(self, session)
122                 InternetRadioVisualization.__init__(self)
123                 self["text1"] =  Label(_("Internet Radio"))
124                 self["text2"] = Label("")
125                 self.onLayoutFinish.append(self.startRun)
126
127         def startRun(self):
128                 self.setProperties()
129                 self.hideControls()
130                 self["text1"].hide()
131                 self["text2"].hide()
132
133         def setText(self, text):
134                 self["text2"].setText(text)
135
136         def setLabelVisibility(self,value):
137                 if value:
138                         self["text1"].show()
139                         self["text2"].show()
140                         self.hideControls()
141                         
142                 else:
143                         self["text1"].hide()
144                         self["text2"].hide()
145
146