コード例 #1
0
 def reloadList(self, sel=None, home=False):
     if not fileExists(config.movielist.last_videodir.value):
         path = defaultMoviePath()
         config.movielist.last_videodir.value = path
         config.movielist.last_videodir.save()
         self.current_ref = eServiceReferenceTrash(path)
         self["freeDiskSpace"].path = path
     if sel is None:
         sel = self.getCurrent()
     self["list"].reload(self.current_ref)
     if config.AdvancedMovieSelection.wastelist_buildtype.value == 'listAllMoviesMedia':
         title = _("Wastebasket: %s") % ("/media")
     else:
         title = _("Wastebasket: %s") % (
             config.movielist.last_videodir.value)
     self["location"].setText(title)
     if not (sel and self["list"].moveTo(sel)):
         if home:
             self["list"].moveToIndex(0)
     self["freeDiskSpace"].update()
     count = Trashcan.getTrashCount()
     cap = Trashcan.getTrashSize()
     if cap <= 999:
         wastebasket_info = (_("Trash count: %d") %
                             (count)) + ' / ' + (_("Trash size: %d MB") %
                                                 cap)
     else:
         format_string = _("Trash size:") + " %%.%sf GB" % (
             config.AdvancedMovieSelection.filesize_digits.value)
         wastebasket_info = _("Trash count:") + (
             " %d / " % (count)) + (format_string) % (cap / 1000.0)
     if count == 0:
         self["wastetxt"].setText(_("Wastebasket is empty!"))
     else:
         self["wastetxt"].setText(wastebasket_info)
コード例 #2
0
 def reloadList(self, sel=None, home=False):
     if not fileExists(config.movielist.last_videodir.value):
         path = defaultMoviePath()
         config.movielist.last_videodir.value = path
         config.movielist.last_videodir.save()
         self.current_ref = eServiceReferenceTrash(path)
         self["freeDiskSpace"].path = path
     if sel is None:
         sel = self.getCurrent()
     self["list"].reload(self.current_ref)
     if config.AdvancedMovieSelection.wastelist_buildtype.value == 'listAllMoviesMedia':
         title = _("Wastebasket: %s") % ("/media")
     else:
         title = _("Wastebasket: %s") % (config.movielist.last_videodir.value)
     self["location"].setText(title)
     if not (sel and self["list"].moveTo(sel)):
         if home:
             self["list"].moveToIndex(0)
     self["freeDiskSpace"].update()
     count = Trashcan.getTrashCount()
     cap = Trashcan.getTrashSize()
     if cap <= 999:
         wastebasket_info = (_("Trash count: %d") % (count)) + ' / ' + (_("Trash size: %d MB") % cap)
     else:
         format_string = _("Trash size:") + " %%.%sf GB" % (config.AdvancedMovieSelection.filesize_digits.value)
         wastebasket_info = _("Trash count:") + (" %d / " % (count)) + (format_string) % (cap / 1000.0)
     if count == 0:
         self["wastetxt"].setText(_("Wastebasket is empty!"))
     else:
         self["wastetxt"].setText(wastebasket_info)
コード例 #3
0
def main():
    acceptable_rounds = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]
    new = input("Would you like instructions on how to play? (yes or no)")
    while True:
        if new == "yes":
            instructions()
            break
        elif new == "no":
            break
        else:
            print("I don't know what you mean.")
            new = input(
                "Would you like instructions on how to play? (yes or no)")
    again = "yes"
    while again == "yes":
        rounds = input("How many rounds would you like to play? (1-10)")
        while rounds not in acceptable_rounds:
            print("That as an invalid input for rounds.")
            rounds = input("How many rounds would you like to play? (1-10)")

        game = Trashcan(int(rounds))
        check = True
        while check:
            check = game.play()
        again = input("Would you like to play again? (yes or no)")
        while True:
            if again == "yes" or again == "no":
                break
            else:
                print("I don't know what you mean.")
                again = input("Would you like to play again? (yes or no)")

    print("Thank you for playing.")
