Exemplo n.º 1
0
    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"))
Exemplo n.º 2
0
    def search(self, **data):
        """
        Search for added movie. 
        Add if only 1 is found
        """
        moviename = data.get("moviename")
        movienr = data.get("movienr")
        quality = data.get("quality")
        year = data.get("year")

        if data.get("add"):
            results = cherrypy.session.get("searchresults")
            if not results:
                log.error("Researching for results..")
                results = self.searchers.get("movie").find(moviename)
            result = results[int(movienr)]

            if year:
                result.year = year

            if result.year == "None" or not result.year:
                return self.render({"error": "year"})
            else:
                self._addMovie(result, quality)
                return redirect(cherrypy.request.headers.get("referer"))
        else:
            results = self.searchers.get("movie").find(moviename)
            cherrypy.session["searchresults"] = results

        return self.render({"moviename": moviename, "results": results, "quality": quality})
Exemplo n.º 3
0
    def save(self, **data):
        '''
        Save all config settings
        '''
        config = cherrypy.config.get('config')

        # catch checkboxes
        bools = filter(lambda s: not data.get(s),
            [
              'global.launchbrowser', 'global.updater',
              'XBMC.enabled', 'XBMC.onSnatch',
              'NMJ.enabled',
              'PLEX.enabled',
              'PROWL.enabled', 'PROWL.onSnatch',
              'GROWL.enabled', 'GROWL.onSnatch',
              'Notifo.enabled', 'Notifo.onSnatch',
              'NMA.enable', 'NMA.onSnatch',
              'Meta.enabled',
              'MovieETA.enabled',
              'Renamer.enabled', 'Renamer.trailerQuality', 'Renamer.cleanup',
              'Torrents.enabled',
              'NZB.enabled',
              'NZBMatrix.enabled', 'NZBMatrix.english', 'NZBMatrix.ssl',
              'NZBsRUS.enabled',
              'newzbin.enabled',
              'NZBsorg.enabled',
              'newznab.enabled',
              'Subtitles.enabled', 'Subtitles.addLanguage',
              'MovieRSS.enabled',
            ]
        )
        data.update(data.fromkeys(bools, False))

        # Do quality order
        order = data.get('Quality.order').split(',')
        for id in order:
            qo = Db.query(QualityTemplate).filter_by(id = int(id)).one()
            qo.order = order.index(id)
            Db.flush()
        del data['Quality.order']

        # Save templates
        if data.get('Quality.templates'):
            templates = json.loads(data.get('Quality.templates'))
            Qualities().saveTemplates(templates)
        del data['Quality.templates']

        # Save post data
        for name in data:
            section = name.split('.')[0]
            var = name.split('.')[1]
            config.set(section, var, data[name])

        # Change cron interval
        self.cron.get('yarr').setInterval(config.get('Intervals', 'search'))

        config.save()

        self.flash.add('config', 'Settings successfully saved.')
        return redirect(cherrypy.request.headers.get('referer'))
Exemplo n.º 4
0
    def search(self, **data):
        '''
        Search for added movie. 
        Add if only 1 is found
        '''
        moviename = data.get('moviename')
        movienr = data.get('movienr')
        quality = data.get('quality')
        year = data.get('year')

        if data.get('add'):
            results = cherrypy.session.get('searchresults')
            if not results:
                log.error('Researching for results..')
                results = self.searchers.get('movie').find(moviename)
            result = results[int(movienr)]

            if year:
                result.year = year

            if result.year == 'None' or not result.year:
                return self.render({'error': 'year'})
            else:
                self._addMovie(result, quality)
                return redirect(cherrypy.request.headers.get('referer'))
        else:
            results = self.searchers.get('movie').find(moviename)
            cherrypy.session['searchresults'] = results

        return self.render({'moviename':moviename, 'results': results, 'quality':quality})
Exemplo n.º 5
0
    def search(self, **data):
        '''
        Search for added movie. 
        Add if only 1 is found
        '''
        moviename = data.get('moviename')
        movienr = data.get('movienr')
        quality = data.get('quality')
        year = data.get('year')

        if data.get('add'):
            results = cherrypy.session.get('searchresults')
            if not results:
                log.error('Researching for results..')
                results = self.searchers.get('movie').find(moviename)
            result = results[int(movienr)]

            if year:
                result.year = year

            if result.year == 'None' or not result.year:
                return self.render({'error': 'year'})
            else:
                self._addMovie(result, quality)
                return redirect(cherrypy.request.headers.get('referer'))
        else:
            results = self.searchers.get('movie').find(moviename)
            cherrypy.session['searchresults'] = results

        return self.render({
            'moviename': moviename,
            'results': results,
            'quality': quality
        })
