Beispiel #1
0
    def launch_file(self, filename):
        args = self.args

        query, release = file_to_query(filename)

        if args.query:
            query = args.query

        if args.release:
            release = string_set(args.release)

        if args.verbose:
            echo('Using query "{query}" and release "{release}"'.format(
                release=' '.join(release), query=query))

        search_results = search(query)

        if not search_results:
            echo('No result')
            return

        if self.args.batch and len(search_results) > 1:
            raise Error('More than one result, aborting')

        episode = self.select(search_results)

        return episode and self.episode(episode, args.language, release)
Beispiel #2
0
    def launch_file(self, filename):
        args = self.args

        query, release = file_to_query(filename)

        if args.query:
            query = args.query

        if args.release:
            release = string_set(args.release)

        if args.verbose:
            echo('Using query "{query}" and release "{release}"'.format(
                release=' '.join(release),
                query=query
            ))

        search_results = search(query)

        if not search_results:
            echo('No result')
            return

        if self.args.batch and len(search_results) > 1:
            raise Error('More than one result, aborting')

        episode = self.select(search_results)

        return episode and self.episode(episode, args.language, release)
Beispiel #3
0
    def launch_file(self, filename):
        echo('-' * 30)
        args = self.args
        filename = remove_extension(filename) + '.srt'

        echo('Target SRT file:', filename)
        ignore = False
        if os.path.isfile(filename):
            echo('File exists.', end=' ')
            if args.ignore or (not args.overwrite and
                               not self.confirm('Overwrite?', True)):
                echo('Ignoring.')
                ignore = True

            else:
                echo('Overwriting.')

        if not ignore:
            query, release = file_to_query(filename)

            if args.query:
                query = args.query

            if args.release:
                release = string_set(args.release)

            if args.verbose:
                echo('Using query "{query}" and release "{release}"'.format(
                    release=' '.join(release),
                    query=query
                ))

            search_results = search(query)

            if search_results:
                if self.args.batch and len(search_results) > 1:
                    raise Error('More than one result, aborting')

                episode = self.select(search_results)

                todownload = self.episode(episode, args.language, release)
                todownload.download(filename)

            else:
                echo('No result')

        echo()
Beispiel #4
0
    def launch_file(self, filename):
        echo('-' * 30)
        args = self.args
        filename = remove_extension(filename) + '.srt'

        echo('Target SRT file:', filename)
        ignore = False
        if os.path.isfile(filename):
            echo('File exists.', end=' ')
            if args.ignore or (not args.overwrite
                               and not self.confirm('Overwrite?', True)):
                echo('Ignoring.')
                ignore = True

            else:
                echo('Overwriting.')

        if not ignore:
            query, release = file_to_query(filename)

            if args.query:
                query = args.query

            if args.release:
                release = string_set(args.release)

            if args.verbose:
                echo('Using query "{query}" and release "{release}"'.format(
                    release=' '.join(release), query=query))

            search_results = search(query)

            if search_results:
                if self.args.batch and len(search_results) > 1:
                    raise Error('More than one result, aborting')

                episode = self.select(search_results)

                todownload = self.episode(episode, args.language, release)
                todownload.download(filename)

            else:
                echo('No result')

        echo()
Beispiel #5
0
 def file_to_query(self, filename, query, version=set()):
     q, v = file_to_query(filename)
     self.assertEqual(query, q)
     self.assertEqual(version, v)
Beispiel #6
0
 def file_to_query(self, filename, query, version=set()):
     q, v = file_to_query(filename)
     self.assertEqual(query, q)
     self.assertEqual(version, v)