Exemplo n.º 1
0
    def show_movies(self, movies: MoviesList):
        print('Movies List: ')
        for ind, movie in enumerate(movies):
            print('{0}{1}: {2} ({3}){4}'.format(Color.PURPLE, ind + 1,
                                                movie.name, movie.year,
                                                Color.END))
        while True:
            mid = int(
                input(Color.get_bold_string(Constants.movie_download_text)))
            if mid > len(movies) or mid < 1:
                Print.wrong_option()
                continue
            else:
                break
        movie_selected = movies[mid - 1]
        Print.bold_string(Constants.available_torrents_text)

        available_torrents = self.get_available_torrents(
            movie_selected.torrents)
        if len(available_torrents.values()) == 0:
            print('{0}{1}{2}'.format(Color.RED, Constants.no_torrent_text,
                                     Color.END))
        else:
            ati = 1
            for torrent_format in list(available_torrents):
                print('{0}{1}: {2}{3}'.format(Color.YELLOW, ati,
                                              torrent_format, Color.END))
                ati += 1
            if len(available_torrents) == 1:
                op = input(
                    'Press 1 to Download, Press any other key to exit\n')
                if op == '1':
                    torrent_link = list(available_torrents.values())[0]
                    Print.bold_string('{0}{1}{2}{3}'.format(
                        Constants.click_link_text, Color.RED, torrent_link,
                        Color.END))
            else:
                Print.bold_string(Constants.movie_quality_text)
                qu = int(input())
                torrent_link = list(available_torrents.values())[qu - 1]
                Helper.open_magnet_link(torrent_link)
                Print.bold_string('{0}{1}{2}{3}'.format(
                    Constants.click_link_text, Color.RED, torrent_link,
                    Color.END))
            Print.long_hash()
            if movie_selected.subtitle_url and movie_selected.subtitle_url != '':
                Print.bold_string(Constants.selection_text['subtitle'])
                download_subtitle = Helper.ask_for_options()
                if download_subtitle:
                    subtitle = Subtitle()
                    subtitle.search_subtitle(movie_selected.subtitle_url)
                Print.long_hash()
            print(
                Constants.another_movies_text.format(
                    Color.RED,
                    Color.get_bold_string(self.search_query.search_term)))
            reshow_movies = input(Color.get_yes_no())
            if reshow_movies == 'y' or reshow_movies == 'Y':
                self.show_movies(movies)
Exemplo n.º 2
0
    def create_query() -> SearchQuery:
        Print.long_hash()
        s = input(Color.get_bold_string(Constants.search_string_text))
        while not s:
            s = input(Color.get_bold_string(Constants.search_string_text))

        q = 'all'
        g = Helper.take_optional_input('genre')
        o = Helper.take_optional_input('order')

        return SearchQuery(s, q, g, 0, o, 0, 'all')
Exemplo n.º 3
0
 def take_optional_input(input_type):
     Print.long_hash()
     if input_type not in Constants.input_types:
         Print.bold_string('Wrong input type: {0}'.format(input_type))
         exit(1)
     selection_text = Constants.selection_text[input_type]
     specific_final_option = Constants.specific_final_option[input_type]
     special_final_option = Constants.special_final_option[input_type]
     Print.bold_string(selection_text)
     want = Helper.ask_for_options()
     options = Constants.options[input_type]
     if not want:
         Print.colored_note(special_final_option)
         return options[0]
     final_option = Helper.take_input(input_type, options)
     Print.colored_note(specific_final_option.format(final_option))
     return final_option
Exemplo n.º 4
0
    def create_query() -> SearchQuery:
        Print.long_hash()
        s = input(Color.get_bold_string(Constants.search_string_text))

        q = 'all'
        """
        print('Please enter any specific quality of your torrent: ')
        quality_options = Constants.quality
        for i in range(len(quality_options)):
            print('{0}: {1}'.format(i, quality_options[i]))
        q = int(input())
        while q > 4 or q < 0:
            print('Wrong option, Try again')
        q = quality_options[q]
        """
        g = Helper.take_optional_input('genre')
        o = Helper.take_optional_input('order')

        return SearchQuery(s, q, g, 0, o, 0, 'all')