-from __init__ import _
from MyTubeService import GoogleSuggestions
from Screens.Screen import Screen
from Screens.LocationBox import MovieLocationBox
from Components.Sources.List import List
from Components.Pixmap import Pixmap
from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaTest
-from enigma import eListboxPythonMultiContent, RT_HALIGN_LEFT, RT_HALIGN_RIGHT, gFont, eListbox,ePoint
+from Components.Task import Task, Job, job_manager
+from enigma import eListboxPythonMultiContent, RT_HALIGN_LEFT, RT_HALIGN_RIGHT, gFont, eListbox,ePoint,eTimer
from Components.Task import job_manager
from Tools.Directories import pathExists, fileExists, resolveFilename, SCOPE_HDD
from threading import Thread
self.threaded = threaded
self.suggestionsListActivated = False
-
def propagateSuggestions(self, suggestionsList):
if self.suggestionsWindow:
self.suggestionsWindow.update(suggestionsList)
-
def getSuggestions(self):
if self.suggestionsThread is not None:
self.suggestionsThread.getSuggestions(self.value)
else:
self.suggestions.getSuggestions(self.value)
-
def handleKey(self, key):
if not self.suggestionsListActivated:
ConfigText.handleKey(self, key)
if key in [KEY_DELETE, KEY_BACKSPACE, KEY_ASCII, KEY_TIMEOUT]:
self.getSuggestions()
-
def onSelect(self, session):
if self.threaded:
+ if self.suggestionsThread is not None:
+ self.suggestionsThread.stop()
self.suggestionsThread = ConfigTextWithGoogleSuggestions.SuggestionsThread(self.suggestions)
self.suggestionsThread.start()
else:
self.suggestionsWindow.hide()
self.suggestions.getSuggestions(self.value)
-
def onDeselect(self, session):
if self.suggestionsThread is not None:
self.suggestionsThread.stop()
session.deleteDialog(self.suggestionsWindow)
self.suggestionsWindow = None
-
def suggestionListUp(self):
- self.value = self.suggestionsWindow.up()
-
+ if self.suggestionsWindow.getlistlenght() > 0:
+ self.value = self.suggestionsWindow.up()
def suggestionListDown(self):
- self.value = self.suggestionsWindow.down()
-
+ if self.suggestionsWindow.getlistlenght() > 0:
+ self.value = self.suggestionsWindow.down()
def suggestionListPageDown(self):
- self.value = self.suggestionsWindow.pageDown()
-
+ if self.suggestionsWindow.getlistlenght() > 0:
+ self.value = self.suggestionsWindow.pageDown()
def suggestionListPageUp(self):
- self.value = self.suggestionsWindow.pageUp()
-
+ if self.suggestionsWindow.getlistlenght() > 0:
+ self.value = self.suggestionsWindow.pageUp()
def activateSuggestionList(self):
ret = False
self.tmpValue = self.value
self.value = self.suggestionsWindow.activate()
self.allmarked = False
- #self.marked_pos = -1
self.suggestionsListActivated = True
ret = True
return ret
-
def deactivateSuggestionList(self):
ret = False
if self.suggestionsWindow is not None:
ret = True
return ret
-
def cancelSuggestionList(self):
self.value = self.tmpValue
return self.deactivateSuggestionList()
], None)
config.plugins.mytube.search.sortOrder = ConfigSelection(
[
- ("ascending", _("Ascanding")),
+ ("ascending", _("Ascending")),
("descending", _("Descending"))
], "ascending")
config.plugins.mytube.general = ConfigSubsection()
config.plugins.mytube.general.showHelpOnOpen = ConfigYesNo(default = True)
+config.plugins.mytube.general.loadFeedOnOpen = ConfigYesNo(default = True)
config.plugins.mytube.general.startFeed = ConfigSelection(
[
- ("top_rated", _("Top rated")),
- ("top_favorites", _("Top favorites")),
+ ("hd", _("HD videos")),
("most_viewed", _("Most viewed")),
- ("most_popular", _("Most popular")),
- ("most_recent", _("Most recent")),
+ ("top_rated", _("Top rated")),
+ ("recently_featured", _("Recently featured")),
("most_discussed", _("Most discussed")),
- ("top_favorites", _("Most linked")),
- ("most_linked", _("Most responded"))
- ], "most_popular")
+ ("top_favorites", _("Top favorites")),
+ ("most_linked", _("Most linked")),
+ ("most_responded", _("Most responded")),
+ ("most_recent", _("Most recent"))
+ ], "most_viewed")
config.plugins.mytube.general.on_movie_stop = ConfigSelection(default = "ask", choices = [
- ("ask", _("Ask user")), ("quit", _("Return to movie list")), ("playnext", _("Play next video")) ])
+ ("ask", _("Ask user")), ("quit", _("Return to movie list")), ("playnext", _("Play next video")), ("playagain", _("Play video again")) ])
+
+config.plugins.mytube.general.on_exit = ConfigSelection(default = "ask", choices = [
+ ("ask", _("Ask user")), ("quit", _("Return to movie list"))])
default = resolveFilename(SCOPE_HDD)
if default not in tmp:
tmp.append(default)
config.plugins.mytube.general.videodir = ConfigSelection(default = default, choices = tmp)
-#config.plugins.mytube.general.history = ConfigSelection(choices = [])
config.plugins.mytube.general.history = ConfigText(default="")
-
+config.plugins.mytube.general.clearHistoryOnClose = ConfigYesNo(default = False)
#config.plugins.mytube.general.useHTTPProxy = ConfigYesNo(default = False)
#config.plugins.mytube.general.ProxyIP = ConfigIP(default=[0,0,0,0])
else:
self.hide()
+ def getlistlenght(self):
+ return len(self.list)
+
def up(self):
print "up"
- self["suggestionslist"].selectPrevious()
- return self.getSelection()
+ if self.list and len(self.list) > 0:
+ self["suggestionslist"].selectPrevious()
+ return self.getSelection()
def down(self):
print "down"
- self["suggestionslist"].selectNext()
- return self.getSelection()
+ if self.list and len(self.list) > 0:
+ self["suggestionslist"].selectNext()
+ return self.getSelection()
def pageUp(self):
print "up"
- self["suggestionslist"].selectPrevious()
- return self.getSelection()
+ if self.list and len(self.list) > 0:
+ self["suggestionslist"].selectPrevious()
+ return self.getSelection()
def pageDown(self):
print "down"
- self["suggestionslist"].selectNext()
- return self.getSelection()
+ if self.list and len(self.list) > 0:
+ self["suggestionslist"].selectNext()
+ return self.getSelection()
def activate(self):
print "activate"
self["suggestionslist"].selectionEnabled(value)
-
class MyTubeSettingsScreen(Screen, ConfigListScreen):
skin = """
<screen name="MyTubeSettingsScreen" flags="wfNoBorder" position="0,0" size="720,576" title="MyTubePlayerMainScreen..." >
"right": self.keyRight,
}, -1)
-
self["key_red"] = Button(_("Close"))
self["key_green"] = Button(_("Save"))
self["title"] = Label()
self.searchContextEntries = []
self.ProxyEntry = None
+ self.loadFeedEntry = None
self.VideoDirname = None
ConfigListScreen.__init__(self, self.searchContextEntries, session)
self.createSetup()
def layoutFinished(self):
self["title"].setText(_("MyTubePlayer settings"))
-
def setWindowTitle(self):
self.setTitle(_("MyTubePlayer settings"))
self.searchContextEntries.append(getConfigListEntry(_("Search restricted content:"), config.plugins.mytube.search.racy))
self.searchContextEntries.append(getConfigListEntry(_("Search category:"), config.plugins.mytube.search.categories))
self.searchContextEntries.append(getConfigListEntry(_("Search region:"), config.plugins.mytube.search.lr))
- self.searchContextEntries.append(getConfigListEntry(_("Start with following feed:"), config.plugins.mytube.general.startFeed))
- self.searchContextEntries.append(getConfigListEntry(_("Player Stop/Exit behavior:"), config.plugins.mytube.general.on_movie_stop))
+ self.loadFeedEntry = getConfigListEntry(_("Load feed on startup:"), config.plugins.mytube.general.loadFeedOnOpen)
+ self.searchContextEntries.append(self.loadFeedEntry)
+ if config.plugins.mytube.general.loadFeedOnOpen.value:
+ self.searchContextEntries.append(getConfigListEntry(_("Start with following feed:"), config.plugins.mytube.general.startFeed))
+ self.searchContextEntries.append(getConfigListEntry(_("Videoplayer stop/exit behavior:"), config.plugins.mytube.general.on_movie_stop))
+ self.searchContextEntries.append(getConfigListEntry(_("Videobrowser exit behavior:"), config.plugins.mytube.general.on_exit))
"""self.ProxyEntry = getConfigListEntry(_("Use HTTP Proxy Server:"), config.plugins.mytube.general.useHTTPProxy)
self.searchContextEntries.append(self.ProxyEntry)
if config.plugins.mytube.general.useHTTPProxy.value:
self.VideoDirname = getConfigListEntry(_("Download location"), config.plugins.mytube.general.videodir)
if config.usage.setup_level.index >= 2: # expert+
self.searchContextEntries.append(self.VideoDirname)
+ self.searchContextEntries.append(getConfigListEntry(_("Clear history on Exit:"), config.plugins.mytube.general.clearHistoryOnClose))
self["config"].list = self.searchContextEntries
self["config"].l.setList(self.searchContextEntries)
def selectionChanged(self):
current = self["config"].getCurrent()
- #print current
def newConfig(self):
print "newConfig", self["config"].getCurrent()
- #if self["config"].getCurrent() == self.ProxyEntry:
- # self.createSetup()
+ if self["config"].getCurrent() == self.loadFeedEntry:
+ self.createSetup()
def keyOK(self):
cur = self["config"].getCurrent()
def keyRight(self):
ConfigListScreen.keyRight(self)
- #self.newConfig()
+ self.newConfig()
def keyLeft(self):
ConfigListScreen.keyLeft(self)
- #self.newConfig()
+ self.newConfig()
def keyCancel(self):
print "cancel"
config.plugins.mytube.search.racy.save()
config.plugins.mytube.search.categories.save()
config.plugins.mytube.search.lr.save()
+ config.plugins.mytube.general.loadFeedOnOpen.save()
config.plugins.mytube.general.startFeed.save()
config.plugins.mytube.general.on_movie_stop.save()
+ config.plugins.mytube.general.on_exit.save()
config.plugins.mytube.general.videodir.save()
+ config.plugins.mytube.general.clearHistoryOnClose.save()
+ if config.plugins.mytube.general.clearHistoryOnClose.value:
+ config.plugins.mytube.general.history.value = ""
+ config.plugins.mytube.general.history.save()
#config.plugins.mytube.general.useHTTPProxy.save()
#config.plugins.mytube.general.ProxyIP.save()
#config.plugins.mytube.general.ProxyPort.save()
</widget>
<ePixmap position="100,500" size="100,40" zPosition="0" pixmap="~/plugin.png" alphatest="on" transparent="1" />
<ePixmap position="220,500" zPosition="4" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
- <ePixmap position="360,500" zPosition="4" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
<widget name="key_red" position="220,500" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
- <widget name="key_green" position="360,500" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
</screen>"""
def __init__(self, session, plugin_path, tasklist):
"ok": self.keyOK,
"back": self.keyCancel,
"red": self.keyCancel,
- "green": self.keySave,
}, -1)
self["key_red"] = Button(_("Close"))
- self["key_green"] = Button(_("Save"))
self["title"] = Label()
self.onLayoutFinish.append(self.layoutFinished)
self.onShown.append(self.setWindowTitle)
+ self.onClose.append(self.__onClose)
+ self.Timer = eTimer()
+ self.Timer.callback.append(self.TimerFire)
+
+ def __onClose(self):
+ del self.Timer
def layoutFinished(self):
self["title"].setText(_("MyTubePlayer active video downloads"))
+ self.Timer.startLongTimer(2)
+
+ def TimerFire(self):
+ self.Timer.stop()
+ self.rebuildTaskList()
+
+ def rebuildTaskList(self):
+ self.tasklist = []
+ for job in job_manager.getPendingJobs():
+ self.tasklist.append((job,job.name,job.getStatustext(),int(100*job.progress/float(job.end)) ,str(100*job.progress/float(job.end)) + "%" ))
+ self['tasklist'].setList(self.tasklist)
+ self['tasklist'].updateList(self.tasklist)
+ self.Timer.startLongTimer(2)
def setWindowTitle(self):
self.setTitle(_("MyTubePlayer active video downloads"))
if current:
job = current[0]
from Screens.TaskView import JobView
- #job_manager.in_background = False
self.session.openWithCallback(self.JobViewCB, JobView, job)
def JobViewCB(self, why):
print "WHY---",why
- #job_manager.in_background = in_background
def keyCancel(self):
self.close()