Exemplo n.º 6
0
    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'))
Exemplo n.º 7
0
    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'))
Exemplo n.º 8
0
 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'))
Exemplo n.º 9
0
    def force(self):
        '''
        Force the cron to start
        '''

        self.cron.get('yarr').forceCheck()

        return redirect(cherrypy.request.headers.get('referer'))
Exemplo n.º 10
0
 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"))
Exemplo n.º 11
0
 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'))
Exemplo n.º 12
0
    def twitterReqAuth(self):

        twitter = Twitter()
        referer = cherrypy.request.headers.get('referer')
        auth_url = twitter.get_authorization(referer)
        if not auth_url:
            return ('Error making an oauth connection to Twitter.  Check your '
                    'system time?  See the logs for a more detailed error.')
        return redirect(auth_url)
Exemplo n.º 13
0
    def twitterReqAuth(self):

        twitter = Twitter()
        referer = cherrypy.request.headers.get('referer')
        auth_url = twitter.get_authorization(referer)
        if not auth_url:
          return ('Error making an oauth connection to Twitter.  Check your '
                  'system time?  See the logs for a more detailed error.')
        return redirect(auth_url)
Exemplo n.º 14
0
    def save(self, **data):
        """
        Save all config settings
        """
        config = cherrypy.config.get("config")

        # catch checkboxes
        for bool in [
            "XBMC.enabled",
            "Meta.enabled",
            "Renamer.enabled",
            "Renamer.trailerQuality",
            "Renamer.cleanup",
            "global.launchbrowser",
            "global.updater",
            "Torrents.enabled",
            "NZB.enabled",
            "NZBMatrix.enabled",
            "NZBsorg.enabled",
            "newznab.enabled",
            "Newzbin.enabled" "Subtitles.enabled",
            "Subtitles.addLanguage",
        ]:
            if not data.get(bool):
                data[bool] = False

        # Do quality order
        order = data.get("Quality.order").split(",")
        for id in order:
            qo = Db.query(QualityTemplate).filter_by(id=int(id)).one()
            qo.order = order.index(id)
            Db.flush()
        del data["Quality.order"]

        # Save templates
        if data.get("Quality.templates"):
            templates = json.loads(data.get("Quality.templates"))
            Qualities().saveTemplates(templates)
        del data["Quality.templates"]

        # Save post data
        for name in data:
            section = name.split(".")[0]
            var = name.split(".")[1]
            config.set(section, var, data[name])

        # Change cron interval
        self.cron.get("yarr").setInterval(config.get("Intervals", "search"))

        config.save()

        self.flash.add("config", "Settings successfully saved.")
        return redirect(cherrypy.request.headers.get("referer"))
Exemplo n.º 15
0
    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'))
Exemplo n.º 16
0
    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"))
Exemplo n.º 17
0
    def index(self):
        """
        Show all wanted, snatched, downloaded movies
        """

        if cherrypy.request.path_info == "/":
            return redirect("movie/")

        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})
Exemplo n.º 18
0
    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'))
Exemplo n.º 19
0
    def index(self):
        '''
        Show all wanted, snatched, downloaded movies
        '''

        if cherrypy.request.path_info == '/':
            return redirect('movie/')

        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})
Exemplo n.º 20
0
    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"))
Exemplo n.º 21
0
    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'))
Exemplo n.º 22
0
    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'))
