def reAdd(self, id, **data): """ Re-add movie and force search """ movie = Db.query(Movie).filter_by(id=id).one() if data.get("failed"): for history in movie.history: if history.status == u"snatched": history.status = u"ignore" Db.flush() for x in movie.queue: if x.completed == True: x.completed = False Db.flush() break # set status movie.status = u"want" Db.flush() # gogo find nzb for added movie via Cron self.cron.get("yarr").forceCheck(id) self.searchers.get("etaQueue").put({"id": id}) self.flash.add("movie-" + str(movie.id), '"%s" re-added.' % (movie.name)) return redirect(url(controller="movie", action="index"))
def reAdd(self, id, **data): ''' Re-add movie and force search ''' movie = Db.query(Movie).filter_by(id=id).one() if data.get('failed'): for history in movie.history: if history.status == u'snatched': history.status = u'ignore' Db.flush() for x in movie.queue: if x.completed == True: x.completed = False Db.flush() break #set status movie.status = u'want' Db.flush() #gogo find nzb for added movie via Cron self.cron.get('yarr').forceCheck(id) self.searchers.get('etaQueue').put({'id': id}) self.flash.add('movie-' + str(movie.id), '"%s" re-added.' % (movie.name)) return redirect(url(controller='movie', action='index'))
def reAdd(self, id, **data): ''' Re-add movie and force search ''' movie = Db.query(Movie).filter_by(id = id).one() if data.get('failed'): for history in movie.history: if history.status == u'snatched': history.status = u'ignore' Db.flush() for x in movie.queue: if x.completed == True: x.completed = False Db.flush() break #set status movie.status = u'want' Db.flush() #gogo find nzb for added movie via Cron self.cron.get('yarr').forceCheck(id) self.searchers.get('etaQueue').put({'id':id}) self.flash.add('movie-' + str(movie.id), '"%s" re-added.' % (movie.name)) return redirect(url(controller = 'movie', action = 'index'))
def clear_downloaded(self): """Clear downloaded movies.""" qMovie = Db.query(Movie) downloaded = qMovie.filter_by(status=u'downloaded').all() for movie in downloaded: movie.status = u'deleted' Db.flush() return redirect(url(controller='movie', action='index'))
def clear_downloaded(self): """Clear downloaded movies.""" qMovie = Db.query(Movie) downloaded = qMovie.filter_by(status=u"downloaded").all() for movie in downloaded: movie.status = u"deleted" Db.flush() return redirect(url(controller="movie", action="index"))
def clear_downloaded(self): """Clear downloaded movies.""" qMovie = Db.query(Movie) downloaded = qMovie.filter_by(status = u'downloaded').all() for movie in downloaded: movie.status = u'deleted' Db.flush() return redirect(url(controller = 'movie', action = 'index'))
def downloaded(self, id): ''' Mark movie as downloaded ''' movie = Db.query(Movie).filter_by(id = id).one() #set status movie.status = u'downloaded' Db.flush() self.flash.add('movie-' + str(movie.id), '"%s" marked as downloaded.' % (movie.name)) return redirect(url(controller = 'movie', action = 'index'))
def downloaded(self, id): """ Mark movie as downloaded """ movie = Db.query(Movie).filter_by(id=id).one() # set status movie.status = u"downloaded" Db.flush() self.flash.add("movie-" + str(movie.id), '"%s" marked as downloaded.' % (movie.name)) return redirect(url(controller="movie", action="index"))
def downloaded(self, id): ''' Mark movie as downloaded ''' movie = Db.query(Movie).filter_by(id=id).one() #set status movie.status = u'downloaded' Db.flush() self.flash.add('movie-' + str(movie.id), '"%s" marked as downloaded.' % (movie.name)) return redirect(url(controller='movie', action='index'))
def index(self): ''' Show all wanted, snatched, downloaded movies ''' if cherrypy.request.path_info == '/': return redirect(url(controller = 'movie', action = 'index')) qMovie = Db.query(Movie) movies = qMovie.order_by(Movie.name).filter(or_(Movie.status == u'want', Movie.status == u'waiting')).all() snatched = qMovie.order_by(desc(Movie.dateChanged), Movie.name).filter_by(status = u'snatched').all() downloaded = qMovie.order_by(desc(Movie.dateChanged), Movie.name).filter_by(status = u'downloaded').all() return self.render({'movies': movies, 'snatched':snatched, 'downloaded':downloaded})
def delete(self, id): ''' Mark movie as deleted ''' movie = Db.query(Movie).filter_by(id = id).one() previousStatus = movie.status #set status movie.status = u'deleted' Db.flush() if previousStatus == 'downloaded': self.flash.add('movie-' + str(movie.id), '"%s" deleted.' % (movie.name)) return redirect(url(controller = 'movie', action = 'index'))
def delete(self, id): """ Mark movie as deleted """ movie = Db.query(Movie).filter_by(id=id).one() previousStatus = movie.status # set status movie.status = u"deleted" Db.flush() if previousStatus == "downloaded": self.flash.add("movie-" + str(movie.id), '"%s" deleted.' % (movie.name)) return redirect(url(controller="movie", action="index"))
def delete(self, id): ''' Mark movie as deleted ''' movie = Db.query(Movie).filter_by(id=id).one() previousStatus = movie.status #set status movie.status = u'deleted' Db.flush() if previousStatus == 'downloaded': self.flash.add('movie-' + str(movie.id), '"%s" deleted.' % (movie.name)) return redirect(url(controller='movie', action='index'))
def clear(self): logdir = self.logDir() logfile = self.logFile() for root, subfiles, filenames in os.walk(logdir): log.debug(subfiles) for filename in filenames: file = os.path.join(root, filename) if file == logfile: with open(logfile, 'w') as f: f.write('') else: os.remove(file) return redirect(url(controller = 'log', action = 'index'))
def clear(self): logdir = self.logDir() logfile = self.logFile() for root, subfiles, filenames in os.walk(logdir): log.debug(subfiles) for filename in filenames: file = os.path.join(root, filename) if file == logfile: with open(logfile, 'w') as f: f.write('') else: os.remove(file) return redirect(url(controller='log', action='index'))
def reAdd(self, id): ''' Re-add movie and force search ''' movie = Db.query(Movie).filter_by(id = id).one() for x in movie.queue: x.completed = False Db.flush() #set status movie.status = u'want' Db.flush() #gogo find nzb for added movie via Cron self.cron.get('yarr').forceCheck(id) self.searchers.get('etaQueue').put({'id':id}) self.flash.add('movie-' + str(movie.id), '"%s" re-added.' % (movie.name)) return redirect(url(controller = 'movie', action = 'index'))
def renewEta(self): self.cron.get('eta').all() return redirect(url(controller = 'feed', action = 'index'))
def renewEta(self): self.cron.get('eta').all() return redirect(url(controller='feed', action='index'))