{"id":17168883,"url":"https://github.com/alirezatheh/medicure","last_synced_at":"2025-04-13T15:56:19.326Z","repository":{"id":37866064,"uuid":"491278608","full_name":"alirezatheh/medicure","owner":"alirezatheh","description":"A cosmetic treatment for your media files: movies, tv shows  and also their subtitles.","archived":false,"fork":false,"pushed_at":"2025-03-31T18:13:47.000Z","size":124,"stargazers_count":6,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-06T23:18:12.159Z","etag":null,"topics":["audio","audio-processing","cli","library","media","movie","movies","multimedia","package","python","series","subtitle","subtitles","tv","tv-shows","tvshows","video","video-processing","videos"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alirezatheh.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-11T21:34:11.000Z","updated_at":"2024-07-18T19:41:59.000Z","dependencies_parsed_at":"2024-03-18T21:08:48.506Z","dependency_job_id":"1f019259-9ef6-4477-855a-2be03514189e","html_url":"https://github.com/alirezatheh/medicure","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alirezatheh%2Fmedicure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alirezatheh%2Fmedicure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alirezatheh%2Fmedicure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alirezatheh%2Fmedicure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alirezatheh","download_url":"https://codeload.github.com/alirezatheh/medicure/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248741145,"owners_count":21154251,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audio","audio-processing","cli","library","media","movie","movies","multimedia","package","python","series","subtitle","subtitles","tv","tv-shows","tvshows","video","video-processing","videos"],"created_at":"2024-10-14T23:13:10.613Z","updated_at":"2025-04-13T15:56:19.303Z","avatar_url":"https://github.com/alirezatheh.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Medicure\n[![tests](https://github.com/alirezatheh/medicure/workflows/tests/badge.svg)](https://github.com/alirezatheh/medicure/actions/workflows/tests.yaml)\n[![codecov](https://codecov.io/gh/alirezatheh/medicure/branch/main/graph/badge.svg)](https://codecov.io/gh/alirezatheh/medicure)\n[![pre-commit.ci](https://results.pre-commit.ci/badge/github/AlirezaTheH/medicure/main.svg)](https://results.pre-commit.ci/latest/github/alirezatheh/medicure/main)\n[![PyPI Version](https://img.shields.io/pypi/v/medicure)](https://pypi.python.org/pypi/medicure)\n[![Python Versions](https://img.shields.io/pypi/pyversions/medicure)](https://pypi.org/project/medicure)\n[![Documentation Status](https://readthedocs.org/projects/medicure/badge/?version=stable)](https://medicure.readthedocs.io/en/latest/?badge=stable)\n\nMedicure is a cosmetic treatment for your media files: movies, TV shows and\nalso their subtitles. Medicure provides a command-line tool and also a Python\npackage for you to properly rename, sort tracks and correct tracks info for\nyour files.\n\n## Name\nThe word *medicure* is combination of *media* and the Latin word *cura* which\nmeans \"care\".\n\n## Installation\nThe easiest way to install is from PyPI:\n```bash\npip install medicure\n```\nAlternatively, you can install directly from GitHub:\n```bash\npip install git+https://github.com/alirezatheh/medicure.git\n```\n\n## Requirements\n- [TMDB](https://www.themoviedb.org) API Key: Medicure uses TMDB's API to get\n  correct info for movies and TV shows. So you need to create a TMDB account\n  and generate an API key in order to use Medicure.\n- [Mediainfo](https://mediaarea.net/en/MediaInfo): Medicure requires Mediainfo\n  to extract track info from video and audio files.\n- [MKVToolNix](https://mkvtoolnix.download): Medicure uses `mkvmerge` to craete\n  new treated media files. `mkvmerge` is one of the MKVToolNix's command-line\n  tools.\n\n## Simple Example\nIn this example we want to treat\n[Peaky Blinders](https://en.wikipedia.org/wiki/Peaky_Blinders_(TV_series))'s\nSeason 6 video files, downloaded from [PSArips](https://psa.pm).\n\nFirst we search for the TV show in [TMDB](https://www.themoviedb.org) to see\nseason names. In this case season name starts with `Series`. In our TV shows\ndirectory we create `Peaky Blinders/Series 6` directory and put the files\nthere. Directory structure will look like this:\n```bash\nTV Shows\n└── Peaky Blinders\n    └── Series 6\n        ├── Peaky.Blinders.S06E01.1080p.10bit.WEB-DL.x265.HEVC.PSA.AM.mkv\n        ├── Peaky.Blinders.S06E02.INTERNAL.1080p.10bit.WEB-DL.x265.PSA.AM.mkv\n        ├── Peaky.Blinders.S06E03.INTERNAL.1080p.10bit.WEB-DL.x265.PSA.AM.mkv\n        ├── Peaky.Blinders.S06E04.1080p.10bit.WEB-DL.x265.PSA.AM.mkv\n        ├── Peaky.Blinders.S06E05.INTERNAL.1080p.10bit.WEB-DL.x265.PSA.AM.mkv\n        └── Peaky.Blinders.S06E06.1080p.10bit.WEB-DL.x265.PSA.AM.mkv\n```\n\nAnd each file has the following track infos:\n\n| Type     | Title | Language     | Default | Forced |\n|----------|-------|--------------|---------|--------|\n| Video    |       | Undetermined | Yes     | No     |\n| Audio    |       | English      | Yes     | No     |\n| Subtitle |       | English      | Yes     | No     |\n\nNow we run the following python snippet:\n\n```python\nfrom pathlib import Path\n\nfrom medicure import Medicure, DubbingSupplier\n\nmedicure = Medicure(\n    tmdb_api_key='YOUR_TMDB_API_KEY',\n    tvshows_directory=Path('path/to/tvshows_directory'),\n)\nmedicure.treat_media(\n    # You can find this in url of TV show in IMDb.\n    imdb_id='tt2442560',\n    file_search_patterns=[\n        # We have only one file for each episode that can be found by\n        # this pattern.\n        'PSA',\n    ],\n    video_language_code='eng',\n    video_source='PSA',\n    video_release_format='WEB-DL',\n    dubbing_suppliers=[\n        # In this example we only have one dubbing supplier and that's\n        # which contains original audio and subtitle.\n        DubbingSupplier(\n            name='original',\n            file_id=0,\n            correct_language_code='eng',\n            audio_language_code='eng',\n            subtitle_language_code='eng',\n        ),\n    ],\n    season_number=6,\n)\n```\nThen directory structure will look like this:\n```bash\nTV Shows\n└── Peaky Blinders\n    ├── Series 6\n    │   ├── Peaky.Blinders.S06E01.1080p.10bit.WEB-DL.x265.HEVC.PSA.AM.mkv\n    │   ├── Peaky.Blinders.S06E02.INTERNAL.1080p.10bit.WEB-DL.x265.PSA.AM.mkv\n    │   ├── Peaky.Blinders.S06E03.INTERNAL.1080p.10bit.WEB-DL.x265.PSA.AM.mkv\n    │   ├── Peaky.Blinders.S06E04.1080p.10bit.WEB-DL.x265.PSA.AM.mkv\n    │   ├── Peaky.Blinders.S06E05.INTERNAL.1080p.10bit.WEB-DL.x265.PSA.AM.mkv\n    │   └── Peaky.Blinders.S06E06.1080p.10bit.WEB-DL.x265.PSA.AM.mkv\n    └── Series 6 Edited\n        ├── Peaky Blinders - S06E01 - Black Day.mkv\n        ├── Peaky Blinders - S06E02 - Black Shirt.mkv\n        ├── Peaky Blinders - S06E03 - Gold.mkv\n        ├── Peaky Blinders - S06E04 - Sapphire.mkv\n        ├── Peaky Blinders - S06E05 - The Road to Hell.mkv\n        └── Peaky Blinders - S06E06 - Lock and Key.mkv\n```\nAnd each file track infos:\n\n| Type     | Title      | Language | Default | Forced |\n|----------|------------|----------|---------|--------|\n| Video    | PSA WEB-DL | English  | Yes     | No     |\n| Audio    |            | English  | Yes     | No     |\n| Subtitle |            | English  | No      | No     |\n\nLet's treat again, this time using Medicure's command-line interface.\n\nSince we're using CLI for the first time, we need to save our TMDB API key and\nTV shows directory locally:\n```bash\nmedicure save tmdb-info YOUR_TMDB_API_KEY\n```\n```bash\nmedicure save collection-info \\\n--tvshows-directory PATH_TO_YOUR_TVSHOWS_DIRECTORY\n```\nNow we can run:\n```bash\nmedicure treat media \\\ntt2442560 \\\n'[\"PSA\"]' \\\neng \\\nPSA \\\nWEB-DL \\\n'[[\"original\", 0, \"eng\", \"eng\", \"eng\"]]' \\\n6\n```\n\nIf you want to learn more about Medicure with more in depth examples you can\nvisit [Medicure's documentation](https://medicure.readthedocs.io/en/stable).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falirezatheh%2Fmedicure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falirezatheh%2Fmedicure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falirezatheh%2Fmedicure/lists"}