Exemplo n.º 23
0
    def save(self, **data):
        '''
        Save all config settings
        '''
        config = cherrypy.config.get('config')

        # catch checkboxes
        for bool in [
                    'XBMC.enabled', 'Meta.enabled',
                    'Renamer.enabled', 'Renamer.trailerQuality', 'Renamer.cleanup',
                     'global.launchbrowser', 'global.updater',
                     'Torrents.enabled',
                     'NZB.enabled',
                     'NZBMatrix.enabled', 'NZBsorg.enabled', 'newznab.enabled',
                     'Subtitles.enabled', 'Subtitles.addLanguage'
                     ]:
            if not data.get(bool):
                data[bool] = False

        # Do quality order
        order = data.get('Quality.order').split(',')
        for id in order:
            qo = Db.query(QualityTemplate).filter_by(id = int(id)).one()
            qo.order = order.index(id)
            Db.flush()
        del data['Quality.order']

        # Save templates
        if data.get('Quality.templates'):
            templates = json.loads(data.get('Quality.templates'))
            Qualities().saveTemplates(templates)
        del data['Quality.templates']

        # Save post data
        for name in data:
            section = name.split('.')[0]
            var = name.split('.')[1]
            config.set(section, var, data[name])

        # Change cron interval
        self.cron.get('yarr').setInterval(config.get('Intervals', 'search'))

        config.save()

        self.flash.add('config', 'Settings successfully saved.')
        return redirect(cherrypy.request.headers.get('referer'))
Exemplo n.º 24
0
    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'))
Exemplo n.º 25
0
    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'))
Exemplo n.º 26
0
    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'))
Exemplo n.º 27
0
    def index(self):
        '''
        Show all wanted, snatched, downloaded movies
        '''

        if cherrypy.request.path_info == '/':
            return redirect('movie/')

        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
        })
Exemplo n.º 28
0
    def renewEta(self):

        self.cron.get('eta').all()

        return redirect(url(controller='feed', action='index'))
Exemplo n.º 29
0
    def stop(self):

        self.cron.get('yarr').stopCheck()

        return redirect(cherrypy.request.headers.get('referer'))
Exemplo n.º 30
0
 def force(self):
     self.cron.get('yarr').forceCheck()
     return redirect(cherrypy.request.headers.get('referer'))
Exemplo n.º 31
0
 def stop(self):
     self.cron.get('yarr').stopCheck()
     return redirect(cherrypy.request.headers.get('referer'))
Exemplo n.º 32
0
    def save(self, **data):
        """
        Save all config settings
        """
        config = cherrypy.config.get("config")

        # catch checkboxes
        bools = filter(
            lambda s: not data.get(s),
            [
                "global.launchbrowser",
                "global.updater",
                "XBMC.enabled",
                "XBMC.onSnatch",
                "XBMC.useWebAPIExistingCheck",
                "NMJ.enabled",
                "PLEX.enabled",
                "PROWL.enabled",
                "PROWL.onSnatch",
                "GROWL.enabled",
                "GROWL.onSnatch",
                "Notifo.enabled",
                "Notifo.onSnatch",
                "SNS.enabled",
                "SNS.onSnatch",
                "Boxcar.enabled",
                "Boxcar.onSnatch",
                "NMA.enable",
                "NMA.onSnatch",
                "NMWP.enable",
                "NMWP.onSnatch",
                "Twitter.enabled",
                "Twitter.onSnatch",
                "Trakt.notification_enabled",
                "Trakt.watchlist_remove",
                "Trakt.watchlist_enabled",
                "Trakt.dontaddcollection",
                "Meta.enabled",
                "MovieETA.enabled",
                "Renamer.enabled",
                "Renamer.trailerQuality",
                "Renamer.cleanup",
                "Torrents.enabled",
                "NZB.enabled",
                "NZBMatrix.enabled",
                "NZBMatrix.english",
                "NZBMatrix.ssl",
                "NZBsRUS.enabled",
                "newzbin.enabled",
                "NZBsorg.enabled",
                "newznab.enabled",
                "x264.enabled",
                "Subtitles.enabled",
                "Subtitles.addLanguage",
                "MovieRSS.enabled",
                "KinepolisRSS.enabled",
                "IMDBWatchlist.enabled",
            ],
        )
        data.update(data.fromkeys(bools, False))

        # Do quality order
        order = data.get("Quality.order").split(",")
        for id in order:
            qo = Db.query(QualityTemplate).filter_by(id=int(id)).one()
            qo.order = order.index(id)
            Db.flush()
        del data["Quality.order"]

        # Save templates
        if data.get("Quality.templates"):
            templates = json.loads(data.get("Quality.templates"))
            Qualities().saveTemplates(templates)
        del data["Quality.templates"]

        # Save post data
        for name in data:
            section = name.split(".")[0]
            var = name.split(".")[1]
            config.set(section, var, data[name])

        # Change cron interval
        self.cron.get("yarr").setInterval(config.get("Intervals", "search"))

        config.save()

        self.flash.add("config", "Settings successfully saved.")
        return redirect(cherrypy.request.headers.get("referer"))
