mkv-episode-matcher 0.3.5__py3-none-any.whl → 0.4.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of mkv-episode-matcher might be problematic. Click here for more details.

@@ -92,7 +92,18 @@ def main():
92
92
  nargs="?",
93
93
  help="Path to the tesseract executable (default: None)",
94
94
  )
95
+ parser.add_argument(
96
+ "--check-gpu",
97
+ type=bool,
98
+ default=False,
99
+ nargs="?",
100
+ help="Check if GPU is available (default: False)",
101
+ )
95
102
  args = parser.parse_args()
103
+ if args.check_gpu:
104
+ from mkv_episode_matcher.speech_to_text import check_gpu_support
105
+ check_gpu_support()
106
+ return
96
107
  logger.debug(f"Command-line arguments: {args}")
97
108
  open_subtitles_api_key = ""
98
109
  open_subtitles_user_agent = ""
@@ -96,14 +96,27 @@ class EpisodeMatcher:
96
96
  # Load Whisper model
97
97
  model = whisper.load_model("base", device=self.device)
98
98
 
99
- # Get season-specific reference files
99
+ # Get season-specific reference files using multiple patterns
100
100
  reference_dir = self.cache_dir / "data" / self.show_name
101
- season_pattern = f"S{season_number:02d}E"
102
- reference_files = [
103
- f for f in reference_dir.glob("*.srt")
104
- if season_pattern in f.name
101
+
102
+ # Create season patterns for different formats
103
+ patterns = [
104
+ f"S{season_number:02d}E", # S01E01
105
+ f"S{season_number}E", # S1E01
106
+ f"{season_number:02d}x", # 01x01
107
+ f"{season_number}x", # 1x01
105
108
  ]
106
109
 
110
+ reference_files = []
111
+ for pattern in patterns:
112
+ files = [f for f in reference_dir.glob("*.srt")
113
+ if any(re.search(f"{p}\\d+", f.name, re.IGNORECASE)
114
+ for p in patterns)]
115
+ reference_files.extend(files)
116
+
117
+ # Remove duplicates while preserving order
118
+ reference_files = list(dict.fromkeys(reference_files))
119
+
107
120
  if not reference_files:
108
121
  logger.error(f"No reference files found for season {season_number}")
109
122
  return None
@@ -29,6 +29,14 @@ def process_show(season=None, dry_run=False, get_subs=False):
29
29
  show_name = clean_text(os.path.basename(show_dir))
30
30
  matcher = EpisodeMatcher(CACHE_DIR, show_name)
31
31
 
32
+ # Early check for reference files
33
+ reference_dir = Path(CACHE_DIR) / "data" / show_name
34
+ reference_files = list(reference_dir.glob("*.srt"))
35
+ if not reference_files:
36
+ logger.error(f"No reference subtitle files found in {reference_dir}")
37
+ logger.info("Please download reference subtitles first")
38
+ return
39
+
32
40
  season_paths = get_valid_seasons(show_dir)
33
41
  if not season_paths:
34
42
  logger.warning(f"No seasons with .mkv files found")
@@ -87,4 +87,10 @@ def extract_audio(mkv_file, output_dir):
87
87
  else:
88
88
  logger.info(f"Audio file {wav_file} already exists, skipping extraction")
89
89
 
90
- return wav_file
90
+ return wav_file
91
+ def check_gpu_support():
92
+ logger.info('Checking GPU support...')
93
+ if torch.cuda.is_available():
94
+ logger.info(f"CUDA is available. Using GPU: {torch.cuda.get_device_name(0)}")
95
+ else:
96
+ logger.warning("CUDA not available. Using CPU. Refer to https://pytorch.org/get-started/locally/ for GPU support.")
@@ -300,7 +300,7 @@ def extract_srt_text(filepath):
300
300
 
301
301
  def extract_season_episode(filename):
302
302
  """
303
- Extract season and episode numbers from filename.
303
+ Extract season and episode numbers from filename with support for multiple formats.
304
304
 
305
305
  Args:
306
306
  filename (str): Filename to parse
@@ -308,10 +308,20 @@ def extract_season_episode(filename):
308
308
  Returns:
309
309
  tuple: (season_number, episode_number)
310
310
  """
311
- match = re.search(r'S(\d+)E(\d+)', filename)
312
- if match:
313
- return int(match.group(1)), int(match.group(2))
311
+ # List of patterns to try
312
+ patterns = [
313
+ r'S(\d+)E(\d+)', # S01E01
314
+ r'(\d+)x(\d+)', # 1x01 or 01x01
315
+ r'Season\s*(\d+).*?(\d+)' # Season 1 - 01
316
+ ]
317
+
318
+ for pattern in patterns:
319
+ match = re.search(pattern, filename, re.IGNORECASE)
320
+ if match:
321
+ return int(match.group(1)), int(match.group(2))
322
+
314
323
  return None, None
324
+
315
325
  def process_srt_files(show_dir):
316
326
  """
317
327
  Process all SRT files in the given directory and its subdirectories.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: mkv-episode-matcher
3
- Version: 0.3.5
3
+ Version: 0.4.0
4
4
  Summary: The MKV Episode Matcher is a tool for identifying TV series episodes from MKV files and renaming the files accordingly.
5
5
  Home-page: https://github.com/Jsakkos/mkv-episode-matcher
6
6
  Author: Jonathan Sakkos
@@ -25,7 +25,18 @@ Requires-Dist: pytesseract>=0.3.13
25
25
  Requires-Dist: rapidfuzz>=3.10.1
26
26
  Requires-Dist: requests>=2.32.3
27
27
  Requires-Dist: tmdb-client>=0.0.1
28
+ Requires-Dist: torch>=2.5.1
29
+ Requires-Dist: torchaudio>=2.5.1
30
+ Requires-Dist: torchvision>=0.20.1
28
31
  Requires-Dist: wave>=0.0.2
32
+ Provides-Extra: cpu
33
+ Requires-Dist: torch>=2.5.1; extra == "cpu"
34
+ Requires-Dist: torchvision>=0.20.1; extra == "cpu"
35
+ Requires-Dist: torchaudio>=2.5.1; extra == "cpu"
36
+ Provides-Extra: cu124
37
+ Requires-Dist: torch>=2.5.1; extra == "cu124"
38
+ Requires-Dist: torchvision>=0.20.1; extra == "cu124"
39
+ Requires-Dist: torchaudio>=2.5.1; extra == "cu124"
29
40
 
30
41
  # MKV Episode Matcher
31
42
 
@@ -65,10 +76,11 @@ Automatically match and rename your MKV TV episodes using The Movie Database (TM
65
76
  ```bash
66
77
  pip install mkv-episode-matcher
67
78
  ```
79
+ 2. Download .srt subtitles files to ~/.mkv-episode-matcher/cache/data/Show Name/
68
80
 
69
- 2. Run on your show directory:
81
+ 3. Run on your show directory:
70
82
  ```bash
71
- mkv-match --show-dir "path/to/your/show" --get-subs true
83
+ mkv-match --show-dir "path/to/your/show"
72
84
  ```
73
85
 
74
86
  ## Documentation
@@ -1,14 +1,14 @@
1
1
  mkv_episode_matcher/.gitattributes,sha256=Gh2-F2vCM7SZ01pX23UT8pQcmauXWfF3gwyRSb6ZAFs,66
2
2
  mkv_episode_matcher/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
3
- mkv_episode_matcher/__main__.py,sha256=3ZcCUxeI7rUA-4oiCD2WXBiOFJAqLsVVWfZKN446FwQ,6792
3
+ mkv_episode_matcher/__main__.py,sha256=Tpppeh59E2PKCrALweBdfzrm4GUeK8FjAECz2ECvmXs,7105
4
4
  mkv_episode_matcher/config.py,sha256=zDDKBcsDt5fME9BRqiTi7yWKeast1pZh36BNYMvIBYM,2419
5
- mkv_episode_matcher/episode_identification.py,sha256=xYqHq1YFbZT8L1Gfa_DhSStrLblKTWxZte__B0qikQU,9739
6
- mkv_episode_matcher/episode_matcher.py,sha256=BJ76DPxsmZs-KfHZZ_0WvKSBZWXsUEO6lW34YdYEaxM,3979
5
+ mkv_episode_matcher/episode_identification.py,sha256=_6M1UJkq1RGfmLI32u9dNOVvgp5Vf2MjqW2MTx0Gl8E,10329
6
+ mkv_episode_matcher/episode_matcher.py,sha256=vunYpHQxyXo3l88BUScXa7_kMYMCV1pXpQxaLa-plZA,4325
7
7
  mkv_episode_matcher/mkv_to_srt.py,sha256=4yxBHRVhgVby0UtQ2aTXGuoQpid8pkgjMIaHU6GCdzc,10857
8
- mkv_episode_matcher/speech_to_text.py,sha256=-bnGvmtPCKyHFPEaXwIcEYTf_P13rNpAJA-2UFeRFrs,2806
8
+ mkv_episode_matcher/speech_to_text.py,sha256=wVDrFFR7oASGMyq5cfOWmInEIeU9b3MPCLs9EyJrOMw,3128
9
9
  mkv_episode_matcher/subtitle_utils.py,sha256=rYSbd393pKYQW0w4sXgals02WFGqMYYYkQHDbEkWF8c,2666
10
10
  mkv_episode_matcher/tmdb_client.py,sha256=LbMCgjmp7sCbrQo_CDlpcnryKPz5S7inE24YY9Pyjk4,4172
11
- mkv_episode_matcher/utils.py,sha256=Txnn24ou7Pg3iMq9WrT3nwBRlRP8JEuZQ2ZYW7uesp4,13972
11
+ mkv_episode_matcher/utils.py,sha256=VASbougN3rb2iu40iZWkGjKIbahW713TOrFBo_TR9wo,14269
12
12
  mkv_episode_matcher/libraries/pgs2srt/.gitignore,sha256=mt3uxWYZaFurMw_yGE258gWhtGKPVR7e3Ll4ALJpyj4,23
13
13
  mkv_episode_matcher/libraries/pgs2srt/README.md,sha256=olb25G17tj0kxPgp_LcH5I2QWXjgP1m8JFyjYRGz4UU,1374
14
14
  mkv_episode_matcher/libraries/pgs2srt/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -19,8 +19,8 @@ mkv_episode_matcher/libraries/pgs2srt/requirements.txt,sha256=sg87dqWw_qpbwciw-M
19
19
  mkv_episode_matcher/libraries/pgs2srt/Libraries/SubZero/SubZero.py,sha256=geT1LXdVd8yED9zoJ9K1XfP2JzGcM7u1SslHYrJI09o,10061
20
20
  mkv_episode_matcher/libraries/pgs2srt/Libraries/SubZero/post_processing.py,sha256=GKtVy_Lxv-z27mkRG8pJF2znKWXwZTot7jL6kN-zIxM,10503
21
21
  mkv_episode_matcher/libraries/pgs2srt/Libraries/SubZero/dictionaries/data.py,sha256=AlJHUYXl85J95OzGRik-AHVfzDd7Q8BJCvD4Nr8kRIk,938598
22
- mkv_episode_matcher-0.3.5.dist-info/METADATA,sha256=mTKSbM9Ai5UDKyj2K4AKgkdjdPVEaxylfHHp95wVZv4,5048
23
- mkv_episode_matcher-0.3.5.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
24
- mkv_episode_matcher-0.3.5.dist-info/entry_points.txt,sha256=IglJ43SuCZq2eQ3shMFILCkmQASJHnDCI3ogohW2Hn4,64
25
- mkv_episode_matcher-0.3.5.dist-info/top_level.txt,sha256=XRLbd93HUaedeWLtkyTvQjFcE5QcBRYa3V-CfHrq-OI,20
26
- mkv_episode_matcher-0.3.5.dist-info/RECORD,,
22
+ mkv_episode_matcher-0.4.0.dist-info/METADATA,sha256=o6xssGRpkRcr9elsAt0lf2ktwr2-7aSVweBZUDtlr7I,5545
23
+ mkv_episode_matcher-0.4.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
24
+ mkv_episode_matcher-0.4.0.dist-info/entry_points.txt,sha256=IglJ43SuCZq2eQ3shMFILCkmQASJHnDCI3ogohW2Hn4,64
25
+ mkv_episode_matcher-0.4.0.dist-info/top_level.txt,sha256=XRLbd93HUaedeWLtkyTvQjFcE5QcBRYa3V-CfHrq-OI,20
26
+ mkv_episode_matcher-0.4.0.dist-info/RECORD,,