コード例 #1
0
 def openFilterByDescriptionChoice(self):
     from ServiceProvider import ServiceCenter
     from enigma import eServiceReference, iServiceInformation
     from MovieSelection import SHOW_ALL_MOVIES
     serviceHandler = ServiceCenter.getInstance()
     descr = []
     l = serviceHandler.list(self.list.root)
     while 1:
         serviceref = l.getNext()
         if not serviceref.valid():
             break
         if serviceref.flags & eServiceReference.mustDescent:
             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
     
     self.session.openWithCallback(self.filterByDescription, ChoiceBox, title=_("Select movie by description:"), list=descr, selection=selection)
コード例 #2
0
 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)
コード例 #3
0
 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)
コード例 #4
0
 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)
コード例 #5
0
 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)
コード例 #6
0
    def __init__(self, session, items, coverSize, service=None):
        Screen.__init__(self, session)
        self.skinName = SkinTools.appendResolution("AdvancedMovieSelectionDownload")
        self.onShow.append(self.selectionChanged)
        self.service = service
        self.coversize = coverSize
        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)

        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, coverSize)
        else:
            fetchingMovies.cancel = False
        self.progressTimer = eTimer()
        self.progressTimer.callback.append(self.updateProgress)
        self.progressTimer.start(250, False)
        this_session = session
        is_hidden = False
コード例 #7
0
 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)
コード例 #8
0
 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)"))
コード例 #9
0
 def __init__(self):
     self.database = MovieDatabase()
     self.isWorking = False
     self.movieConfig = MovieConfig()
     self.callback = None
     self.serviceHandler = ServiceCenter.getInstance()
     #self.full_used_detect = 0
     self.enabled = False
     self.last_update = None
コード例 #10
0
 def __init__(self):
     self.movielibrary = MovieLibrary()
     self.isWorking = False
     self.movieConfig = MovieConfig()
     self.callback = None
     self.serviceHandler = ServiceCenter.getInstance()
     #self.full_used_detect = 0
     self.enabled = False
     self.last_update = None
コード例 #11
0
 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)"))
コード例 #12
0
 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]
コード例 #13
0
 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)
コード例 #14
0
 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)
コード例 #15
0
 def insertMarker(self, l1, root):
     if len(root) > 40:
         parts = root.split("/")
         if len(parts) > 2:
             name = "/.../" + parts[-3] + "/" + parts[-2]
         else:
             name = parts[-2]
     else:
         name = root
     serviceref = eServiceReferenceMarker(root)
     serviceref.setName("[ " + name + " ]")
     info = ServiceCenter.getInstance().info(serviceref)
     mi = MovieInfo(name, serviceref, info)
     l1.insert(0, (mi, ))
コード例 #16
0
 def getCuePositions(self):
     length = 0
     last_pos = 0
     for (pts, what) in self.cut_list:
         if what == self.CUT_TYPE_OUT:
             length = pts / 90000
         if what == self.CUT_TYPE_LAST:
             last_pos = pts / 90000
     if length == 0:
         from ServiceProvider import ServiceCenter
         info = ServiceCenter.getInstance().info(self.currentService)
         if info:
             length = info.getLength(self.currentService)
     return [length, last_pos]
コード例 #17
0
 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]
コード例 #18
0
 def insertMarker(self, l1, root):
     if len(root) > 40:
         parts = root.split("/")
         if len(parts) > 2:
             name = "/.../" + parts[-3] + "/" + parts[-2]
         else: 
             name = parts[-2]
     else:
         name = root
     serviceref = eServiceReferenceMarker(root)
     serviceref.setName("[ " + name + " ]")
     info = ServiceCenter.getInstance().info(serviceref)
     mi = MovieInfo(name, serviceref, info)
     l1.insert(0, (mi,))
コード例 #19
0
 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)
コード例 #20
0
 def run(self):
     self.cancel = False
     global current, total, movie_title
     total = len(self.items)
     current = 0
     for item_list in self.items:
         if self.cancel:
             #print "Movie download canceled"
             self.finish()
             return
         service = item_list[0]
         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)
     
     self.finish()
