mkv-episode-matcher 0.9.1__tar.gz → 0.9.2__tar.gz

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.

Files changed (44) hide show
  1. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/PKG-INFO +1 -1
  2. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/mkv_episode_matcher/utils.py +35 -5
  3. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/mkv_episode_matcher.egg-info/PKG-INFO +1 -1
  4. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/setup.cfg +1 -1
  5. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/.coverage +0 -0
  6. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/.gitattributes +0 -0
  7. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/.github/funding.yml +0 -0
  8. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/.github/workflows/documentation.yml +0 -0
  9. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/.github/workflows/python-publish.yml +0 -0
  10. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/.github/workflows/tests.yml +0 -0
  11. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/.gitignore +0 -0
  12. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/.gitmodules +0 -0
  13. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/.python-version +0 -0
  14. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/.vscode/settings.json +0 -0
  15. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/CHANGELOG.md +0 -0
  16. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/README.md +0 -0
  17. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/docs/api/index.md +0 -0
  18. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/docs/changelog.md +0 -0
  19. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/docs/cli.md +0 -0
  20. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/docs/configuration.md +0 -0
  21. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/docs/installation.md +0 -0
  22. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/docs/quickstart.md +0 -0
  23. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/docs/tips.md +0 -0
  24. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/mkdocs.yml +0 -0
  25. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/mkv_episode_matcher/.gitattributes +0 -0
  26. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/mkv_episode_matcher/__init__.py +0 -0
  27. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/mkv_episode_matcher/__main__.py +0 -0
  28. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/mkv_episode_matcher/config.py +0 -0
  29. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/mkv_episode_matcher/episode_identification.py +0 -0
  30. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/mkv_episode_matcher/episode_matcher.py +0 -0
  31. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/mkv_episode_matcher/subtitle_utils.py +0 -0
  32. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/mkv_episode_matcher/tmdb_client.py +0 -0
  33. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/mkv_episode_matcher.egg-info/SOURCES.txt +0 -0
  34. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/mkv_episode_matcher.egg-info/dependency_links.txt +0 -0
  35. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/mkv_episode_matcher.egg-info/entry_points.txt +0 -0
  36. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/mkv_episode_matcher.egg-info/requires.txt +0 -0
  37. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/mkv_episode_matcher.egg-info/top_level.txt +0 -0
  38. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/pyproject.toml +0 -0
  39. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/setup.py +0 -0
  40. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/tests/__init__.py +0 -0
  41. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/tests/test_main.py +0 -0
  42. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/tests/test_path_handling.py +0 -0
  43. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/tests/test_trailing_slash.py +0 -0
  44. {mkv_episode_matcher-0.9.1 → mkv_episode_matcher-0.9.2}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mkv-episode-matcher
3
- Version: 0.9.1
3
+ Version: 0.9.2
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
@@ -8,6 +8,7 @@ import requests
8
8
  import torch
9
9
  from loguru import logger
10
10
  from opensubtitlescom import OpenSubtitles
11
+ from opensubtitlescom.exceptions import OpenSubtitlesException
11
12
  from rich.console import Console
12
13
  from rich.panel import Panel
13
14
  from rich.progress import Progress, SpinnerColumn, TextColumn
@@ -164,7 +165,7 @@ def rename_episode_file(original_file_path, new_filename):
164
165
  return None
165
166
 
166
167
 
167
- def get_subtitles(show_id, seasons: set[int], config=None):
168
+ def get_subtitles(show_id, seasons: set[int], config=None, max_retries=3):
168
169
  """
169
170
  Retrieves and saves subtitles for a given TV show and seasons.
170
171
 
@@ -172,6 +173,7 @@ def get_subtitles(show_id, seasons: set[int], config=None):
172
173
  show_id (int): The ID of the TV show.
173
174
  seasons (Set[int]): A set of season numbers for which subtitles should be retrieved.
174
175
  config (Config object, optional): Preloaded configuration.
176
+ max_retries (int, optional): Number of times to retry subtitle download on OpenSubtitlesException. Defaults to 3.
175
177
  """
176
178
  if config is None:
177
179
  config = get_config(CONFIG_FILE)
@@ -243,12 +245,40 @@ def get_subtitles(show_id, seasons: set[int], config=None):
243
245
  for subtitle in response.data:
244
246
  subtitle_dict = subtitle.to_dict()
245
247
  # Remove special characters and convert to uppercase
246
- filename_clean = re.sub(r"\W+", " ", subtitle_dict["file_name"]).upper()
248
+ filename_clean = re.sub(r"\\W+", " ", subtitle_dict["file_name"]).upper()
247
249
  if f"E{episode:02d}" in filename_clean:
248
250
  logger.info(f"Original filename: {subtitle_dict['file_name']}")
249
- srt_file = subtitles.download_and_save(subtitle)
250
- shutil.move(srt_file, srt_filepath)
251
- logger.info(f"Subtitle saved to {srt_filepath}")
251
+ retry_count = 0
252
+ while retry_count < max_retries:
253
+ try:
254
+ srt_file = subtitles.download_and_save(subtitle)
255
+ shutil.move(srt_file, srt_filepath)
256
+ logger.info(f"Subtitle saved to {srt_filepath}")
257
+ break
258
+ except OpenSubtitlesException as e:
259
+ retry_count += 1
260
+ logger.error(f"OpenSubtitlesException (attempt {retry_count}): {e}")
261
+ console.print(f"[red]OpenSubtitlesException (attempt {retry_count}): {e}[/red]")
262
+ if retry_count >= max_retries:
263
+ user_input = input("Would you like to continue matching? (y/n): ")
264
+ if user_input.strip().lower() != 'y':
265
+ logger.info("User chose to stop matching due to the error.")
266
+ return
267
+ else:
268
+ logger.info("User chose to continue matching despite the error.")
269
+ break
270
+ except Exception as e:
271
+ logger.error(f"Failed to download and save subtitle: {e}")
272
+ console.print(f"[red]Failed to download and save subtitle: {e}[/red]")
273
+ user_input = input("Would you like to continue matching despite the error? (y/n): ")
274
+ if user_input.strip().lower() != 'y':
275
+ logger.info("User chose to stop matching due to the error.")
276
+ return
277
+ else:
278
+ logger.info("User chose to continue matching despite the error.")
279
+ break
280
+ else:
281
+ continue
252
282
  break
253
283
 
254
284
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mkv-episode-matcher
3
- Version: 0.9.1
3
+ Version: 0.9.2
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
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = mkv_episode_matcher
3
- version = 0.9.1
3
+ version = 0.9.2
4
4
  author = Jonathan Sakkos
5
5
  author_email = jonathansakkos@gmail.com
6
6
  description = The MKV Episode Matcher is a tool for identifying TV series episodes from MKV files and renaming the files accordingly.