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

error when processing titles that contain colons #127

Open
dwolfuk opened this issue Feb 1, 2021 · 7 comments
Open

error when processing titles that contain colons #127

dwolfuk opened this issue Feb 1, 2021 · 7 comments

Comments

@dwolfuk
Copy link

dwolfuk commented Feb 1, 2021

2 files i tested with this gave errors. the one below and another which i didn't save.

The.Great.Fire.In.Real.Time.S01E01.1080p.HEVC.x265-MeGusta.mkv

When it scrapes this file the data that comes back contains a colon which the file system doesn't like very much lol

The Great Fire: in Real Time\The Great Fire in Real Time.S01E01.London Burns.1080p

at this point the program falls over and doesn't process anything else. If it just skipped the file or could remove the offending colon even it would be better :)

edit: this file just did the same. very frustrating lmao
The.Nile.5000.Years.Of.History.S01E01.XviD-AFG.avi

@jkwill87
Copy link
Owner

jkwill87 commented Feb 3, 2021

Interestingly enough in #120 a user is having the opposite issue, where colons are being removed and they want to keep them 🤷‍♂️

I can review how filenames are being stripped. Could you please post the generated crash report? Thanks.

@dwolfuk
Copy link
Author

dwolfuk commented Feb 3, 2021

It just so happens theres another one just now lol :) - I've pasted the crash report below. Its a windows system so obviously doesn't like special chars in the name. I see the other post you mention replace_after setting. Could that be something i can use to remove the colon before it tries to write it to the drive?

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

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

  • date = 2021-02-03
  • platform = Windows-10-10.0.17763-SP0
  • arguments = ['e:\tv-shows-tosort', '-r', '--episode-directory', 'e:\TV-Shows\', '-b', '--no-guess', '--no-overwrite', '--episode-format', '{series}\{series}.S{season:02}E{episode:02}.{title}.{quality}.{extension}', '--ignore', 'srt']
  • cache location = C:\Users**\AppData\Local\mnamer-py3.9.sql
  • python version = 3.9.1
  • mnamer version = 2.5.2
  • appdirs version = 1.4.4
  • babelfish version = 0.5.5-dev
  • guessit version = 3.2.0
  • requests version = 2.24.0
  • requests cache version = 0.5.2
  • teletype version = 1.1.0

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

Traceback (most recent call last):
File "c:\users*\appdata\local\programs\python\python39\lib\site-packages\mnamer_main_.py", line 23, in main
frontend.launch()
File "c:\users*
\appdata\local\programs\python\python39\lib\site-packages\mnamer\frontends.py", line 80, in launch
self._process_targets()
File "c:\users*\appdata\local\programs\python\python39\lib\site-packages\mnamer\frontends.py", line 146, in _process_targets
if self.settings.no_overwrite and target.destination.exists():
File "c:\users*
\appdata\local\programs\python\python39\lib\pathlib.py", line 1407, in exists
self.stat()
File "c:\users**\appdata\local\programs\python\python39\lib\pathlib.py", line 1221, in stat
return self._accessor.stat(self)
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'E:\TV-Shows\Wanted: the Simple Life\Wanted the Simple Life.S01E01.Episode 1.720p web h.264.mkv'

@dwolfuk
Copy link
Author

dwolfuk commented Feb 3, 2021

ohhhh. i'm using {series} twice. once to create the folder for show and another for the filename. The filename has the colon stripped where as the folder doesn't but both use the same {series} string

@dwolfuk
Copy link
Author

dwolfuk commented Feb 3, 2021

this is the issue as in #110 - i'm going to give his fix a go if i can do it without breaking something ;)

@dwolfuk
Copy link
Author

dwolfuk commented Feb 3, 2021

in target.py i added a line

line 112 - dir_tail = str_sanitize(dir_tail)

this has done the trick for me. i'm not sure how it works when not using strings in directories but i always do so its good for me :)

@WaywardWizard
Copy link

This occurs when --episode-format has a path in addition to the filename.

Resolving MR
#150

Resolving commit
a28f18e

Your suggested fix might cause issues if sanitation interferes with the '/' sting or whatever PATH_SEP the system running has

@dwolfuk
Copy link
Author

dwolfuk commented Sep 30, 2021

A similar issue has now started to occur on the tv series Y: The Last Man. mnamer tries to move the file to Y:The Last Man rather than the path defined which doesn't exist and so it crashes. So far my previous hack to sanitize the dir_tail works but i think this is the splitdrive function removing the correct path before deciding that Y: is the correct drive. This happens before the dir_tail sanitize. I can remove all colons by sanitizing the base to remove colons which does correct the path but not properly and then mnamer copies to to e:\e\tv-shows\ rather than the correct path of e:\tv-shows.

I feel like this is caused by the python splitdrive function recognizing the drive incorrectly from the path but i can't see an easy way around it. For now i have to manually move and name the files which is a little painful. Its a shame such basic file system functions don't work as they should. Is there another way to split the path without using the splitdrive function?

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

No branches or pull requests

3 participants