コード例 #4
0
    def autoDeleteAllMovies(self):
        from Client import isAnyRecording
        remote_recordings = isAnyRecording()

        retryvalue = "%s minutes" % int(
            config.AdvancedMovieSelection.next_empty_check.value)

        if self.recTimer.isActive():
            self.recTimer.stop()

        if remote_recordings:
            print "[AdvancedMovieSelection] Start automated deleting all movies but remote recordings activ, retry at", retryvalue
            self.recTimer.start(
                config.AdvancedMovieSelection.next_empty_check.value * 60000)
            return

        if not Screens.Standby.inStandby:
            print "[AdvancedMovieSelection] Start automated deleting all movies but box not in standby, retry in", retryvalue
            self.recTimer.start(
                config.AdvancedMovieSelection.next_empty_check.value * 60000)
        else:
            recordings = self.session.nav.getRecordings()
            next_rec_time = -1
            if not recordings:
                next_rec_time = self.session.nav.RecordTimer.getNextRecordingTime(
                )
            if config.movielist.last_videodir.value == "/hdd/movie/" and recordings or (
                    next_rec_time > 0 and (next_rec_time - time()) < 360):
                print "[AdvancedMovieSelection] Start automated deleting all movies but recordings activ, retry at", retryvalue
                self.recTimer.start(
                    config.AdvancedMovieSelection.next_empty_check.value *
                    60000)
            else:
                if self.recTimer.isActive():
                    self.recTimer.stop()
                self.list = []

                path = config.movielist.last_videodir.value
                if not fileExists(path):
                    path = defaultMoviePath()
                    config.movielist.last_videodir.value = path
                    config.movielist.last_videodir.save()

                if config.AdvancedMovieSelection.wastelist_buildtype.value == 'listMovies':
                    trash = Trashcan.listMovies(path)
                elif config.AdvancedMovieSelection.wastelist_buildtype.value == 'listAllMovies':
                    trash = Trashcan.listAllMovies(path)
                else:
                    trash = Trashcan.listAllMovies("/media")

                print "[AdvancedMovieSelection] Start automated deleting all movies in trash list"
                Trashcan.deleteAsynch(trash)
                config.AdvancedMovieSelection.last_auto_empty_wastebasket.value = int(
                    time())
                config.AdvancedMovieSelection.last_auto_empty_wastebasket.save(
                )
                self.configChange()
コード例 #5
0
 def deleteAll(self, confirmed):
     if not confirmed:
         return
     self["list"].hide()
     trash = []
     for x in self.list.list:
         service = x[0]
         trash.append(service)
     Trashcan.deleteAsynch(trash)
     self.close()
コード例 #6
0
 def restoreAll(self):
     try:
         print "Start restoring all movies"
         for x in self.list.list[:]:
             service = x[0]
             self["list"].removeService(service)
             Trashcan.restore(service.getPath())
     except Exception, e:
         print e
         self.session.open(MessageBox, _("Restore failed!"), MessageBox.TYPE_ERROR)
コード例 #7
0
 def deleteAll(self, confirmed):
     if not confirmed:
         return
     self["list"].hide()
     trash = []
     for x in self.list.list:
         service = x[0]
         trash.append(service)
     Trashcan.deleteAsynch(trash)
     self.close()
コード例 #8
0
 def delete(self, confirmed):
     if not confirmed:
         return
     try:
         self["list"].removeService(self.service)
         Trashcan.delete(self.service.getPath())
     except Exception, e:
         print e
         self.session.open(MessageBox, _("Delete failed!"), MessageBox.TYPE_ERROR)
         return
コード例 #9
0
 def delete(self, confirmed):
     if not confirmed:
         return
     try:
         self["list"].removeService(self.service)
         Trashcan.delete(self.service.getPath())
     except Exception, e:
         print e
         self.session.open(MessageBox, _("Delete failed!"),
                           MessageBox.TYPE_ERROR)
         return
コード例 #10
0
 def restoreAll(self):
     try:
         print "Start restoring all movies"
         for x in self.list.list[:]:
             service = x[0]
             self["list"].removeService(service)
             Trashcan.restore(service.getPath())
     except Exception, e:
         print e
         self.session.open(MessageBox, _("Restore failed!"),
                           MessageBox.TYPE_ERROR)
コード例 #11
0
 def restore(self):
     try:
         service = self.getCurrent() 
         if not service:
             return
         self["list"].removeService(service)
         Trashcan.restore(service.getPath())
     except Exception, e:
         print e
         self.session.open(MessageBox, _("Restore failed!"), MessageBox.TYPE_ERROR)
         return
コード例 #12
0
 def load(self, root):
     self.list = []
     if not root or Trashcan.isCurrentlyDeleting():
         return
     if config.AdvancedMovieSelection.wastelist_buildtype.value == 'listMovies':
         trash = Trashcan.listMovies(root.getPath())
     if config.AdvancedMovieSelection.wastelist_buildtype.value == 'listAllMovies':
         trash = Trashcan.listAllMovies(root.getPath())
     if config.AdvancedMovieSelection.wastelist_buildtype.value == 'listAllMoviesMedia':
         trash = Trashcan.listAllMovies("/media")
     for service in trash:
         self.list.append((service, None, -1, -1))
