added cache options to settings window, updated how the change stream method works, added local stream method, however it is not fully implemented yet

This commit is contained in:
Erik Kristensen 2010-09-06 00:47:01 -04:00
parent fb67938cdc
commit 2a2d8b058f
3 changed files with 231 additions and 95 deletions

View File

@ -169,7 +169,15 @@ class MythBoxee:
cacheTime = self.config.GetValue("cache.time")
mainItems = len(mc.GetWindow(14001).GetList(1030).GetItems())
self.recs = self.be.getRecordings()
try:
self.recs = self.be.getRecordings()
except Exception, e:
if e.name:
self.log("def(GetRecordings): Exception: " + e.ename)
else:
self.log("def(GetRecordings): Exception: Unknown Error")
mc.ShowDialogOk("MythBoxee", "Whoops! Something went wrong while trying to load this screen. Launch the app again it closes.")
mc.CloseWindow()
if self.config.GetValue("cache.banners"):
self.banners = pickle.loads(self.config.GetValue("cache.banners"))
@ -586,7 +594,7 @@ class MythBoxee:
mc.GetWindow(14004).GetControl(1042).SetFocus()
# Setup Stream Methods for user to choose
methods = ['XML', 'SMB']
methods = ['SMB', 'Local', 'XML']
items = mc.ListItems()
for method in methods:
item = mc.ListItem( mc.ListItem.MEDIA_UNKNOWN )
@ -597,10 +605,33 @@ class MythBoxee:
# Depending on StreamMethod Enable Options
if not streamMethod or streamMethod == "XML":
mc.GetWindow(14004).GetControl(1032).SetEnabled(False)
mc.GetWindow(14004).GetControl(1033).SetEnabled(False)
mc.GetWindow(14004).GetControl(1034).SetEnabled(False)
else:
self.log("def(LoadSettings): --")
## Hide the SMB Settings
mc.GetWindow(14004).GetControl(1070).SetEnabled(False)
mc.GetWindow(14004).GetControl(1070).SetVisible(False)
mc.GetWindow(14004).GetControl(1030).SetEnabled(False)
mc.GetWindow(14004).GetControl(1030).SetVisible(False)
## Hide the Local Settings
mc.GetWindow(14004).GetControl(1080).SetEnabled(False)
mc.GetWindow(14004).GetControl(1080).SetVisible(False)
mc.GetWindow(14004).GetControl(1083).SetEnabled(False)
mc.GetWindow(14004).GetControl(1083).SetVisible(False)
elif streamMethod == "SMB":
self.log("def(LoadSettings): --")
## Show the SMB Settings
mc.GetWindow(14004).GetControl(1070).SetEnabled(True)
mc.GetWindow(14004).GetControl(1070).SetVisible(True)
mc.GetWindow(14004).GetControl(1030).SetEnabled(True)
mc.GetWindow(14004).GetControl(1030).SetVisible(True)
## Hide the Local Settings
mc.GetWindow(14004).GetControl(1080).SetEnabled(False)
mc.GetWindow(14004).GetControl(1080).SetVisible(False)
mc.GetWindow(14004).GetControl(1083).SetEnabled(False)
mc.GetWindow(14004).GetControl(1083).SetVisible(False)
if not self.config.GetValue("smb.username"):
self.config.SetValue("smb.username", "guest")
if not self.config.GetValue("smb.password"):
@ -610,15 +641,23 @@ class MythBoxee:
self.log("def(LoadSettings): smb.username: " + self.config.GetValue("smb.username"))
self.log("def(LoadSettings): smb.password: " + self.config.GetValue("smb.password"))
## Since the Stream Method is SMB enable controls for setting info
mc.GetWindow(14004).GetControl(1032).SetEnabled(True)
mc.GetWindow(14004).GetControl(1033).SetEnabled(True)
mc.GetWindow(14004).GetControl(1034).SetEnabled(True)
## Update the fields with current SMB settings.
mc.GetWindow(14004).GetEdit(1032).SetText(self.config.GetValue("smb.share"))
mc.GetWindow(14004).GetEdit(1033).SetText(self.config.GetValue("smb.username"))
mc.GetWindow(14004).GetEdit(1034).SetText(self.config.GetValue("smb.password"))
elif streamMethod == "Local":
self.log("def(LoadSettings): --")
## Hide the SMB Settings
mc.GetWindow(14004).GetControl(1070).SetEnabled(False)
mc.GetWindow(14004).GetControl(1070).SetVisible(False)
mc.GetWindow(14004).GetControl(1030).SetEnabled(False)
mc.GetWindow(14004).GetControl(1030).SetVisible(False)
## Show the Local Settings
mc.GetWindow(14004).GetControl(1080).SetEnabled(True)
mc.GetWindow(14004).GetControl(1080).SetVisible(True)
mc.GetWindow(14004).GetControl(1083).SetEnabled(True)
mc.GetWindow(14004).GetControl(1083).SetVisible(True)
self.log("def(LoadSettings): End ===========================================================")
@ -637,13 +676,43 @@ class MythBoxee:
## Disabled some UI pieces depending on stream method
if not streamMethod or streamMethod == "XML":
mc.GetWindow(14004).GetControl(1032).SetEnabled(False)
mc.GetWindow(14004).GetControl(1033).SetEnabled(False)
mc.GetWindow(14004).GetControl(1034).SetEnabled(False)
else:
mc.GetWindow(14004).GetControl(1032).SetEnabled(True)
mc.GetWindow(14004).GetControl(1033).SetEnabled(True)
mc.GetWindow(14004).GetControl(1034).SetEnabled(True)
## Hide the SMB Settings
mc.GetWindow(14004).GetControl(1070).SetEnabled(False)
mc.GetWindow(14004).GetControl(1070).SetVisible(False)
mc.GetWindow(14004).GetControl(1030).SetEnabled(False)
mc.GetWindow(14004).GetControl(1030).SetVisible(False)
## Hide the Local Settings
mc.GetWindow(14004).GetControl(1080).SetEnabled(False)
mc.GetWindow(14004).GetControl(1080).SetVisible(False)
mc.GetWindow(14004).GetControl(1083).SetEnabled(False)
mc.GetWindow(14004).GetControl(1083).SetVisible(False)
elif streamMethod == "SMB":
## Show the SMB Settings
mc.GetWindow(14004).GetControl(1070).SetEnabled(True)
mc.GetWindow(14004).GetControl(1070).SetVisible(True)
mc.GetWindow(14004).GetControl(1030).SetEnabled(True)
mc.GetWindow(14004).GetControl(1030).SetVisible(True)
## Hide the Local Settings
mc.GetWindow(14004).GetControl(1080).SetEnabled(False)
mc.GetWindow(14004).GetControl(1080).SetVisible(False)
mc.GetWindow(14004).GetControl(1083).SetEnabled(False)
mc.GetWindow(14004).GetControl(1083).SetVisible(False)
elif streamMethod == "Local":
## Hide the SMB Settings
mc.GetWindow(14004).GetControl(1070).SetEnabled(False)
mc.GetWindow(14004).GetControl(1070).SetVisible(False)
mc.GetWindow(14004).GetControl(1030).SetEnabled(False)
mc.GetWindow(14004).GetControl(1030).SetVisible(False)
## Show the Local Settings
mc.GetWindow(14004).GetControl(1080).SetEnabled(True)
mc.GetWindow(14004).GetControl(1080).SetVisible(True)
mc.GetWindow(14004).GetControl(1083).SetEnabled(True)
mc.GetWindow(14004).GetControl(1083).SetVisible(True)
## Save the Stream Method
self.config.SetValue("StreamMethod", streamMethod)
@ -771,24 +840,42 @@ class MythBoxee:
recorders = self.be.getRecorderList()
upcoming = self.be.getUpcomingRecordings()
except Exception, e:
self.log("def(StatusInit): Exception: " + e.message)
self.log("def(StatusInit): Exception: " + e.ename)
mc.ShowDialogOk("MythBoxee", "Whoops! Something went wrong while trying to load this screen. Try again.")
self.config.Reset("loadingstatus")
mc.CloseWindow()
free_txt = "Storage:\n"
for free in freespace:
free_txt = free_txt + " " + str(free.path) + " (" + "Total: " + str(free.totalspace) + ", Free: " + str(free.freespace) + ", Used: " + str(free.usedspace) + ")\n"
guide_txt = "There is guide data until " + str(guidedata) + ".\n"
load_txt = "Load: " + str(load)
uptime_txt = "Uptime: " + str(uptime)
sys_info = load_txt + "\n\n" + uptime_txt + "\n\n" + free_txt + "\n" + guide_txt
if isRecording == True:
is_recording_txt = "is recording"
try:
currentRecording = self.be.getCurrentRecording(1)
except Exception, e:
self.log("def(StatusInit): Failed to get Current Recording Information")
is_recording_txt = "is recording on channel " + str(currentRecording.callsign) + " (" + str(currentRecording.channum) + ")"
itemList = mc.ListItems()
item = mc.ListItem( mc.ListItem.MEDIA_UNKNOWN )
item.SetThumbnail(self.banners[str(currentRecording.title)])
itemList.append(item)
mc.GetWindow(14003).GetList(1025).SetItems(itemList)
mc.GetWindow(14003).GetLabel(1026).SetLabel(str(currentRecording.title) + ": " + str(currentRecording.subtitle))
else:
is_recording_txt = "is not recording"
mc.GetWindow(14003).GetLabel(1023).SetLabel("Encoder " + str(recorders[0]) + " " + is_recording_txt + ".")
#mc.GetWindow(14003).GetLabel(1033).SetLabel()
mc.GetWindow(14003).GetLabel(1033).SetLabel(sys_info)
text = None
for program in upcoming:
text = text + str(program.title) + "\n"
mc.GetWindow(14003).GetEdit(1043).SetText(text)
self.log("def(StatusInit): Recorders: " + str(recorders))
self.log("def(StatusInit): Uptime: " + str(uptime))

