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

Issue with Windows Character Naming Restrictions Causing Directory Skipping and Errors #39

Open
DireKangaroo opened this issue Mar 16, 2024 · 1 comment

Comments

@DireKangaroo
Copy link

DireKangaroo commented Mar 16, 2024

I have an issue where media names on Plex containing restricted characters on Windows systems result in skipping creating those directories and triggering errors. The script continues to run in the background but no longer shows progress.

Example 1; Is a smart collection ending with ?

File "C:\Plex\Media-Scripts-main\Plex\grab-all-posters.py", line 1384, in <module>
    result = future.result() # blocks
             ^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2288.0_x64__qbz5n2kfra8p0\Lib\concurrent\futures\_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2288.0_x64__qbz5n2kfra8p0\Lib\concurrent\futures\_base.py", line 401, in __get_result
    raise self._exception
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2288.0_x64__qbz5n2kfra8p0\Lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Plex\Media-Scripts-main\Plex\grab-all-posters.py", line 655, in process_the_thing     
    p.mkdir(parents=True, exist_ok=True)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2288.0_x64__qbz5n2kfra8p0\Lib\pathlib.py", line 1116, in mkdir
    os.mkdir(self, mode)
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'assets\\Movies\\Collections\\What should I watch?'

Example 2; Normal plex collection with : in de middle of it:

File "C:\Plex\Media-Scripts-main\Plex\grab-all-posters.py", line 1384, in <module>
    result = future.result() # blocks
             ^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2288.0_x64__qbz5n2kfra8p0\Lib\concurrent\futures\_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2288.0_x64__qbz5n2kfra8p0\Lib\concurrent\futures\_base.py", line 401, in __get_result
    raise self._exception
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2288.0_x64__qbz5n2kfra8p0\Lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Plex\Media-Scripts-main\Plex\grab-all-posters.py", line 655, in process_the_thing     
    p.mkdir(parents=True, exist_ok=True)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2288.0_x64__qbz5n2kfra8p0\Lib\pathlib.py", line 1116, in mkdir
    os.mkdir(self, mode)
NotADirectoryError: [WinError 267] The directory name is invalid: 'assets\\Movies\\Collections\\Demon Slayer: Kimetsu no Yaiba Collection'

Impact:
The presence of restricted Windows characters such as ?, *, <, >, |, ", and : in directory names causes to skip those, leading to incomplete processing of files. While the script continues execution, the skipped directories are not handled as intended.

I also have certain items on plex that contain a / such as the V/H/S Collection. For the movies themselves these are replaced by +, but multiple subdirectories are created for the collection itself.

Steps to Reproduce:

  1. Attempt to process directories with names containing restricted characters (?, *, <, >, |, ", :) using script on a Windows system.
  2. Observe the script skipping these directories and generating errors in the output or logs.

Proposed Solution
In the arr applications, the : is replaced with -. It's possible that a similar approach could be implemented here. However, I'm uncertain about how pmm manages this, as I've only just begun with pmm.

@chazlarson
Copy link
Owner

I've made changes in this area; can you give this a try and see if it's still an issue? I have no Windows machines available to test.

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

No branches or pull requests

2 participants