Exemplo n.º 1
0
    def _create_media(self,
                      file_path: str,
                      media_contains_subs: tuple,
                      table="all_movies"):
        """
        Creates a Media object with the provided file_name and folder_name. If the media is a movie then creates
        a Movie object, if it is a series it creates a Series object. Adds it to the table all_movies.
        TODO: Add Series object to media.py

        :param file_path: (string) absolute path of the current file
        :param media_contains_subs: (tuple) indicates if the media has subtitles by getting an absolute path of the subs as a tuple
        :param table: (string) table to which the object will be added
        """
        media = Movie(file_path)
        media.extract_movie_info()
        # movie_found = True  # No internet connection
        movie_found = media.search_imdb_id()
        if movie_found:
            if media_contains_subs:
                media.add_subs(media_contains_subs)
            self.interactor.add_media_to_db(media, table)