View File

@ -21,14 +21,14 @@ mb.SettingsInit()
<control type="group" id="1040">
<control type="label" id="1041">
<posx>820</posx>
<posy>150</posy>
<posy>60</posy>
<width>250</width>
<label>Backend Information</label>
<font>font23</font>
</control>
<control type="edit" id="1042">
<posx>820</posx>
<posy>175</posy>
<posy>85</posy>
<width>300</width>
<label>Hostname/IP:</label>
<align>left</align>
@ -37,7 +37,7 @@ mb.SettingsInit()
</control>
<control type="edit" id="1043">
<posx>820</posx>
<posy>205</posy>
<posy>115</posy>
<width>300</width>
<label>Username:</label>
<align>left</align>
@ -47,7 +47,7 @@ mb.SettingsInit()
</control>
<control type="edit" id="1044">
<posx>820</posx>
<posy>235</posy>
<posy>145</posy>
<width>300</width>
<align>left</align>
<label>Password:</label>
@ -58,7 +58,7 @@ mb.SettingsInit()
</control>
<control type="edit" id="1045">
<posx>820</posx>
<posy>265</posy>
<posy>175</posy>
<width>300</width>
<align>left</align>
<label>Database:</label>
@ -71,11 +71,11 @@ mb.SettingsInit()
<control type="grouplist" id="1046">
<posx>820</posx>
<posy>295</posy>
<posy>210</posy>
<width>300</width>
<itemgap>0</itemgap>
<orientation>horizontal</orientation>
<ondown>1022</ondown>
<ondown>1052</ondown>
<control type="button" id="1047">
<label>Test Connection</label>
<texturefocus>bg_btn.png</texturefocus>
@ -100,12 +100,37 @@ mb.SettingsInit()
<!-- END: BACKEND INFORMATION -->
<!-- START: CACHE SETTINGS -->
<control type="group" id="1050">
<control type="label" id="1051">
<posx>820</posx>
<posy>260</posy>
<width>250</width>
<align>left</align>
<label>Cache Settings</label>
<font>font23</font>
</control>
<control type="edit" id="1052">
<posx>820</posx>
<posy>295</posy>
<width>300</width>
<label>Cache Length (min):</label>
<align>left</align>
<font>font18</font>
<onup>1045</onup>
<ondown>1022</ondown>
</control>
</control>
<!-- END: CACHE SETTINGS -->
<!-- START: STREAM METHOD -->
<control type="group" id="1020">
<control type="label" id="1021">
<posx>820</posx>
<posy>360</posy>
<posy>460</posy>
<width>250</width>
<align>left</align>
<label>Stream Method</label>
@ -113,19 +138,18 @@ mb.SettingsInit()
</control>
<control type="list" id="1022">
<posx>830</posx>
<posy>395</posy>
<width>164</width>
<posy>495</posy>
<width>225</width>
<height>100</height>
<onup>1044</onup>
<onup>1052</onup>
<ondown>1032</ondown>
<itemlayout width="164" height="27">
<orientation>horizontal</orientation>
<itemlayout width="75" height="27">
<control type="label">
<description>title</description>
<posx>9</posx>
<posy>0</posy>
<width>146</width>
<height>25</height>
<align>left</align>
<align>center</align>
<aligny>top</aligny>
<info>ListItem.Label</info>
<font>font18</font>
@ -133,14 +157,12 @@ mb.SettingsInit()
<selectedcolor>FFFFFFFF</selectedcolor>
</control>
</itemlayout>
<focusedlayout width="164" height="27">
<focusedlayout width="75" height="27">
<control type="label">
<description>title</description>
<posx>9</posx>
<posy>0</posy>
<width>146</width>
<height>25</height>
<align>left</align>
<align>center</align>
<aligny>top</aligny>
<info>ListItem.Label</info>
<font>font18</font>
@ -153,9 +175,7 @@ mb.SettingsInit()
<description>title</description>
<posx>9</posx>
<posy>0</posy>
<width>146</width>
<height>25</height>
<align>left</align>
<align>center</align>
<aligny>top</aligny>
<info>ListItem.Label</info>
<font>font18</font>
@ -176,15 +196,15 @@ mb.SettingsInit()
<control type="group" id="1030">
<control type="label" id="1031">
<posx>820</posx>
<posy>480</posy>
<posy>550</posy>
<width>250</width>
<align>left</align>
<label>SMB Share</label>
<label>SMB Settings</label>
<font>font23</font>
</control>
<control type="edit" id="1032">
<posx>820</posx>
<posy>505</posy>
<posy>575</posy>
<width>300</width>
<label>Share:</label>
<align>left</align>
@ -194,7 +214,7 @@ mb.SettingsInit()
</control>
<control type="edit" id="1033">
<posx>820</posx>
<posy>535</posy>
<posy>605</posy>
<width>300</width>
<label>Username:</label>
<align>left</align>
@ -204,7 +224,7 @@ mb.SettingsInit()
</control>
<control type="edit" id="1034">
<posx>820</posx>
<posy>565</posy>
<posy>635</posy>
<width>300</width>
<label>Password:</label>
<align>left</align>
@ -217,11 +237,12 @@ mb.SettingsInit()
<control type="grouplist" id="1070">
<posx>895</posx>
<posy>600</posy>
<posy>670</posy>
<width>300</width>
<itemgap>0</itemgap>
<orientation>horizontal</orientation>
<onup>1034</onup>
<ondown>1082</ondown>
<control type="button" id="1071">
<label>Save SMB Settings</label>
<texturefocus>bg_btn.png</texturefocus>
@ -236,53 +257,51 @@ mb.SettingsInit()
<!-- END: SMB SETTINGS -->
<!-- START: CACHE SETTINGS -->
<!--
<control type="group" id="1050">
<control type="label" id="1051">
<!-- START: LOCAL SETTINGS -->
<control type="group" id="1080">
<control type="label" id="1081">
<posx>820</posx>
<posy>560</posy>
<posy>550</posy>
<width>250</width>
<align>left</align>
<label>Cache Settings</label>
<label>Local Settings</label>
<font>font23</font>
</control>
<control type="togglebutton" id="1052">
<control type="edit" id="1082">
<posx>820</posx>
<posy>565</posy>
<posy>575</posy>
<width>300</width>
<label>Share:</label>
<label>Path:</label>
<align>left</align>
<font>font18</font>
<onup>1022</onup>
<ondown>1033</ondown>
<ontextchange lang="python"><![CDATA[mb.SaveCacheSettings()]]></ontextchange>
</control>
<control type="edit" id="1053">
<posx>820</posx>
<posy>590</posy>
<width>300</width>
<label>Username:</label>
<align>left</align>
<font>font18</font>
<onup>1032</onup>
<ondown>1034</ondown>
<ontextchange lang="python"><![CDATA[mb.SaveCacheSettings()]]></ontextchange>
</control>
<control type="edit" id="1054">
<posx>820</posx>
<posy>615</posy>
<width>300</width>
<label>Password:</label>
<align>left</align>
<font>font18</font>
<password>true</password>
<onup>1033</onup>
<ontextchange lang="python"><![CDATA[mb.SaveCacheSettings()]]></ontextchange>
<onup>1070</onup>
<ondown>1084</ondown>
</control>
</control>
-->
<!-- END: CACHE SETTINGS -->
<control type="grouplist" id="1083">
<posx>895</posx>
<posy>605</posy>
<width>300</width>
<itemgap>0</itemgap>
<orientation>horizontal</orientation>
<onup>1082</onup>
<control type="button" id="1084">
<label>Save Local Settings</label>
<texturefocus>bg_btn.png</texturefocus>
<texturenofocus></texturenofocus>
<font>font14</font>
<height>30</height>
<align>center</align>
<aligny>center</aligny>
<onclick lang="python"><![CDATA[mb.SaveLocalSettings()]]></onclick>
</control>
</control>
<!-- END: LOCAL SETTINGS -->
<!-- START: LOADING SCREEN -->
<control type="group" id="9000">
<visible>App.HasSetting(loadingsettings)</visible>
@ -305,6 +324,8 @@ mb.SettingsInit()
<textcolor>ffffffff</textcolor>
</control>
</control>
<!-- END: LOADING SCREEN -->
</controls>
</window>

