#14 ✓wontfix

Parsing files such as /ShowName/01x01.avi

Reported by dzv | September 11th, 2008 @ 07:06 AM

I have some shows that are named in the above format. The folder's name is the show name, and the file name only has the season and episode numbers. I did my best to write a RegExp to properly parse these files, but I couldn't quite figure it out, I guess because it needs to parse the directory name, and not just the file name. The closest I got was to get it to recognize the files (instead of invalid errors), but then it was parsing the first character ( 0 ) as the show name.

I hope you can help with this RegExp, as aside from this hiccup, I've found your script to be the best so far for renaming all my tv eps.


Comments and changes to this ticket

  • dbr/Ben

    dbr/Ben September 11th, 2008 @ 07:36 PM

    • State changed from “new” to “wontfix”
    • Assigned user cleared.
    • Tag set to improvement, tvnamer

    Thanks for the ticket!

    Grabbing the filename and such from folder names is something I'm aware of, but I don't really plan to implement - there are far too many variations and potential problems, for a relatively small issue.

    If you allow the showname in the directory structure, do you also support "Show name/season 2/01x02.avi"? How do you know if it should be called "Show Name - [02x02]" not "Season 1 [01x02]". Quite a few downloads that I've seen in this format end up with useless parent-directory names, or are in a generally weird format that could potentially match (last one I saw was in "Showname/10_File_name.avi"). Does it automatically look at the folder name if it can't match the files using the default regex, or do you have to explicitly enable it with a flag? There's also the potential for a lot of false positives matches (files that aren't episodes being flagged as such)

    Basically, I don't feel it's important enough to add, given the complexity and usability-problems it'll add to the script (which I'm trying to keep as simple as possible)

    As a workaround for these files, I recommend is using something like Renamer4Mac, ReNamer (Windows), or Metamorphose (Linux)

    Then just prepend the Showname to the files (for example, the rule in Renamer4Mac is "Insert/Overwrite. Insert text: showname. As position:1 from right". Drag the files in and click one button.. Then process the files as usual.

    Of course you could manually prepend the show name instead!

    All that said, if you wish to add this yourself, you would have to modify the processNames function. Basically in the else: section of the if match:, check filepath and filename - if possible, grab the correct showname, seasno and epno variables, and append them to allEps like is done in the if main: block.

    If you manage to do it in a nice, fairly clean way, feel free to submit the code here (as a patch, say), or fork the project on github and send me a pull request!

  • dzv

    dzv September 11th, 2008 @ 08:17 PM

    Thanks for your prompt and comprehensive reply. I see your point. I hadn't really thought about all the potential problems with parsing folder names. In that case, I agree that a batch file renamer (or even a shell script) to prepend the show names is a perfectly fine alternative.

    I'm really not a programmer, so I wouldn't have much chance of being able to write this into your code. I've never even coded in Python before.

    Thanks for the great script, and I look forward to whatever enhancements you have planned.

  • dbr/Ben

    dbr/Ben September 30th, 2008 @ 09:06 PM

    No problem - If you've taken the time to file a ticket, the least I can do is explain why I wont implement it!

    Out of interest, how did you come across tvnamer?

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

People watching this ticket