def __on_search_alternative_movie_finished(self):
        """
        used when movie title searching finishes (thread returns)
        """

        # re-enable gui elements
        # TODO
        # self.set_gui_enabled_search_title(True)

        movie = self.__get_selected_movie()
        self.__main_window.set_movie_alternative_titles_model(movie.get_alternative_titles())
        self.__populate_movie_info_panel(movie)

        self.__main_window.set_movie_search_progress_bar_visible(False)

        return
        # TODO
        renaming_rule = preferences.get_renaming_rule()
        # generate new movie name based on renaming rule
        movie = self.__get_selected_movie()
        movie.generate_new_name(renaming_rule)
        # create a table item with new movie file name
        item_new_name = QTableWidgetItem(movie.get_renamed_file_name())
        selected_movie = self._ui.table_movies.selectedItems()[0]
        # store first selected movie
        movie_index = selected_movie.row()
        self._ui.table_movies.setItem(movie_index, 1, item_new_name)
        self.populate_movie_panel()
        self._ui.stack_search_title.setCurrentIndex(0)
 def __create_movie(self, file_path):
     movie = Movie()
     movie.fill_with_file(file_path)
     movie_guessed_info = movie.get_guessed_info()
     movie.fetch_tmdb_info(movie_guessed_info.get_title(),
                           movie_guessed_info.get_year(),
                           movie_guessed_info.get_language())
     movie.generate_new_name(preferences.get_renaming_rule())
     return movie
Example #3
0
 def create_movie(self, file_path):
     # create a new movie object
     movie = Movie()
     movie.fill_with_file(file_path)
     movie_guessed_info = movie.get_guessed_info()
     movie.fetch_tmdb_info(movie_guessed_info.get_title(), movie_guessed_info.get_year(),
                           movie_guessed_info.get_language())
     # generate new movie name based on renaming rule
     movie.generate_new_name(preferences.get_renaming_rule())
     return movie
 def show_preferences(self):
     # show renaming rule dialog
     self._ui.preferences_dialog.exec_()
     renaming_rule = preferences.get_renaming_rule()
     # loop on movies
     for i in range(len(self.__movies)):
         movie = self.__movies[i]
         # generate new movie name based on new renaming rule
         movie.generate_new_name(renaming_rule)
         # set "before renaming state", because after renaming a movie
         # can be renamed a second time, after having changed the rule
         movie.set_renaming_state(Movie.STATE_BEFORE_RENAMING)
         self._ui.table_movies.item(i, 1).setForeground(QBrush(Qt.black))
         self._ui.table_movies.item(i, 1).setText(movie.get_renamed_file_name())
Example #5
0
    def populate_list_visual_rule(self):
        """
        populate renaming rule by rule read from settings
        """

        renaming_rule = preferences.get_renaming_rule()
        # split rule
        rules = renaming_rule.split('.')
        # if rule is empty, reset it to 'title'
        if rules[0] == '':
            rules[0] = Movie.TITLE
            renaming_rule = Movie.TITLE
            preferences.set_renaming_rule(renaming_rule)
        visual_rule = []
        # loop on rules
        for rule in rules:
            visual_rule.append(self.RENAMING_TO_VISUAL_RULE[rule])
        self.ui.list_visual_rule.addItems(visual_rule)
Example #6
0
    def search_title_end(self):
        """
        used when movie title searching finishes (thread returns)
        """

        # re-enable gui elements
        self.set_gui_enabled_search_title(True)
        renaming_rule = preferences.get_renaming_rule()
        # generate new movie name based on renaming rule
        movie = self.__get_selected_movie()
        movie.generate_new_name(renaming_rule)
        # create a table item with new movie file name
        item_new_name = QTableWidgetItem(movie.get_renamed_file_name())
        selected_movie = self._ui.table_movies.selectedItems()[0]
        # store first selected movie
        movie_index = selected_movie.row()
        self._ui.table_movies.setItem(movie_index, 1, item_new_name)
        self.populate_movie_panel()
        self._ui.stack_search_title.setCurrentIndex(0)
 def alternative_movies_selection_changed(self):
     selected_info = self._ui.table_others_info.selectedItems()
     if len(selected_info) > 0:
         info_index = selected_info[0].row()
         movie = self.__get_selected_movie()
         movie.set_movie(info_index)
         renaming_rule = preferences.get_renaming_rule()
         # generate new movie name based on renaming rule
         movie.generate_new_name(renaming_rule)
         # create a table item with new movie file name
         item_new_name = QTableWidgetItem(movie.get_renamed_file_name())
         selected_movie = self._ui.table_movies.selectedItems()[0]
         # store first selected movie
         movie_index = selected_movie.row()
         self._ui.table_movies.setItem(movie_index, 1, item_new_name)
         # update labels in movie panel
         self._ui.label_title.setText(movie.get_title())
         self._ui.label_original_title.setText(movie.get_original_title())
         self._ui.label_year.setText(movie.get_year())
         self._ui.label_director.setText(movie.get_directors())
         self._ui.label_duration.setText(movie.get_duration())
         self._ui.label_language.setText(movie.get_language())