コード例 #21
0
 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)
コード例 #22
0
 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)
コード例 #23
0
 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)
コード例 #24
0
 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)
コード例 #25
0
 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)
コード例 #26
0
 def startPlugin(self, pname, key_number):
     home = config.AdvancedMovieSelection.homepath.value
     bookmark1 = config.AdvancedMovieSelection.bookmark1path.value
     bookmark2 = config.AdvancedMovieSelection.bookmark2path.value
     bookmark3 = config.AdvancedMovieSelection.bookmark3path.value
     errorText = None
     if 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(home)
         elif pname == "Bookmark 1":
             self.gotFilename(bookmark1)
         elif pname == "Bookmark 2":
             self.gotFilename(bookmark2)
         elif pname == "Bookmark 3":
             self.gotFilename(bookmark3)
         elif pname == "Bookmark(s) on/off":
             if config.AdvancedMovieSelection.show_bookmarks.value:
                 newCaption = _("Show bookmarks")
             else:
                 newCaption = _("Hide bookmarks")
             config.AdvancedMovieSelection.show_bookmarks.value = not config.AdvancedMovieSelection.show_bookmarks.value
             self.saveconfig()
             self.reloadList()
             key_number.setText(newCaption)
         elif pname == "Show/Hide folders":
             if config.AdvancedMovieSelection.showfoldersinmovielist.value:
                 newCaption = _("Show folders")
             else:
                 newCaption = _("Hide folders")
             config.AdvancedMovieSelection.showfoldersinmovielist.value = not config.AdvancedMovieSelection.showfoldersinmovielist.value
             self.showFolders(config.AdvancedMovieSelection.showfoldersinmovielist.value)
             config.AdvancedMovieSelection.showfoldersinmovielist.save()
             self.reloadList()
             key_number.setText(newCaption)
         elif pname == "Sort":
             if config.movielist.moviesort.value == MovieList.SORT_ALPHANUMERIC:
                 newType = MovieList.SORT_DESCRIPTION
             elif config.movielist.moviesort.value == MovieList.SORT_DESCRIPTION:
                 newType = MovieList.SORT_DATE_DESC
             elif config.movielist.moviesort.value == MovieList.SORT_DATE_DESC:
                 newType = MovieList.SORT_DATE_ASC
             elif config.movielist.moviesort.value == MovieList.SORT_DATE_ASC:
                 newType = MovieList.SORT_ALPHANUMERIC
             config.movielist.moviesort.value = newType
             self.setSortType(newType)
             self.reloadList()
             key_number.setText(getPluginCaption(pname))
         elif pname == "Filter by description":
             self.openFilterByDescriptionChoice()
         elif pname == "Show Timer":
             from Screens.TimerEdit import TimerEditList
             self.session.open(TimerEditList)
         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):
                     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):
                     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):
                     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 not (service.flags):
                     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":
                 if not (service.flags):
                     from SearchTVDb import TheTVDBMain
                     self.session.open(TheTVDBMain, service)
             elif pname == "TMDb Info & D/L":
                 if not (service.flags):
                     from SearchTMDb import TMDbMain as TMDbMainsave
                     from 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):
                     perc = self.list.getMovieStatus()
                     if perc > 50:
                         self.setMovieStatus(0)
                         key_number.setText(_("Mark as seen"))
                     else:
                         self.setMovieStatus(1)
                         key_number.setText(_("Mark as unseen"))
             elif pname == "Show up to VSR-X":
                 from 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()
                 key_number.setText(_("Show up to") + ' ' + _("VSR") + '-%d' % (self.list.getAccess()))
             elif pname == "Mark as seen":
                 if not (service.flags):
                     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):
                     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)
