Exemplo n.º 1
0
    def download(self, results):
        print(term.bold('Downloading Magnet'))
        log.info("Processing magnet link")
        magnet = results['magnet']
        log.info("Magnet: %s", magnet)

        history = History(date=int(time()), name=self.name, season=self.season,
                          episode=self.episode, magnet=magnet)
        history.save()
        history.update()

        manager = DownloadManager(magnet, port=self.port, serve=self.serve,
                                  sub_lang=self.sub_lang, player=self.player)
        manager.start()
Exemplo n.º 2
0
    def main():
        series = []
        keys = []
        items = History.many(sorted="-date,-season,-episode")
        for item in items:
            key = (item.name, item.season is not None)
            if key not in keys:
                series.append(item)
                keys.append(key)

        return render_template("main.html", items=series)
Exemplo n.º 3
0
    def main():
        series = []
        keys = []
        items = History.many(sorted="-date,-season,-episode")

        # Filter duplicate entries in the history list
        for item in items:
            key = (item.name, item.season is not None)
            if key not in keys:
                series.append(item)
                keys.append(key)

        return render_template("main.html", items=series, magnet=request.args.get('m', ''))
Exemplo n.º 4
0
    def main():
        series = []
        keys = []
        items = History.many(sorted="-date,-season,-episode")

        # Filter duplicate entries in the history list
        for item in items:
            key = (item.name, item.season is not None)
            if key not in keys:
                series.append(item)
                keys.append(key)

        return render_template("main.html",
                               items=series,
                               magnet=request.args.get('m', ''))
Exemplo n.º 5
0
    def watch(self):
        try:
            if self.name.startswith('magnet'):
                results = {'magnet': self.name}
                self.download(results)
            else:
                history = History.one(name=self.name, season=self.season,
                                      episode=self.episode)
                if history is None or not hasattr(history, "magnet"):
                    self.search_magnet()
                else:
                    results = {'magnet': history.magnet}
                    self.download(results)

        except KeyboardInterrupt:
            log.info("Thanks for using Touchandgo")
            _exit(0)
Exemplo n.º 6
0
    def watch(self):
        try:
            if self.name.startswith('magnet'):
                results = {'magnet': self.name}
                self.download(results)
            else:
                history = None
                if self.use_cache:
                    history = History.one(name=self.name, season=self.season,
                                        episode=self.episode)
                if history is None or not hasattr(history, "magnet"):
                    self.search_magnet()
                else:
                    results = {'magnet': history.magnet}
                    self.download(results)

        except KeyboardInterrupt:
            log.info("Thanks for using Touchandgo")
            _exit(0)
Exemplo n.º 7
0
    def download(self, results):
        log.info("Processing magnet link")
        magnet = results['magnet']
        log.info("Magnet: %s", magnet)

        set_config_dir()

        history = History(date=int(time()), name=self.name, season=self.season,
                          episode=self.episode, magnet=magnet)
        history.save()
        history.update()

        manager = DownloadManager(magnet, port=self.port, serve=self.serve,
                                  sub_lang=self.sub_lang, player=self.player)
        manager.start()