def __add_movies_in_folder_and_subfolders(self):
        """
        select all video files from a selected folder and subfolders using a FileDialog,
        then creates corresponding movie objects

        these movies will populate movie table

        get information from selected files
        """

        # dialog title
        title = "Select a folder containing movies..."
        # select folder from file system
        folder_path = QFileDialog.getExistingDirectory(None,
                                                       title,
                                                       preferences.get_last_visited_directory())
        # if a directory has been selected
        if folder_path != "":
            files_paths = []
            # walk on chosen directory, and loop on files and directories
            for root, dirs, files in os.walk(folder_path):
                # for each file
                for name in files:
                    self.add_file_to_list_if_video(root, name, files_paths)

            self.__load_movies(files_paths)
Beispiel #2
0
    def add_movies(self):
        """
        select video files from file system using a FileDialog,
        then creates corresponding movie objects

        these movies will populate movie table

        get information from selected files
        """

        # create a filter, only video files can be selected
        video_filter = "Video (*{0})".format(" *".join(self.VIDEO_EXTENSIONS))
        # dialog title
        title = "Select movies you want to rename..."
        # select video files from file system
        open_files_result = QFileDialog.getOpenFileNames(self, title, preferences.get_last_visited_directory(),
                                                         video_filter)
        files_paths = open_files_result[0]
        # if at least one file has been selected
        if len(files_paths) > 0:
            self.load_movies(files_paths)
Beispiel #3
0
    def add_movies_in_folder(self):
        """
        select all video files from a selected folder using a FileDialog,
        then creates corresponding movie objects

        these movies will populate movie table

        get information from selected files
        """

        # dialog title
        title = "Select a folder containing movies..."
        # select folder from file system
        folder_path = QFileDialog.getExistingDirectory(self, title, preferences.get_last_visited_directory())
        # if a directory has been selected
        if folder_path != "":
            files_paths = []
            # for each entry (files + folders) in selected folder
            for entry in os.listdir(folder_path):
                self.add_file_to_list_if_is_video(folder_path, entry, files_paths)

            self.load_movies(files_paths)