Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mnamer crashed #289

Open
icountu opened this issue Jan 21, 2024 · 4 comments · May be fixed by #292
Open

mnamer crashed #289

icountu opened this issue Jan 21, 2024 · 4 comments · May be fixed by #292

Comments

@icountu
Copy link

icountu commented Jan 21, 2024

=======================
--------------------------------- environment ----------------------------------

  • date = 2024-01-21
  • platform = Linux-6.1.21-v8+-aarch64-with-glibc2.36
  • arguments = ['/mnt/8tb/8tbData/Download/complete/', '-r', '--ignore=sample', '--no-overwrite', '--episode-directory=/mnt/8tb/8tbData/Media/tv/', '--episode-format={series}/Season {season:02}/{series} S{season:02}E{episode:02} - {title}.{extension}', '--movie-directory=/mnt/8tb/8tbData/Media/movies/{name} ({year})']
  • cache location = /root/.cache/mnamer-py3.11.sqlite
  • python version = 3.11.2
  • mnamer version = 2.5.5
  • appdirs version = 1.4.4
  • guessit version = 3.7.1
  • requests version = 2.31.0
  • requests cache version = 0.9.8
  • teletype version = 1.3.4
    --------------------------------- stack trace ----------------------------------
    Traceback (most recent call last):
    File "/usr/local/lib/python3.11/dist-packages/mnamer/main.py", line 22, in main
    frontend = Cli(settings)
    ^^^^^^^^^^^^^
    File "/usr/local/lib/python3.11/dist-packages/mnamer/frontends.py", line 68, in init
    super().init(settings)
    File "/usr/local/lib/python3.11/dist-packages/mnamer/frontends.py", line 24, in init
    self.targets = Target.populate_paths(self.settings)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/local/lib/python3.11/dist-packages/mnamer/target.py", line 66, in populate_paths
    targets = [cls(file_path, settings) for file_path in
    file_paths]
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/local/lib/python3.11/dist-packages/mnamer/target.py", line 66, in
    targets = [cls(file_path, settings) for file_path in
    file_paths]
    ^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/local/lib/python3.11/dist-packages/mnamer/target.py", line 49, in init
    self._parse(file_path)
    File "/usr/local/lib/python3.11/dist-packages/mnamer/target.py", line 167, in _parse
    self.metadata.language = path_data.get("language")
    ^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/local/lib/python3.11/dist-packages/mnamer/metadata.py", line 177, in setattr
    super().setattr(key, value)
    File "/usr/local/lib/python3.11/dist-packages/mnamer/metadata.py", line 69, in setattr
    value = converter(value)
    ^^^^^^^^^^^^^^^^
    File "/usr/local/lib/python3.11/dist-packages/mnamer/language.py", line 63, in parse
    raise MnamerException("Could not determine language")mnamer.exceptions.MnamerException: Could not determine language
    =============================== CRASH REPORT END ===============================
@HoLuLuLu
Copy link

HoLuLuLu commented Jan 30, 2024

I have same issue with python version 3.12.1.
I think this issue also could relate to #203

@frank42hh
Copy link

Hi,
I seem to have the same problem:

============================== CRASH REPORT BEGIN ==============================

--------------------------------- environment ----------------------------------

 - date = 2024-05-18
 - platform = Linux-6.1.90-1-MANJARO-x86_64-with-glibc2.39
 - arguments = ['Dr.House 8x04 Arzt und Glücksritter.mkv', 'Dr.House 8x15 Hetzen und Petzen.mkv', 'Dr.House 8x17 Henry und die Frauen.mkv', 'Dr.House 8x18 Trug und Schluß.mkv']
 - cache location = /home/freddy/.cache/mnamer-py3.12.sqlite
 - python version = 3.12.3
 - mnamer version = 2.5.5
 - appdirs version = 1.4.4
 - guessit version = 3.8.0
 - requests version = 2.31.0
 - requests cache version = 1.2.0
 - teletype version = 1.3.4

