working on status window to show mythtv backend status

This commit is contained in:
Erik Kristensen 2010-08-31 22:22:11 -04:00
parent 5da4406f09
commit ad378b5d18
4 changed files with 184 additions and 13 deletions

View File

@ -25,12 +25,13 @@ class MythBoxee:
"""
__init__ - Lets make a connection to the backend!
__init__ - Lets get things rolling
"""
def __init__(self):
self.log("def(__init__): Start =========================================================")
self.log("def(__init__): Version: " + self.version)
self.log("def(__init__): Python Version: " + str(sys.version_info))
self.log("def(__init__): MythBoxee Version: " + self.version)
self.log("def(__init__): Python Version: " + str(sys.version_info))
self.log()
self.config = mc.GetApp().GetLocalConfig()
@ -170,15 +171,21 @@ class MythBoxee:
mainItems = len(mc.GetWindow(14001).GetList(1030).GetItems())
self.recs = self.be.getRecordings()
self.banners = pickle.loads(self.config.GetValue("cache.banners"))
self.series = pickle.loads(self.config.GetValue("cache.series"))
if not cacheTime or mainItems == 0 or cacheTime <= str(time.time() - 2400):
self.log("def(GetRecordings): Cached Expired, Processing Recordings")
x=0
for recording in self.recs:
if recording.title not in self.titles:
self.titles.append(str(recording.title))
self.banners[str(recording.title)] = self.GetRecordingArtwork(str(recording.title))
self.series[str(recording.title)] = self.GetRecordingSeriesID(str(recording.title))
self.shows[str(recording.title)] = []
if recording.title not in self.banners:
self.banners[str(recording.title)] = self.GetRecordingArtwork(str(recording.title))
if recording.title not in self.series:
self.series[str(recording.title)] = self.GetRecordingSeriesID(str(recording.title))
single = [str(recording.title), str(recording.subtitle), str(recording.description), str(recording.chanid), str(recording.airdate), str(recording.starttime), str(recording.endtime), recording.getRecorded().watched, x]
self.shows[str(recording.title)].append(single)
@ -191,6 +198,7 @@ class MythBoxee:
self.config.SetValue("cache.series", pickle.dumps(self.series))
self.config.SetValue("cache.shows", pickle.dumps(self.shows))
else:
self.log("def(GetRecordings): Cache OK, Retrieving from Cache")
self.titles = pickle.loads(self.config.GetValue("cache.titles"))
self.banners = pickle.loads(self.config.GetValue("cache.banners"))
self.series = pickle.loads(self.config.GetValue("cache.series"))
@ -711,6 +719,7 @@ class MythBoxee:
SettingsInit - Init function for Settings Window
"""
def SettingsInit(self):
self.log("def(SettingsInit): Start =========================================================")
self.config.SetValue("loadingsettings", "true")
if not self.config.GetValue("dbconn"):
mc.ShowDialogOk("MythBoxee", "Welcome to MythBoxee! Looks like this is the first time you have run this app. Please fill out all the settings and you'll be on your way to using this app.")
@ -734,6 +743,39 @@ class MythBoxee:
else:
self.LoadSettings()
self.config.Reset("loadingsettings")
self.log("def(SettingsInit): End ===========================================================")
"""
StatusInit -- Function called when Status Window is opened.
This function pulls status information from the MythTV backend and displays it to the user.
Status information includes load, uptime, free space, upcoming recordings, guide data, etc ...
"""
def StatusInit(self):
self.log("def(StatusInit): Start =========================================================")
self.config.SetValue("loadingstatus", "true")
uptime = self.be.getUptime()
load = self.be.getLoad()
freespace = self.be.getFreeSpace()
guidedata = self.be.getLastGuideData()
isRecording = self.be.isRecording(1)
freespacesummary = self.be.getFreeSpaceSummary()
recorders = self.be.getRecorderList()
upcoming = self.be.getUpcomingRecordings()
self.log("def(StatusInit): Recorders: " + str(recorders))
self.log("def(StatusInit): Uptime: " + str(uptime))
self.log("def(StatusInit): Load: " + str(load))
self.log("def(StatusInit): Free Space: " + str(freespace))
self.log("def(StatusInit): Guide Data: " + str(guidedata))
self.log("def(StatusInit): Summary: " + str(freespacesummary))
self.log("def(StatusInit): Upcoming: " + str(upcoming))
self.log("def(StatusInit): Recording: " + str(isRecording))
self.config.Reset("loadingstatus")
self.log("def(StatusInit): End ===========================================================")
"""