コード例 #27
0
    def delete(filename, min_age=0):
        if min_age > 0:
            # Make sure the file/directory has a ctime that didn't
            # change for at least the intended removal minimum age
            print("check retention time", filename)
            nowSec = int(time.time())
            fCtime = os.path.getctime(filename)
            print("ctime:", str(fCtime), "now:", str(nowSec))
            if nowSec < (fCtime + min_age):
                print("skipped, too young: ", str(nowSec - fCtime), "<",
                      str(min_age))
                return

        movie_ext = ["gm", "sc", "ap", "cuts"]
        print("delete: ", filename)
        #path = os.path.split(filename)[0]
        original_name = filename.replace(TRASH_NAME, "")
        if os.path.isfile(filename):
            file_extension = os.path.splitext(original_name)[-1]
            eit = os.path.splitext(original_name)[0] + ".eit"
            jpg = os.path.splitext(original_name)[0] + ".jpg"
        else:
            file_extension = ""
            eit = original_name + ".eit"
            jpg = original_name + ".jpg"

        if file_extension == ".ts":
            movie_ext.append("meta")
        else:
            movie_ext.append("ts.meta")
        for ext in movie_ext:
            to_delete = original_name + "." + ext
            if os.path.exists(to_delete):
                print(to_delete)
                os.remove(to_delete)

        if os.path.exists(jpg):
            print(jpg)
            os.remove(jpg)

        if os.path.exists(eit):
            print(eit)
            os.remove(eit)

        if os.path.exists(filename):
            if os.path.isfile(filename):
                os.rename(filename, original_name)
                filename = original_name
                from ServiceProvider import ServiceCenter, eServiceReference
                service = eServiceReference(eServiceReference.idDVB, 0,
                                            filename)
                print("[erase file]", filename)
                serviceHandler = ServiceCenter.getInstance()
                offline = serviceHandler.offlineOperations(service)
                result = False
                if offline is not None:
                    # really delete!
                    if not offline.deleteFromDisk(0):
                        result = True

                if result == False:
                    print("Error")
            else:
                print("[erase dir]", filename)
                shutil.rmtree(filename)
コード例 #28
0
ファイル: Trashcan.py プロジェクト: Blacksens/enigma2-plugins
    def delete(filename, min_age=0):
        if min_age > 0:
            # Make sure the file/directory has a ctime that didn't
            # change for at least the intended removal minimum age
            print "check retention time", filename
            nowSec = int(time.time())
            fCtime = os.path.getctime(filename)
            print "ctime:", str(fCtime), "now:", str(nowSec)
            if nowSec < (fCtime + min_age):
                print "skipped, too young: ", str(nowSec - fCtime), "<", str(min_age)
                return

        movie_ext = ["gm", "sc", "ap", "cuts"]
        print "delete: ", filename
        #path = os.path.split(filename)[0]
        original_name = filename.replace(TRASH_NAME, "")
        if os.path.isfile(filename):
            file_extension = os.path.splitext(original_name)[-1]
            eit = os.path.splitext(original_name)[0] + ".eit"
            jpg = os.path.splitext(original_name)[0] + ".jpg"
        else:
            file_extension = ""
            eit = original_name + ".eit"
            jpg = original_name + ".jpg"

        if file_extension == ".ts":
            movie_ext.append("meta")
        else:
            movie_ext.append("ts.meta")
        for ext in movie_ext:
            to_delete = original_name + "." + ext
            if os.path.exists(to_delete):
                print to_delete
                os.remove(to_delete)
    
        if os.path.exists(jpg):
            print jpg
            os.remove(jpg)

        if os.path.exists(eit):
            print eit
            os.remove(eit)

        if os.path.exists(filename):
            if os.path.isfile(filename):
                os.rename(filename, original_name)
                filename = original_name
                from ServiceProvider import ServiceCenter, eServiceReference
                service = eServiceReference(eServiceReference.idDVB, 0, filename)
                print "[erase file]", filename
                serviceHandler = ServiceCenter.getInstance()
                offline = serviceHandler.offlineOperations(service)
                result = False
                if offline is not None:
                    # really delete!
                    if not offline.deleteFromDisk(0):
                        result = True
                
                if result == False:
                    print "Error"
            else:
                print "[erase dir]", filename
                shutil.rmtree(filename)