Core#

Medicure#

class medicure.Medicure(tmdb_api_key: str, movies_directory: Path | None = None, tvshows_directory: Path | None = None)#

The Medicure

__init__(tmdb_api_key: str, movies_directory: Path | None = None, tvshows_directory: Path | None = None) None#

Initializes Medicure.

Parameters:
  • tmdb_api_key (str) – Your TMDB API key

  • movies_directory (Path | None) – Your movies’ directory, this should be given for treating a movie.

  • tvshows_directory (Path | None) – Your TV shows’ directory, this should be given for treating a TV show.

treat_media(imdb_id: str, file_search_patterns: List[str], video_language_code: str, video_source: str, video_release_format: str, dubbing_suppliers: List[DubbingSupplier], season_number: int | None = None) None#

Fixes video source, audio source, file name and language for all tracks.

Parameters:
  • imdb_id (str) – IMDb id

  • file_search_patterns (List[str]) – List of patterns for finding files

  • video_language_code (str) – 3-letter language code for video track See https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes for available langauge codes.

  • video_source (str) – Source of the video file; name of encoder or the website which video is downloaded from

  • video_release_format (str) – Format of the video file eg: Blu-ray, WEBRip, etc. See https://en.wikipedia.org/wiki/Pirated_movie_release_types for available formats.

  • dubbing_suppliers (List[DubbingSupplier]) – List of possible dubbing suppliers

  • season_number (int | None) – If imdb_id is a TV show, season number should be given.

treat_subtitle(imdb_id: str, file_search_patterns: List[str], language_code: str, source: str | None = None, release_format: str | None = None, include_full_information: bool = False, season_number: int | None = None) None#

Fixes subtitle source, file name and language.

Parameters:
  • imdb_id (str) – IMDb id

  • file_search_patterns (List[str]) – List of patterns for finding files

  • language_code (str) – 3-letter language code for subtitle See https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes for available langauge codes.

  • source (str | None) – Source of the subtitle file: name of author or the website which subtitle is downloaded from. This should be given only when include_full_information is True.

  • release_format (str | None) – Format of the video that the subtitle is sync with eg: Blu-ray, WEBRip, etc. See https://en.wikipedia.org/wiki/Pirated_movie_release_types for available formats. This should be given only when include_full_information is True.

  • include_full_information (bool) – If set to True the subtitle will be converted to mks format inorder to save all subtitle information. If set to True, source and release_format should also be given.

  • season_number (int | None) – If imdb_id is a TV show season number should be given.

DubbingSupplier#

class medicure.DubbingSupplier(name: str, file_id: int, correct_language_code: str, audio_language_code: str | None = None, subtitle_language_code: str | None = None, audio_search_pattern: str | None = None, subtitle_search_pattern: str | None = None, _audio_track_id: int = None, _subtitle_track_id: int = None)#

Represents a dubbing supplier data structure.

Variables:
  • name (str) – Name of dubbing supplier, if dubbing supplier represents original audio of movie or TV show this doesn’t matter but should set to 'original' for better convenience.

  • file_id (int) – The file id which include dubbing supplier tracks

  • correct_language_code (str) – Correct 3-letter language code for dubbing supplier See https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes for available langauge codes.

  • audio_language_code (str | None) – Current 3-letter language code for audio track See https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes for available langauge codes.

  • subtitle_language_code (str | None) – Current 3-letter language code for subtitle track See https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes for available langauge codes.

  • audio_search_pattern (str | None) – The search pattern for finding audio track

  • subtitle_search_pattern (str | None) – The search pattern for finding subtitle track

to_dict() Dict[str, Any]#

Converts dubbing supplier to a minimal dictionary so can be easily used in Medicure’s CLI.

Returns:

Dictionary dubbing supplier

Return type:

Dict[str, Any]

to_list() List[Any]#

Converts dubbing supplier to a minimal list so can be easily in Medicure’s CLI.

Returns:

List dubbing supplier

Return type:

List[Any]