View File

@ -24,8 +24,8 @@ mb.LoadMain()
</control>
<control type="grouplist" id="1040">
<posy>28</posy>
<posx>940</posx>
<width>334</width>
<posx>780</posx>
<width>500</width>
<itemgap>10</itemgap>
<orientation>horizontal</orientation>
<ondown>1030</ondown>
@ -45,17 +45,14 @@ mb.LoadMain()
<align>center</align>
<onclick lang="python"><![CDATA[mc.ActivateWindow(14004)]]></onclick>
</control>
<!--
780/500
<control type="button" id="1043">
<label>Send Logs</label>
<label>Status</label>
<texturefocus>bg_btn.png</texturefocus>
<texturenofocus></texturenofocus>
<height>29</height>
<align>center</align>
<onclick lang="python"><![CDATA[mb.SendLogs()]]></onclick>
<onclick lang="python"><![CDATA[mc.ActivateWindow(14003)]]></onclick>
</control>
-->
</control>
<control type="panel" id="1030">
<posx>22</posx>

View File

@ -0,0 +1,132 @@
<window type="window" id="14003">
<allowoverlay>yes</allowoverlay>
<onload lang="python"><![CDATA[
import mc
import mythboxee
mb.StatusInit()
]]></onload>
<controls>
<control type="group" id="1010">
<control type="image" id="1011">
<width>1280</width>
<height>720</height>
<texture>mb_bg.png</texture>
</control>
<control type="image" id="1012">
<posx>10</posx>
<posy>10</posy>
<width>244</width>
<height>65</height>
<texture>logo.png</texture>
</control>
</control>
<!-- BEGIN ENCODER STATUS -->
<control type="group" id="1020">
<control type="image" id="1021">
<posx>20</posx>
<posy>120</posy>
<height>255</height>
<width>610</width>
<texture>bg_box.png</texture>
</control>
<control type="label" id="1022">
<posx>30</posx>
<posy>90</posy>
<label>Encoder Status</label>
<font>font28b</font>
</control>
</control>
<!-- END ENCODE STATUS -->
<!-- BEGIN SYSTEM INFORMATION -->
<control type="group" id="1030">
<control type="image" id="1031">
<posx>650</posx>
<posy>120</posy>
<height>255</height>
<width>610</width>
<texture>bg_box.png</texture>
</control>
<control type="label" id="1032">
<posx>660</posx>
<posy>90</posy>
<label>System Information</label>
<font>font28b</font>
</control>
</control>
<!-- END SYSTEM INFORMATION -->
<!-- BEGIN SCHEDULE -->
<control type="group" id="1040">
<control type="image" id="1041">
<posx>20</posx>
<posy>460</posy>
<height>240</height>
<width>610</width>
<texture>bg_box.png</texture>
</control>
<control type="label" id="1042">
<posx>30</posx>
<posy>430</posy>
<label>Upcoming Schedule</label>
<font>font28b</font>
</control>
</control>
<!-- END SCHEDULE -->
<!-- BEGIN JOB QUEUE -->
<control type="group" id="1050">
<control type="image" id="1051">
<posx>650</posx>
<posy>460</posy>
<height>240</height>
<width>610</width>
<texture>bg_box.png</texture>
</control>
<control type="label" id="1052">
<posx>660</posx>
<posy>430</posy>
<label>Job Queue</label>
<font>font28b</font>
</control>
</control>
<!-- END JOB QUEUE -->
<!-- BEGIN LOADING OVERLAY -->
<control type="group" id="9000">
<visible>App.HasSetting(loadingstatus)</visible>
<animation effect="fade" start="0" end="100" time="150">VisibleChange</animation>
<control type="image" id="9001">
<width>1280</width>
<height>720</height>
<texture>black.png</texture>
<animation effect="fade" start="80" end="80" time="0" condition="true">Conditional</animation>
</control>
<control type="label" id="9002">
<posy>0</posy>
<posx>0</posx>
<width>1280</width>
<height>720</height>
<align>center</align>
<aligny>center</aligny>
<font>sans40b</font>
<label>LOADING...</label>
<textcolor>ffffffff</textcolor>
</control>
</control>
<!-- END LOADING OVERLAY -->
</controls>
</window>

Binary file not shown.

After

Width:  |  Height:  |  Size: 859 B