Example #1
0
    def autoDeleteAllMovies(self):
        from Source.Remote.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()
Example #2
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()
Example #3
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()
Example #4
0
    def autoDeleteAllMovies(self):
        from Source.Remote.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()