Exemplo n.º 33
0
    def twitterAuth(self, oauth_token=None, oauth_verifier=None, **params):

        twitter = Twitter()
        twitter.get_credentials(oauth_verifier)
        return redirect('../')
Exemplo n.º 34
0
    def twitterReqAuth(self):

        twitter = Twitter()
        referer = cherrypy.request.headers.get('referer')
        auth_url = twitter.get_authorization(referer)
        return redirect(auth_url)
Exemplo n.º 35
0
    def checkForUpdate(self):

        updater = cherrypy.config.get('updater')
        updater.checkForUpdate()

        return redirect(cherrypy.request.headers.get('referer'))
Exemplo n.º 36
0
    def checkForUpdate(self):

        updater = cherrypy.config.get('updater')
        updater.checkForUpdate()

        return redirect(cherrypy.request.headers.get('referer'))
Exemplo n.º 37
0
    def renewEta(self):

        self.cron.get('eta').all()

        return redirect(url(controller = 'feed', action = 'index'))
Exemplo n.º 38
0
    def twitterAuth(self, oauth_token=None, oauth_verifier=None, **params):

        twitter = Twitter()
        twitter.get_credentials(oauth_verifier)
        return redirect('../')
Exemplo n.º 39
0
    def twitterReqAuth(self):

        twitter = Twitter()
        referer = cherrypy.request.headers.get('referer')
        auth_url = twitter.get_authorization(referer)
        return redirect(auth_url)
Exemplo n.º 40
0
    def save(self, **data):
        '''
        Save all config settings
        '''
        config = cherrypy.config.get('config')

        # catch checkboxes
        bools = filter(lambda s: not data.get(s), [
            'global.launchbrowser',
            'global.updater',
            'XBMC.enabled',
            'XBMC.onSnatch',
            'NMJ.enabled',
            'PLEX.enabled',
            'PROWL.enabled',
            'PROWL.onSnatch',
            'GROWL.enabled',
            'GROWL.onSnatch',
            'Notifo.enabled',
            'Notifo.onSnatch',
            'Boxcar.enabled',
            'Boxcar.onSnatch',
            'NMA.enable',
            'NMA.onSnatch',
            'Twitter.enabled',
            'Twitter.onSnatch',
            'Trakt.notification_enabled',
            'Trakt.watchlist_remove',
            'Trakt.watchlist_enabled',
            'Trakt.dontaddcollection',
            'Meta.enabled',
            'MovieETA.enabled',
            'Renamer.enabled',
            'Renamer.trailerQuality',
            'Renamer.cleanup',
            'Torrents.enabled',
            'NZB.enabled',
            'NZBMatrix.enabled',
            'NZBMatrix.english',
            'NZBMatrix.ssl',
            'NZBsRUS.enabled',
            'newzbin.enabled',
            'NZBsorg.enabled',
            'newznab.enabled',
            'x264.enabled',
            'Subtitles.enabled',
            'Subtitles.addLanguage',
            'MovieRSS.enabled',
            'KinepolisRSS.enabled',
        ])
        data.update(data.fromkeys(bools, False))

        # Do quality order
        order = data.get('Quality.order').split(',')
        for id in order:
            qo = Db.query(QualityTemplate).filter_by(id=int(id)).one()
            qo.order = order.index(id)
            Db.flush()
        del data['Quality.order']

        # Save templates
        if data.get('Quality.templates'):
            templates = json.loads(data.get('Quality.templates'))
            Qualities().saveTemplates(templates)
        del data['Quality.templates']

        # Save post data
        for name in data:
            section = name.split('.')[0]
            var = name.split('.')[1]
            config.set(section, var, data[name])

        # Change cron interval
        self.cron.get('yarr').setInterval(config.get('Intervals', 'search'))

        config.save()

        self.flash.add('config', 'Settings successfully saved.')
        return redirect(cherrypy.request.headers.get('referer'))
Exemplo n.º 41
0
 def force(self):
     self.cron.get('yarr').forceCheck()
     return redirect(cherrypy.request.headers.get('referer'))