--------------------------------- stack trace ----------------------------------

Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/mnamer/__main__.py", line 22, in main
    frontend = Cli(settings)
               ^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/mnamer/frontends.py", line 68, in __init__
    super().__init__(settings)
  File "/usr/lib/python3.12/site-packages/mnamer/frontends.py", line 24, in __init__
    self.targets = Target.populate_paths(self.settings)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/mnamer/target.py", line 66, in populate_paths
    targets = [cls(file_path, settings) for file_path in file_paths]
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/mnamer/target.py", line 49, in __init__
    self._parse(file_path)
  File "/usr/lib/python3.12/site-packages/mnamer/target.py", line 167, in _parse
    self.metadata.language = path_data.get("language")
    ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/mnamer/metadata.py", line 177, in __setattr__
    super().__setattr__(key, value)
  File "/usr/lib/python3.12/site-packages/mnamer/metadata.py", line 69, in __setattr__
    value = converter(value)
            ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/mnamer/language.py", line 63, in parse
    raise MnamerException("Could not determine language")
mnamer.exceptions.MnamerException: Could not determine language

=============================== CRASH REPORT END ===============================

Interestingly, this happens only with few episode files, not with all. I don't see a pattern yet. And it doesn't matter if language is set to null or to "de".

@frank42hh
Copy link

Additional input: I don't know why, but it seems to relate to the filename, because I just had the same problem and was able to circumvent it by renaming the file in question:

freddy@hades Dr. House % mnamer -b --id-tvdb=73255 --language=de Dr.House.2x01.Ihr.Ich.und.Hyppokrates.mkv

============================== CRASH REPORT BEGIN ==============================

--------------------------------- environment ----------------------------------

 - date = 2024-06-05
 - platform = Linux-6.1.90-1-MANJARO-x86_64-with-glibc2.39
 - arguments = ['-b', '--id-tvdb=73255', '--language=de', 'Dr.House.2x01.Ihr.Ich.und.Hyppokrates.mkv']
 - cache location = /home/freddy/.cache/mnamer-py3.12.sqlite
 - python version = 3.12.3
 - mnamer version = 2.5.5
 - appdirs version = 1.4.4
 - guessit version = 3.8.0
 - requests version = 2.32.2
 - requests cache version = 1.2.0
 - teletype version = 1.3.4

--------------------------------- stack trace ----------------------------------

Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/mnamer/__main__.py", line 22, in main
    frontend = Cli(settings)
               ^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/mnamer/frontends.py", line 68, in __init__
    super().__init__(settings)
  File "/usr/lib/python3.12/site-packages/mnamer/frontends.py", line 24, in __init__
    self.targets = Target.populate_paths(self.settings)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/mnamer/target.py", line 66, in populate_paths
    targets = [cls(file_path, settings) for file_path in file_paths]
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/mnamer/target.py", line 49, in __init__
    self._parse(file_path)
  File "/usr/lib/python3.12/site-packages/mnamer/target.py", line 167, in _parse
    self.metadata.language = path_data.get("language")
    ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/mnamer/metadata.py", line 177, in __setattr__
    super().__setattr__(key, value)
  File "/usr/lib/python3.12/site-packages/mnamer/metadata.py", line 69, in __setattr__
    value = converter(value)
            ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/mnamer/language.py", line 63, in parse
    raise MnamerException("Could not determine language")
mnamer.exceptions.MnamerException: Could not determine language

=============================== CRASH REPORT END ===============================

Fix it by removing the episode description from the filename:
freddy@hades Dr. House % mv Dr.House.2x01.Ihr.Ich.und.Hyppokrates.mkv Dr.House.2x01.mkv

Result:

freddy@hades Dr. House % mnamer -b --id-tvdb=73255 --language=de Dr.House.2x01.mkv                        
Starting mnamer

Processing Episode "Dr.House.2x01.mkv" (1.57GB)
moving to /net/lager/videos/Serien/Andere/Dr. House/Dr. House - S02E01 - Ihr, Ich Und Hippokrates.mkv
OK!

1 out of 1 files processed successfully

@HoLuLuLu
Copy link

The problem

The exception occurs because the guessit module used by mnamer identifies some words in the title as language indicators and tries to convert them. This produces a crash with an exception.
I already made a pull request to fix that problem, but @jkwill87 seems not to be active in this repository for a while.

Workaround approach

You can replace the target.py file in mnamer with the fixed version of mine. This change will be overwritten with the next update, but hopefully it will be fixed then.

Steps for workaround approach

  1. Download the fixed target.py from Github
  2. Localize your mnamer package. Use this command:
    python -c "import mnamer; print(mnamer.__file__[:-12])"
  3. Replace target.py from the mnamer package location with the fixed one.
  4. You're done! The exception shouldn't be thrown anymore, but the language detection could be wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants