def __init__(self, session, items, service=None): Screen.__init__(self, session) self.skinName = "AdvancedMovieSelectionDownload" self.onShow.append(self.selectionChanged) self.onClose.append(self.__onClose) self.service = service self["logo"] = Pixmap() self["info"] = Label() self["title"] = Label() self["poster"] = Pixmap() self["poster"].hide() self["description"] = ScrollLabel() self["key_red"] = Button(_("Cancel")) self["key_green"] = Button("") self["key_yellow"] = Button("") self["key_yellow"] = Label(_("Manual search")) if service is not None: self["key_green"] = Label(_("Save infos/cover")) else: self["key_green"] = Label(_("Background")) self["key_yellow"].hide() self["ActionsMap"] = ActionMap(["SetupActions", "ColorActions"], { "ok": self.titleSelected, "green": self.titleSelected, "red": self.__cancel, "yellow": self.editTitle, "cancel": self.__cancel, "left": self.scrollLabelPageUp, "right": self.scrollLabelPageDown }, -1) self.onShown.append(self.setWindowTitle) self.l = [] self["list"] = MenuList(self.l) self["list"].onSelectionChanged.append(self.selectionChanged) self.picload = PicLoader() self.picload.addCallback(self.paintPosterPixmap) self.movie_title = "" if self.service is not None: self.movie_title = ServiceCenter.getInstance().info(self.service).getName(self.service) self.progressTimer = xTimer() self.progressTimer.addCallback(self.refresh) self.progressTimer.start(50, True) return if service is not None: items = [(service,)] global fetchingMovies if fetchingMovies is None or (fetchingMovies is not None and fetchingMovies.finished): fetchingMovies = FetchingMovies(session, items) else: fetchingMovies.cancel = False self.progressTimer = xTimer() self.progressTimer.addCallback(self.updateProgress) self.progressTimer.start(250, False) fetchingMovies.is_hidden = False
def __init__(self, session, items, service=None): Screen.__init__(self, session) self.skinName = SkinTools.appendResolution("AdvancedMovieSelectionDownload") self.onShow.append(self.selectionChanged) self.service = service self["logo"] = Pixmap() self["info"] = Label() self["title"] = Label() self["poster"] = Pixmap() self["poster"].hide() self["description"] = ScrollLabel() self["key_red"] = Button(_("Cancel")) self["key_green"] = Button("") self["key_yellow"] = Button("") self["key_yellow"] = Label(_("Manual search")) if self.service is not None: self["key_green"] = Label(_("Save infos/cover")) else: self["key_green"] = Label(_("Background")) self["key_yellow"].hide() self["ActionsMap"] = ActionMap(["SetupActions", "ColorActions"], { "ok": self.titleSelected, "green": self.titleSelected, "red": self.__cancel, "yellow": self.editTitle, "cancel": self.__cancel, "left": self.scrollLabelPageUp, "right": self.scrollLabelPageDown }, -1) self.onShown.append(self.setWindowTitle) self.l = [] self["list"] = MenuList(self.l) self["list"].onSelectionChanged.append(self.selectionChanged) self.picload = ePicLoad() self.picload.PictureData.get().append(self.paintPosterPixmap) self.refreshTimer = eTimer() self.refreshTimer.callback.append(self.refresh) self.tmdb3 = tmdb.init_tmdb3() if self.service is not None: global movie_title movie_title = ServiceCenter.getInstance().info(self.service).getName(self.service).encode("utf-8").split(" - ")[0].strip() self.refreshTimer.start(1, True) return global fetchingMovies, this_session, is_hidden if fetchingMovies is None: fetchingMovies = FetchingMovies(items) else: fetchingMovies.cancel = False self.progressTimer = eTimer() self.progressTimer.callback.append(self.updateProgress) self.progressTimer.start(250, False) this_session = session is_hidden = False
def __updateInfo(self): serviceref = self.session.nav.getCurrentlyPlayingServiceReference() if serviceref: info = ServiceCenter.getInstance().info(serviceref) name = info.getName(serviceref) if not name or name == "": return event = info.getEvent(serviceref) desc = "" if event: desc = event.getShortDescription() if not event or name == desc or desc == "": if config.AdvancedMovieSelection.show_date_shortdesc.value and config.AdvancedMovieSelection.show_begintime.value: desc = getBeginTimeString(info, serviceref) self.summaries.showSeperator() self.summaries.updateTitle(name) self.summaries.updateShortDescription(desc) elif config.AdvancedMovieSelection.show_date_shortdesc.value and not config.AdvancedMovieSelection.show_begintime.value: desc = getDateString() self.summaries.showSeperator() self.summaries.updateTitle(name) self.summaries.updateShortDescription(desc) else: desc = "" self.summaries.hideSeperator() self.summaries.updateTitle(name) self.summaries.updateShortDescription(desc) else: self.summaries.showSeperator() self.summaries.updateTitle(name) self.summaries.updateShortDescription(desc)
def __init__(self, session, csel, service): self.csel = csel serviceHandler = ServiceCenter.getInstance() info = serviceHandler.info(service) self.sourcepath = service.getPath().rsplit('/', 1)[0] if len(self.csel.list.multiSelection) == 0: self.name = info.getName(service) self.service_list = [service] else: self.name = _("Selected movies") self.service_list = self.csel.list.multiSelection for s in self.service_list: info = serviceHandler.info(s) name = info.getName(s) s.setName(name) cbkeys = [] listpath = [] listpath.append((_("To adjusted move/copy location"), "CALLFUNC", self.selectedLocation)) cbkeys.append("blue") listpath.append((_("Directory Selection"), "CALLFUNC", self.selectDir)) cbkeys.append("yellow") listpath.append((_("Show active move/copy processes"), "CALLFUNC", self.showActive)) cbkeys.append("green") listpath.append((_("Close"), "CALLFUNC", self.close)) cbkeys.append("red") ChoiceBox.__init__(self, session, list=listpath, keys=cbkeys) self.onShown.append(self.setWindowTitle)
def run(self): try: self.cancel = False global current, total, movie_title total = len(self.items) current = 0 for item_list in self.items: try: if self.cancel: #print "Movie download cancelled" self.finish() return service = item_list[0] if not isinstance(service, eServiceReference): service = service.serviceref if service.flags & eServiceReference.mustDescent: total = total - 1 continue current = current + 1 movie_title = ServiceCenter.getInstance().info(service).getName(service).encode("utf-8").split(" - ")[0].strip() createEIT(service.getPath(), movie_title) except: printStackTrace() except: printStackTrace() finally: self.finish()
def run(self): try: self.cancel = False self.total = len(self.items) self.current = 0 for item_list in self.items: try: if self.cancel: #print "Movie download cancelled" return service = item_list[0] if not isinstance(service, eServiceReference): service = service.serviceref if service.flags & eServiceReference.mustDescent: self.total -= 1 continue self.current += 1 print service.toString() name = ServiceCenter.getInstance().info(service).getName(service) self.movie_title = name eitFromTMDb(service.getPath(), self.movie_title) except: printStackTrace() except: printStackTrace() finally: self.current = self.total self.finished = True
def openFilterByDescriptionChoice(self): from Source.ServiceProvider import ServiceCenter, detectDVDStructure, detectBludiscStructure, eServiceReferenceDvd, eServiceReferenceBludisc, eServiceReferenceListAll from Source.MovieScanner import movieScanner from enigma import iServiceInformation from MovieSelection import SHOW_ALL_MOVIES serviceHandler = ServiceCenter.getInstance() descr = [] if isinstance(self.list.root, eServiceReferenceListAll): l = movieScanner.movielibrary.getMovieList(self.list.sort_type) for movie_tuple in l: movie_info = movie_tuple[0] info = movie_info.info if not info: continue serviceref = movie_info.serviceref description = (info.getInfoString( serviceref, iServiceInformation.sDescription), ) if description[0] != "" and not description in descr: descr.append(description) else: l = serviceHandler.list(self.list.root) if not l: print("list movies for filter failed") return while True: serviceref = l.getNext() if not serviceref.valid(): break if serviceref.flags & eServiceReference.mustDescent: dvd = detectDVDStructure(serviceref.getPath()) if dvd is not None: serviceref = eServiceReferenceDvd(serviceref, True) bludisc = detectBludiscStructure(serviceref.getPath()) if bludisc is not None: serviceref = eServiceReferenceBludisc(serviceref, True) if not dvd and not bludisc: continue info = serviceHandler.info(serviceref) if not info: continue description = (info.getInfoString( serviceref, iServiceInformation.sDescription), ) if description[0] != "" and not description in descr: descr.append(description) descr = sorted(descr) descr.insert(0, (_(SHOW_ALL_MOVIES), )) current = self.list.filter_description selection = 0 for index, item in enumerate(descr): if item[0] == current: selection = index break print("open filter choice", str(selection), str(descr)) self.session.openWithCallback(self.filterByDescription, ChoiceBox, title=_("Select movie by description:"), list=descr, selection=selection)
def openInfoView(self): from AdvancedMovieSelectionEventView import EventViewSimple serviceref = self.session.nav.getCurrentlyPlayingServiceReference() info = ServiceCenter.getInstance().info(serviceref) evt = info.getEvent(serviceref) if evt: self.session.open(EventViewSimple, evt, serviceref)
def run(self): try: self.cancel = False global current, total, movie_title total = len(self.items) current = 0 for item_list in self.items: try: if self.cancel: #print "Movie download cancelled" self.finish() return service = item_list[0] if not isinstance(service, eServiceReference): service = service.serviceref if service.flags & eServiceReference.mustDescent: total = total - 1 continue current = current + 1 movie_title = ServiceCenter.getInstance().info(service).getName(service).encode("utf-8").split(" - ")[0].strip() createEIT(service.getPath(), movie_title, self.coversize) except: printStackTrace() except: printStackTrace() finally: self.finish()
def setCustomTitle(self, tags): if tags == []: self.setTitle(_("Add Tag(s) for Recordings/Timer or AutoTimer")) else: try: Title = ServiceCenter.getInstance().info(self.service).getName(self.service) self.setTitle(_("Edit Tag(s) for: %s") % (Title)) except: self.setTitle(_("Edit Tag(s)"))
def preparePlayMovie(self, service, event): if not self.execing or not self.enabled: return self.service = service if service: serviceHandler = ServiceCenter.getInstance() info = serviceHandler.info(self.service) service = ServiceReference(info.getInfoString(self.service, iServiceInformation.sServiceref)) self.video_preview_timer.start(config.AdvancedMovieSelection.video_preview_delay.value * 1000, True)
def openFilterByDescriptionChoice(self): from Source.ServiceProvider import ServiceCenter, detectDVDStructure, detectBludiscStructure, eServiceReferenceDvd, eServiceReferenceBludisc, eServiceReferenceListAll from Source.MovieScanner import movieScanner from enigma import iServiceInformation from MovieSelection import SHOW_ALL_MOVIES serviceHandler = ServiceCenter.getInstance() descr = [] if isinstance(self.list.root, eServiceReferenceListAll): l = movieScanner.database.getMovieList(self.list.sort_type) for movie_tuple in l: movie_info = movie_tuple[0] info = movie_info.info if not info: continue serviceref = movie_info.serviceref description = (info.getInfoString(serviceref, iServiceInformation.sDescription),) if description[0] != "" and not description in descr: descr.append(description) else: l = serviceHandler.list(self.list.root) if not l: print "list movies for filter failed" return while 1: serviceref = l.getNext() if not serviceref.valid(): break if serviceref.flags & eServiceReference.mustDescent: dvd = detectDVDStructure(serviceref.getPath()) if dvd is not None: serviceref = eServiceReferenceDvd(serviceref, True) bludisc = detectBludiscStructure(serviceref.getPath()) if bludisc is not None: serviceref = eServiceReferenceBludisc(serviceref, True) if not dvd and not bludisc: continue info = serviceHandler.info(serviceref) if not info: continue description = (info.getInfoString(serviceref, iServiceInformation.sDescription),) if description[0] != "" and not description in descr: descr.append(description) descr = sorted(descr) descr.insert(0, (_(SHOW_ALL_MOVIES),)) current = self.list.filter_description selection = 0 for index, item in enumerate(descr): if item[0] == current: selection = index break print "open filter choice", str(selection), str(descr) self.session.openWithCallback(self.filterByDescription, ChoiceBox, title=_("Select movie by description:"), list=descr, selection=selection)
def __init__(self, session, service): Screen.__init__(self, session) self.skinName = SkinTools.appendResolution( "AdvancedMovieSelection_Rename_") self.service = service self.movieConfig = MovieConfig() self.is_vdir = isinstance(service, eServiceReferenceVDir) self.is_dir = service.flags & eServiceReference.mustDescent serviceHandler = ServiceCenter.getInstance() info = serviceHandler.info(service) path = service.getPath() if self.is_vdir: parts = path.split("/") if len(parts) > 2: dirName = parts[-3] + "/" + parts[-2] else: dirName = parts[-2] self.original_file = dirName elif self.is_dir: self.original_file = service.getName() else: self.original_file = os.path.basename(os.path.splitext(path)[0]) if self.is_vdir: self.original_name = self.movieConfig.getRenamedName( service.getName()) else: self.original_name = info.getName(service) self.original_desc = info.getInfoString( service, iServiceInformation.sDescription) self.input_file = ConfigText(default=self.original_file, fixed_size=False, visible_width=82) self.input_title = ConfigText(default=self.original_name, fixed_size=False, visible_width=82) self.input_descr = ConfigText(default=self.original_desc, fixed_size=False, visible_width=82) self["key_green"] = StaticText(_("Save")) self["key_red"] = StaticText(_("Cancel")) self["actions"] = ActionMap(["SetupActions"], { "ok": self.keyGo, "save": self.keyGo, "cancel": self.keyCancel, }, -2) self.list = [] ConfigListScreen.__init__(self, self.list, session=self.session) self.createSetup() self["Path"] = Label( _("Location:") + ' ' + os.path.dirname(os.path.splitext(path)[0])) self["HelpWindow"] = Pixmap() self.onLayoutFinish.append(self.setCustomTitle)
def getCuePositions(self): length = 0 last_pos = 0 for (pts, what) in self.cut_list: if what == 1 == InfoBarCueSheetSupport.CUT_TYPE_OUT: length = pts / 90000 elif what == InfoBarCueSheetSupport.CUT_TYPE_LAST: last_pos = pts if length == 0: info = ServiceCenter.getInstance().info(self.currentlyPlayingService) if info: length = info.getLength(self.currentlyPlayingService) return [length, last_pos]
def __init__(self, session, service, parent): self.service = service serviceHandler = ServiceCenter.getInstance() info = serviceHandler.info(service) path = service.getPath() if path.endswith(".ts"): path = path[:-3] self.path = path tags = info.getInfoString(service, iServiceInformation.sTags) if tags: tags = tags.split(' ') else: tags = [] TagEditor.__init__(self, session, tags, parent=parent)
def __init__(self, session, service, eventName=None, shortDescription=None): TMDbMain.__init__(self, session, eventName, service) self['list'].build_update_callback.append(self.__movieUpdate) # self.skinName = ["TMDbMain"] self.automatic_show_detail = False self.searchTitle = eventName self.description = shortDescription self.selected_serie_index = 0 self.seasons = [] self.episodes = [] if service is not None: info = ServiceCenter.getInstance().info(service) self.searchTitle = info.getName(service) self.description = info.getInfoString( service, iServiceInformation.sDescription)
def __init__(self, session, service): Screen.__init__(self, session) self.skinName = SkinTools.appendResolution("AdvancedMovieSelection_Rename_") self.service = service self.movieConfig = MovieConfig() self.is_vdir = isinstance(service, eServiceReferenceVDir) self.is_dir = service.flags & eServiceReference.mustDescent serviceHandler = ServiceCenter.getInstance() info = serviceHandler.info(service) path = service.getPath() if self.is_vdir: parts = path.split("/") if len(parts) > 2: dirName = parts[-3] + "/" + parts[-2] else: dirName = parts[-2] self.original_file = dirName elif self.is_dir: self.original_file = service.getName() else: self.original_file = os.path.basename(os.path.splitext(path)[0]) if self.is_vdir: self.original_name = self.movieConfig.getRenamedName(service.getName()) else: self.original_name = info.getName(service) self.original_desc = info.getInfoString(service, iServiceInformation.sDescription) self.input_file = ConfigText(default=self.original_file, fixed_size=False, visible_width=82) self.input_title = ConfigText(default=self.original_name, fixed_size=False, visible_width=82) self.input_descr = ConfigText(default=self.original_desc, fixed_size=False, visible_width=82) self["key_green"] = StaticText(_("Save")) self["key_red"] = StaticText(_("Cancel")) self["actions"] = ActionMap(["SetupActions"], { "ok": self.keyGo, "save": self.keyGo, "cancel": self.keyCancel, }, -2) self.list = [ ] ConfigListScreen.__init__(self, self.list, session=self.session) self.createSetup() self["Path"] = Label(_("Location:") + ' ' + os.path.dirname(os.path.splitext(path)[0])) self["HelpWindow"] = Pixmap() self.onLayoutFinish.append(self.setCustomTitle)
def foreachMovieTags(self, func): serviceHandler = ServiceCenter.getInstance() for dir in config.movielist.videodirs.value: if os_path.isdir(dir): root = eServiceReference("2:0:1:0:0:0:0:0:0:0:" + dir) list = serviceHandler.list(root) if list is None: continue while 1: serviceref = list.getNext() if not serviceref.valid(): break if (serviceref.flags & eServiceReference.mustDescent): continue info = serviceHandler.info(serviceref) if info is None: continue tags = info.getInfoString(serviceref, iServiceInformation.sTags).split(' ') if not tags or tags == ['']: continue func(serviceref, tags)
def updateEventInfo(self): serviceref = self.session.nav.getCurrentlyPlayingServiceReference() if serviceref: self.loadPreview(serviceref) info = ServiceCenter.getInstance().info(serviceref) event = info.getEvent(serviceref) name = info.getName(serviceref) if not name or name == "": return desc = "" if event: desc = event.getShortDescription() if name == desc or desc == "": if config.AdvancedMovieSelection.show_date_shortdesc.value and config.AdvancedMovieSelection.show_begintime.value: desc = getBeginTimeString(info, serviceref) self["ShortDesc"].setText(desc) self["ServiceEvent"].newService(serviceref) else: desc = "" self["ShortDesc"].setText(desc) self["ServiceEvent"].newService(serviceref) self["ShortDesc"].setText(desc) self["ServiceEvent"].newService(serviceref)
def startPlugin(self, pname, key_number): print("qButtonFX:", str(pname)) # notify action map self["ColorActions"].execEnd() self["ColorActions"].execBegin() errorText = None if pname and pname != "Nothing": # all functions with no service is needed if pname == "Wastebasket": if config.AdvancedMovieSelection.use_wastebasket.value: self.session.openWithCallback(self.reloadList, Wastebasket) elif pname == "Home": self.gotFilename(config.AdvancedMovieSelection.homepath.value) elif pname == "Bookmark 1": self.gotFilename( config.AdvancedMovieSelection.bookmark1path.value) elif pname == "Bookmark 2": self.gotFilename( config.AdvancedMovieSelection.bookmark2path.value) elif pname == "Bookmark 3": self.gotFilename( config.AdvancedMovieSelection.bookmark3path.value) elif pname == "Bookmark 4": self.gotFilename( config.AdvancedMovieSelection.bookmark4path.value) elif pname == "Bookmark 5": self.gotFilename( config.AdvancedMovieSelection.bookmark5path.value) elif pname == "Bookmark 6": self.gotFilename( config.AdvancedMovieSelection.bookmark6path.value) elif pname == "Bookmark 7": self.gotFilename( config.AdvancedMovieSelection.bookmark7path.value) elif pname == "Bookmark(s) on/off": config.AdvancedMovieSelection.show_bookmarks.value = not config.AdvancedMovieSelection.show_bookmarks.value self.saveconfig() self.reloadList() newCaption = getPluginCaption(pname) self.setButtonText(key_number, newCaption) elif pname == "Library/Movielist": config.AdvancedMovieSelection.movielibrary_show.value = not config.AdvancedMovieSelection.movielibrary_show.value self.saveconfig() self.reloadList() newCaption = getPluginCaption(pname) self.setButtonText(key_number, newCaption) elif pname == "Show/Hide library": config.AdvancedMovieSelection.show_movielibrary.value = not config.AdvancedMovieSelection.show_movielibrary.value self.saveconfig() self.reloadList() newCaption = getPluginCaption(pname) self.setButtonText(key_number, newCaption) elif pname == "LIB marker on/off": config.AdvancedMovieSelection.show_videodirslocation.value = not config.AdvancedMovieSelection.show_videodirslocation.value self.saveconfig() self.reloadList() newCaption = getPluginCaption(pname) self.setButtonText(key_number, newCaption) elif pname == "Show/Hide folders": config.AdvancedMovieSelection.showfoldersinmovielist.value = not config.AdvancedMovieSelection.showfoldersinmovielist.value newCaption = getPluginCaption(pname) self.showFolders( config.AdvancedMovieSelection.showfoldersinmovielist.value) config.AdvancedMovieSelection.showfoldersinmovielist.save() self.reloadList() self.setButtonText(key_number, newCaption) elif pname == "Show/Hide seen": config.AdvancedMovieSelection.hide_seen_movies.value = not config.AdvancedMovieSelection.hide_seen_movies.value newCaption = getPluginCaption(pname) config.AdvancedMovieSelection.hide_seen_movies.save() self.reloadList() self.setButtonText(key_number, newCaption) elif pname == "Sort": newType = self.getNextSortType() self.setSortType(newType) self.reloadList() elif pname == "Filter by description": self.openFilterByDescriptionChoice() elif pname == "Show Timer": from Screens.TimerEdit import TimerEditList self.session.open(TimerEditList) elif pname == "Update library": self.rescan(True) else: # all functions that require a service service = self.getCurrent() if not service: return if pname == "Delete": self.delete() elif pname == "Filter by Tags": self.showTagsSelect() elif pname == "Tag Editor": if not service.flags & eServiceReference.mustDescent: self.movietags() else: if config.AdvancedMovieSelection.showinfo.value: self.session.open( MessageBox, _("Set tag here not possible, please select a movie for!" ), MessageBox.TYPE_INFO) elif pname == "Trailer search": if not service.flags & eServiceReference.mustDescent: self.showTrailer() else: if config.AdvancedMovieSelection.showinfo.value: self.session.open( MessageBox, _("Trailer search here not possible, please select a movie!" ), MessageBox.TYPE_INFO) elif pname == "Move-Copy": if not service.flags & eServiceReference.mustDescent: self.session.open(MovieMove, self, service) else: if config.AdvancedMovieSelection.showinfo.value: self.session.open( MessageBox, _("Move/Copy from complete directory/symlink not possible, please select a single movie!" ), MessageBox.TYPE_INFO) elif pname == "Rename": if service.type != eServiceReference.idUser: self.session.openWithCallback(self.reloadList, MovieRetitle, service) else: if config.AdvancedMovieSelection.showinfo.value: self.session.open( MessageBox, _("Rename here not possible, please select a movie!" ), MessageBox.TYPE_INFO) elif pname == "TheTVDB Info & D/L": # TODO: search? if True or not service.flags & eServiceReference.mustDescent: from SearchTVDb import TheTVDBMain self.session.open(TheTVDBMain, service) elif pname == "TMDb Info & D/L": # TODO: search? if True or not service.flags & eServiceReference.mustDescent: from SearchTMDb import TMDbMain as TMDbMainsave from Source.ServiceProvider import ServiceCenter searchTitle = ServiceCenter.getInstance().info( service).getName(service) if len(self.list.multiSelection) == 0: self.session.openWithCallback( self.updateCurrentSelection, TMDbMainsave, searchTitle, service) else: from DownloadMovies import DownloadMovies items = [] for item in self.list.multiSelection: items.append([item, 0]) self.session.openWithCallback( self.updateCurrentSelection, DownloadMovies, items) else: if config.AdvancedMovieSelection.showinfo.value: self.session.open( MessageBox, _("TMDb search here not possible, please select a movie!" ), MessageBox.TYPE_INFO) elif pname == "Toggle seen": if not service.flags & eServiceReference.mustDescent: perc = self.list.getMovieStatus() if perc > 50: self.setMovieStatus(0) self.setButtonText(key_number, _("Mark as seen")) else: self.setMovieStatus(1) self.setButtonText(key_number, _("Mark as unseen")) elif pname == "Show up to VSR-X": from Source.AccessRestriction import VSR access = "VSR-%d" % (self.list.getAccess()) for index, item in enumerate(VSR): if item == access: if len(VSR) - 1 == index: access = VSR[0] else: access = VSR[index + 1] break self.list.setAccess(int(access[4:])) self.reloadList() self.setButtonText( key_number, _("Show up to") + ' ' + _("VSR") + '-%d' % (self.list.getAccess())) elif pname == "Mark as seen": if not service.flags & eServiceReference.mustDescent: self.setMovieStatus(status=1) else: if config.AdvancedMovieSelection.showinfo.value: self.session.open( MessageBox, _("This may not be marked as seen!"), MessageBox.TYPE_INFO) elif pname == "Mark as unseen": if not service.flags & eServiceReference.mustDescent: self.setMovieStatus(status=0) else: if config.AdvancedMovieSelection.showinfo.value: self.session.open( MessageBox, _("This may not be marked as unseen!"), MessageBox.TYPE_INFO) else: plugin = None for p in plugins.getPlugins( where=[PluginDescriptor.WHERE_MOVIELIST]): if pname == str(p.name): plugin = p if plugin is not None: try: plugin(self.session, service) except: errorText = _("Unknown error!") else: errorText = _("Plugin not found!") else: errorText = _("No plugin assigned!") if errorText: self.session.open(MessageBox, errorText, MessageBox.TYPE_INFO)
def startPlugin(self, pname, key_number): print "qButtonFX:", str(pname) # notify action map self["ColorActions"].execEnd() self["ColorActions"].execBegin() errorText = None if pname and pname != "Nothing": # all functions with no service is needed if pname == "Wastebasket": if config.AdvancedMovieSelection.use_wastebasket.value: self.session.openWithCallback(self.reloadList, Wastebasket) elif pname == "Home": self.gotFilename(config.AdvancedMovieSelection.homepath.value) elif pname == "Bookmark 1": self.gotFilename(config.AdvancedMovieSelection.bookmark1path.value) elif pname == "Bookmark 2": self.gotFilename(config.AdvancedMovieSelection.bookmark2path.value) elif pname == "Bookmark 3": self.gotFilename(config.AdvancedMovieSelection.bookmark3path.value) elif pname == "Bookmark 4": self.gotFilename(config.AdvancedMovieSelection.bookmark4path.value) elif pname == "Bookmark 5": self.gotFilename(config.AdvancedMovieSelection.bookmark5path.value) elif pname == "Bookmark 6": self.gotFilename(config.AdvancedMovieSelection.bookmark6path.value) elif pname == "Bookmark 7": self.gotFilename(config.AdvancedMovieSelection.bookmark7path.value) elif pname == "Bookmark(s) on/off": config.AdvancedMovieSelection.show_bookmarks.value = not config.AdvancedMovieSelection.show_bookmarks.value self.saveconfig() self.reloadList() newCaption = getPluginCaption(pname) self.setButtonText(key_number, newCaption) elif pname == "Database/Movielist": config.AdvancedMovieSelection.db_show.value = not config.AdvancedMovieSelection.db_show.value self.saveconfig() self.reloadList() newCaption = getPluginCaption(pname) self.setButtonText(key_number, newCaption) elif pname == "Show/Hide database": config.AdvancedMovieSelection.show_database.value = not config.AdvancedMovieSelection.show_database.value self.saveconfig() self.reloadList() newCaption = getPluginCaption(pname) self.setButtonText(key_number, newCaption) elif pname == "DB marker on/off": config.AdvancedMovieSelection.show_videodirslocation.value = not config.AdvancedMovieSelection.show_videodirslocation.value self.saveconfig() self.reloadList() newCaption = getPluginCaption(pname) self.setButtonText(key_number, newCaption) elif pname == "Show/Hide folders": config.AdvancedMovieSelection.showfoldersinmovielist.value = not config.AdvancedMovieSelection.showfoldersinmovielist.value newCaption = getPluginCaption(pname) self.showFolders(config.AdvancedMovieSelection.showfoldersinmovielist.value) config.AdvancedMovieSelection.showfoldersinmovielist.save() self.reloadList() self.setButtonText(key_number, newCaption) elif pname == "Sort": newType = self.getNextSortType() self.setSortType(newType) self.reloadList() elif pname == "Filter by description": self.openFilterByDescriptionChoice() elif pname == "Show Timer": from Screens.TimerEdit import TimerEditList self.session.open(TimerEditList) elif pname == "Update database": self.rescan(True) else: # all functions that require a service service = self.getCurrent() if not service: return if pname == "Delete": self.delete() elif pname == "Filter by Tags": self.showTagsSelect() elif pname == "Tag Editor": if not service.flags & eServiceReference.mustDescent: self.movietags() else: if config.AdvancedMovieSelection.showinfo.value: self.session.open(MessageBox, _("Set tag here not possible, please select a movie for!"), MessageBox.TYPE_INFO) elif pname == "Trailer search": if not service.flags & eServiceReference.mustDescent: self.showTrailer() else: if config.AdvancedMovieSelection.showinfo.value: self.session.open(MessageBox, _("Trailer search here not possible, please select a movie!"), MessageBox.TYPE_INFO) elif pname == "Move-Copy": if not service.flags & eServiceReference.mustDescent: self.session.open(MovieMove, self, service) else: if config.AdvancedMovieSelection.showinfo.value: self.session.open(MessageBox, _("Move/Copy from complete directory/symlink not possible, please select a single movie!"), MessageBox.TYPE_INFO) elif pname == "Rename": if service.type != eServiceReference.idUser: self.session.openWithCallback(self.reloadList, MovieRetitle, service) else: if config.AdvancedMovieSelection.showinfo.value: self.session.open(MessageBox, _("Rename here not possible, please select a movie!"), MessageBox.TYPE_INFO) elif pname == "TheTVDB Info & D/L": # TODO: search? if True or not service.flags & eServiceReference.mustDescent: from SearchTVDb import TheTVDBMain self.session.open(TheTVDBMain, service) elif pname == "TMDb Info & D/L": # TODO: search? if True or not service.flags & eServiceReference.mustDescent: from SearchTMDb import TMDbMain as TMDbMainsave from Source.ServiceProvider import ServiceCenter searchTitle = ServiceCenter.getInstance().info(service).getName(service) if len(self.list.multiSelection) == 0: self.session.openWithCallback(self.updateCurrentSelection, TMDbMainsave, searchTitle, service) else: from DownloadMovies import DownloadMovies items = [] for item in self.list.multiSelection: items.append([item, 0]) self.session.openWithCallback(self.updateCurrentSelection, DownloadMovies, items, config.AdvancedMovieSelection.coversize.value) else: if config.AdvancedMovieSelection.showinfo.value: self.session.open(MessageBox, _("TMDb search here not possible, please select a movie!"), MessageBox.TYPE_INFO) elif pname == "Toggle seen": if not service.flags & eServiceReference.mustDescent: perc = self.list.getMovieStatus() if perc > 50: self.setMovieStatus(0) self.setButtonText(key_number, _("Mark as seen")) else: self.setMovieStatus(1) self.setButtonText(key_number, _("Mark as unseen")) elif pname == "Show up to VSR-X": from Source.AccessRestriction import VSR access = "VSR-%d" % (self.list.getAccess()) for index, item in enumerate(VSR): if item == access: if len(VSR) - 1 == index: access = VSR[0] else: access = VSR[index + 1] break self.list.setAccess(int(access[4:])) self.reloadList() self.setButtonText(key_number, _("Show up to") + ' ' + _("VSR") + '-%d' % (self.list.getAccess())) elif pname == "Mark as seen": if not service.flags & eServiceReference.mustDescent: self.setMovieStatus(status=1) else: if config.AdvancedMovieSelection.showinfo.value: self.session.open(MessageBox, _("This may not be marked as seen!"), MessageBox.TYPE_INFO) elif pname == "Mark as unseen": if not service.flags & eServiceReference.mustDescent: self.setMovieStatus(status=0) else: if config.AdvancedMovieSelection.showinfo.value: self.session.open(MessageBox, _("This may not be marked as unseen!"), MessageBox.TYPE_INFO) else: plugin = None for p in plugins.getPlugins(where=[PluginDescriptor.WHERE_MOVIELIST]): if pname == str(p.name): plugin = p if plugin is not None: try: plugin(self.session, service) except: errorText = _("Unknown error!") else: errorText = _("Plugin not found!") else: errorText = _("No plugin assigned!") if errorText: self.session.open(MessageBox, errorText, MessageBox.TYPE_INFO)
def __init__(self, session, service, eventName=None, shortDescription=None): Screen.__init__(self, session) InfoLoadChoice.__init__(self, self.callback_green_pressed) self.skinName = SkinTools.appendResolution('TheTVDBMain') if not pathExists(temp_dir): os.mkdir(temp_dir, 511) self['setupActions'] = ActionMap(['ColorActions', 'DirectionActions', 'SetupActions', 'OkCancelActions'], {'exit': self.cancel, 'ok': self.ok_pressed, 'red': self.red_pressed, 'green': self.green_pressed, 'blue': self.blue_pressed, 'yellow': self.yellow_pressed, 'cancel': self.cancel, 'upUp': self.pageUp, 'leftUp': self.pageUp, 'downUp': self.pageDown, 'rightUp': self.pageDown}) self.service = service self.ratingstars = -1 self.searchTitle = eventName self.description = shortDescription if service is not None: info = ServiceCenter.getInstance().info(service) self.searchTitle = info.getName(service) self.description = info.getInfoString(service, iServiceInformation.sDescription) print('[tvdb]', str(self.searchTitle), '-', str(self.description)) if self.description == self.searchTitle: self.description = '' self.picload = ePicLoad() self.picload.PictureData.get().append(self.paintPosterPixmapCB) self.picload2 = ePicLoad() self.picload2.PictureData.get().append(self.paintBannerPixmapCB) self['cover'] = Pixmap() self['banner'] = Pixmap() self['stars'] = ProgressBar() self['no_stars'] = Pixmap() self['description'] = ScrollLabel('') self['description_episode'] = ScrollLabel('') self['extended'] = Label('') self['extended_episode'] = Label('') self['status'] = Label('') self['result_txt'] = Label('') self['voted'] = Label('') self['list'] = SeriesList() self['episodes_list'] = EpisodesList() self['seperator'] = Pixmap() self['thetvdb_logo'] = Pixmap() self['button_red'] = Pixmap() self['button_green'] = Pixmap() self['button_yellow'] = Pixmap() self['button_blue'] = Pixmap() self['key_red'] = StaticText('') self['key_green'] = StaticText('') self['key_yellow'] = StaticText('') self['key_blue'] = StaticText('') self.timer = eTimer() self.timer.callback.append(self.getSeriesList) self.red_button_timer = eTimer() self.red_button_timer.callback.append(self.callback_red_pressed) self.blue_button_timer = eTimer() self.blue_button_timer.callback.append(self.callback_blue_pressed) self.onLayoutFinish.append(self.layoutFinished) self.onClose.append(self.deleteTempDir) self.view_mode = self.SHOW_SEARCH self.updateView() self.startSearch() return
def __init__(self, session, service, eventName=None, shortDescription=None): Screen.__init__(self, session) InfoLoadChoice.__init__(self, self.callback_green_pressed) self.skinName = "TheTVDBMain" if not pathExists(temp_dir): os.mkdir(temp_dir, 0777) self["setupActions"] = ActionMap( [ "ColorActions", "DirectionActions", "SetupActions", "OkCancelActions" ], { "exit": self.cancel, "ok": self.ok_pressed, "red": self.red_pressed, "green": self.green_pressed, "blue": self.blue_pressed, "yellow": self.yellow_pressed, "cancel": self.cancel, "upUp": self.pageUp, "leftUp": self.pageUp, "downUp": self.pageDown, "rightUp": self.pageDown, }) self.service = service self.ratingstars = -1 self.searchTitle = eventName self.description = shortDescription if service is not None: info = ServiceCenter.getInstance().info(service) self.searchTitle = info.getName(service) self.description = info.getInfoString( service, iServiceInformation.sDescription) print "[tvdb]", str(self.searchTitle), "-", str(self.description) if self.description == self.searchTitle: self.description = "" self.picload = PicLoader() self.picload.addCallback(self.paintPosterPixmapCB) self.picload2 = PicLoader() self.picload2.addCallback(self.paintBannerPixmapCB) self["cover"] = Pixmap() self["banner"] = Pixmap() self["stars"] = ProgressBar() self["no_stars"] = Pixmap() self["description"] = ScrollLabel("") self["description_episode"] = ScrollLabel("") self["extended"] = Label("") self["extended_episode"] = Label("") self["status"] = Label("") self["result_txt"] = Label("") self["voted"] = Label("") self["list"] = SeriesList() self["episodes_list"] = EpisodesList() self["seperator"] = Pixmap() self["thetvdb_logo"] = Pixmap() self["button_red"] = Pixmap() self["button_green"] = Pixmap() self["button_yellow"] = Pixmap() self["button_blue"] = Pixmap() self["key_red"] = StaticText("") self["key_green"] = StaticText("") self["key_yellow"] = StaticText("") self["key_blue"] = StaticText("") self.timer = xTimer() self.timer.addCallback(self.getSeriesList) self.red_button_timer = xTimer() self.red_button_timer.addCallback(self.callback_red_pressed) self.blue_button_timer = xTimer() self.blue_button_timer.addCallback(self.callback_blue_pressed) self.onLayoutFinish.append(self.layoutFinished) self.onClose.append(self.deleteTempDir) self.view_mode = self.SHOW_SEARCH self.updateView() self.startSearch()
def getEventName(self): ref = self.currentService info = ServiceCenter.getInstance().info(ref) return info and info.getName(ref)