View File

@ -28,7 +28,7 @@ mb.StatusInit()
<control type="image" id="1021">
<posx>20</posx>
<posy>120</posy>
<height>255</height>
<height>185</height>
<width>610</width>
<texture>bg_box.png</texture>
</control>
@ -44,6 +44,31 @@ mb.StatusInit()
<label>Loading Encoder Status ...</label>
<font>font18</font>
</control>
<control type="label" id="1026">
<posx>45</posx>
<posy>175</posy>
<font>font18</font>
</control>
<control type="image" id="1024">
<posx>45</posx>
<posy>200</posy>
<width>560</width>
<height>85</height>
<aspectratio>scale</aspectratio>
<bordersize>3</bordersize>
<bordertexture>mb_thumb_bg.png</bordertexture>
<texture>$INFO[Container(1025).ListItem.Thumb]</texture>
</control>
<control type="list" id="1025">
<posx>1</posx>
<posy>1</posy>
<width>1</width>
<height>1</height>
<itemlayout width="1" height="1">
</itemlayout>
<focusedlayout width="1" height="1">
</focusedlayout>
</control>
</control>
<!-- END ENCODE STATUS -->
@ -54,7 +79,7 @@ mb.StatusInit()
<control type="image" id="1031">
<posx>650</posx>
<posy>120</posy>
<height>255</height>
<height>245</height>
<width>610</width>
<texture>bg_box.png</texture>
</control>
@ -67,8 +92,11 @@ mb.StatusInit()
<control type="label" id="1033">
<posx>675</posx>
<posy>135</posy>
<height>225</height>
<width>580</width>
<valign>top</valign>
<label>Loading System Information ...</label>
<font>font18</font>
<font>font16</font>
</control>
</control>
@ -81,7 +109,7 @@ mb.StatusInit()
<posx>20</posx>
<posy>460</posy>
<height>240</height>
<width>610</width>
<width>1240</width>
<texture>bg_box.png</texture>
</control>
<control type="label" id="1042">
@ -117,7 +145,7 @@ mb.StatusInit()
<!-- END SCHEDULE -->
<!-- BEGIN JOB QUEUE -->
<!--
<control type="group" id="1050">
<control type="image" id="1051">
<posx>650</posx>
@ -133,7 +161,7 @@ mb.StatusInit()
<font>font28b</font>
</control>
</control>
-->
<!-- END JOB QUEUE -->
<!-- BEGIN LOADING OVERLAY -->