コード例 #13
0
 def load(self, root):
     self.list = [ ]
     if not root or Trashcan.isCurrentlyDeleting():
         return
     if config.AdvancedMovieSelection.wastelist_buildtype.value == 'listMovies':
         trash = Trashcan.listMovies(root.getPath())
     if config.AdvancedMovieSelection.wastelist_buildtype.value == 'listAllMovies':
         trash = Trashcan.listAllMovies(root.getPath())
     if config.AdvancedMovieSelection.wastelist_buildtype.value == 'listAllMoviesMedia':
         trash = Trashcan.listAllMovies("/media")
     for service in trash:
         self.list.append((service, None, -1, -1))
コード例 #14
0
 def restore(self):
     try:
         service = self.getCurrent()
         if not service:
             return
         self["list"].removeService(service)
         Trashcan.restore(service.getPath())
     except Exception, e:
         print e
         self.session.open(MessageBox, _("Restore failed!"),
                           MessageBox.TYPE_ERROR)
         return
コード例 #15
0
    def autoDeleteAllMovies(self):
        from Client import isAnyRecording
        remote_recordings = isAnyRecording()
        
        retryvalue = "%s minutes" % int(config.AdvancedMovieSelection.next_empty_check.value)

        if self.recTimer.isActive():
            self.recTimer.stop()

        if remote_recordings:
            print "[AdvancedMovieSelection] Start automated deleting all movies but remote recordings activ, retry at", retryvalue
            self.recTimer.start(config.AdvancedMovieSelection.next_empty_check.value * 60000)
            return
        
        if not Screens.Standby.inStandby:
            print "[AdvancedMovieSelection] Start automated deleting all movies but box not in standby, retry in", retryvalue
            self.recTimer.start(config.AdvancedMovieSelection.next_empty_check.value * 60000)
        else:
            recordings = self.session.nav.getRecordings()
            next_rec_time = -1
            if not recordings:
                next_rec_time = self.session.nav.RecordTimer.getNextRecordingTime()    
            if config.movielist.last_videodir.value == "/hdd/movie/" and recordings or (next_rec_time > 0 and (next_rec_time - time()) < 360):           
                print "[AdvancedMovieSelection] Start automated deleting all movies but recordings activ, retry at", retryvalue
                self.recTimer.start(config.AdvancedMovieSelection.next_empty_check.value * 60000)
            else:
                if self.recTimer.isActive():
                    self.recTimer.stop()
                self.list = [ ]
                
                path = config.movielist.last_videodir.value
                if not fileExists(path):
                    path = defaultMoviePath()
                    config.movielist.last_videodir.value = path
                    config.movielist.last_videodir.save()
                    
                if config.AdvancedMovieSelection.wastelist_buildtype.value == 'listMovies':
                    trash = Trashcan.listMovies(path)
                elif config.AdvancedMovieSelection.wastelist_buildtype.value == 'listAllMovies':
                    trash = Trashcan.listAllMovies(path)
                else:
                    trash = Trashcan.listAllMovies("/media")
                
                print "[AdvancedMovieSelection] Start automated deleting all movies in trash list"
                Trashcan.deleteAsynch(trash)
                config.AdvancedMovieSelection.last_auto_empty_wastebasket.value = int(time())
                config.AdvancedMovieSelection.last_auto_empty_wastebasket.save()
                self.configChange()
コード例 #16
0
def MVCStartup():
    print("MVC: plugin: +++")
    print("MVC: plugin: +++ MVC: " + VERSION + " starts...")
    print("MVC: plugin: +++")

    loadLCDSkin()
    setEPGLanguage()
    MovieCache.getInstance()
    RecordingsControl()
    Trashcan()
コード例 #17
0
 def delete(self, service):
     from Trashcan import Trashcan
     if config.AdvancedMovieSelection.use_wastebasket.value:
         Trashcan.trash(service.getPath())
     else:
         Trashcan.delete(service.getPath())
コード例 #18
0
 def delete(self, service):
     from Trashcan import Trashcan
     if config.AdvancedMovieSelection.use_wastebasket.value:
         Trashcan.trash(service.getPath())
     else:
         Trashcan.delete(service.getPath())