Page 1 of 1

Rename TV Episodes - w/out moving to "standard"dir structure

Posted: 21 Sep 2013, 17:00
by davidh2k
Hello,

I'm trying to setup a (fully) automated pyload download station.
I tested around a bit with some scripts but I have not yet found the one that serves my needs.
Because I have a "special" folder structure for my TV shows, e.g.: "../Serien/0-C/Anger Management/Staffel 2 EN 1080p", a standard script that moves to the common destination folder structure does not fit my needs.

So I checked this script (housekeeping): http://www.filebot.net/forums/viewtopic ... 4&t=5#p132
I used it with the TV show flag and then it worked but unfortunatly it moves the file into a obvious tv series structure (e.g.: "../Medien/TV Shows/Anger Management/Season 2").

It would fit my needs if the script would just rename (if someone knows how to correctly implement it into pyload too, that would be awesome, i checked a userscript before that didn't work) and place it inside the TV Series Folder ("../Serien/"), that would be really awesome.

Edit: My filestructure is the following (replacing ":" with " -" for series like NCIS: Los Angelas)

Code: Select all

{n.replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, "'").replace(':',' -')} - {s00e00} - {t.replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, "'")}

Anger Management - S02E34 - Charlie and the Sting
Greetings
David

Re: Rename TV Episodes - w/out moving to "standard"dir struc

Posted: 21 Sep 2013, 18:23
by rednoah
You can always pass in your own format expression. Anything you can think of is supported, usually without much code.

Did you means something like this?
http://www.filebot.net/forums/viewtopic.php?f=5&t=910

Re: Rename TV Episodes - w/out moving to "standard"dir struc

Posted: 21 Sep 2013, 19:01
by davidh2k
Not really, no. Because I don't have all 26 letters but just grouped them into (Due to the reason that I often just browse my library directly, without using the xbmc library, but rather via the smb/nfs share, that makes it easier)
0-C
D-L
M-R
S-T
U-Z

The parent folder is called "Serien". It would be fine if renamer would just drop the files there after renaming.
The deeper Folder structure is: SeriesName/Staffel 1 DE + EN 1080p/file.mkv

Greetings
David

Edit: Also the structure for the season may differ from season to season, depending if its only english, only german, both languages, and if its 720p or 1080p. But as I'm writing I may think it is best to drop these schemes but that I would run into trouble if I had to manage this via txt files... :(

Quintessence: renaming the files after download and moving them to .../Serien/ would suffice, I guess. From there I would move them myself via drag and drop.

Re: Rename TV Episodes - w/out moving to "standard"dir struc

Posted: 21 Sep 2013, 19:59
by rednoah
You can build relative or absolute paths with the naming scheme. Rename/Move/Sort them into any structure.

Another example:
Sort into multiple drives based on initial letter:

Code: Select all

{n[0].match((~/(?i)[0-9a-f]/):'X', (~/(?i)[g-t]/):'Y') ?: 'Z'}:/TV/{n}/{episode}
Drive X if first letter of {n} matches [0-9a-f], Drive Y for [g-t] and Drive Z for everything else.
So can one sort files into simple show/season/episode folders? Yes.
Can one sort files into arbitrarily complex folder structure? Yes.

Point is, anything is possible, though you seem to be quite fuzzy on what it is you actually want. :D

PS: I'm pretty sure you haven't watch the video tutorial => http://www.youtube.com/watch?v=zcSFKiwFLZw

Re: Rename TV Episodes - w/out moving to "standard"dir struc

Posted: 21 Sep 2013, 20:33
by davidh2k
Na... not so fuzzy but rather scared of setting it up so complicated, because my order/file structure is so complicated.

So, lets say I would set it up to put it into the correct folders, I would have the problem that filebot may stumbles accross two folders for one season - one for the english (newest) episodes and one for the DL (maybe started 3-6 months later) files. I guess that would be just too complicated to setup.

So what about just renaming and moving in to the parent folder called ".../Serien/"? ;) If I get that running that would be a huge benefit for me. Moving into the correct folder manually with dragndrop would be no hassle for me!

PS: Thanks for the Video but that doesnt add anything to my knowledge that I need right now I guess.


Greetings
David

Re: Rename TV Episodes - w/out moving to "standard"dir struc

Posted: 21 Sep 2013, 20:47
by rednoah
Sure, like you said. So what's not working?

Code: Select all

filebot -rename . --db thetvdb --format "../TV/{n} {sxe} {t}"

Re: Rename TV Episodes - w/out moving to "standard"dir struc

Posted: 21 Sep 2013, 21:02
by davidh2k
I guess I have to polish your shoes now, thats exactly what I need. But, when I now try to use my syntax that I already setup on my win machine to cleanup ":" to " -" and all the other sentence marks, I get into trouble because of the multiple "".

Code: Select all

filebot -rename . --db thetvdb --format "/root/{n.replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, "'").replace(':',' -')} - {s00e00} - {t.replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, "'")}"
You may slap me in the face, I guess you have a correct code snippet for that too?

Greetings
David

PS: Don't mind the /root/, testing in a VM!

Edit: When I execute the command above, it just drops into filebot I think:

Code: Select all

root@debian:~/.pyload/Downloads/haven.s04e02.repack.720p.hdtv.x264-2hd.mkv# filebot -rename . --db thetvdb --format "/root/{n.replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, "'").replace(':',' -')} - {s00e00} - {t.replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, "'")}"
>

Re: Rename TV Episodes - w/out moving to "standard"dir struc

Posted: 21 Sep 2013, 21:27
by rednoah
FAQ wrote:Q: I'm trying to run FileBot from the console, but I'm having trouble passing in --format because of spaces or double-quotes
A: You need to pass in arguments correctly. "..." allows you to pass in one argument that may contains spaces. Of course since " is a special character in argument parsing you'll need to escape each " with \" if you want to pass in the literal value. e.g. "This is called \"escaping\"." will pass in this sentence as one argument.

Re: Rename TV Episodes - w/out moving to "standard"dir struc

Posted: 21 Sep 2013, 21:32
by davidh2k
Ah yeah escaping... my bad, but this doesn't seem to work.

Code: Select all

root@debian:~/.pyload/Downloads/haven.s04e02.repack.720p.hdtv.x264-2hd.mkv# filebot -rename . --db thetvdb --format "/root/{n.replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, \"'\").replace(':',' -')} - {s00e00} - {t.replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, \"'\")}"
-bash: command substitution: Zeile 1: Syntaxfehler beim unerwarteten Wort `)'
-bash: command substitution: Zeile 1: `´‘’ʻ]/, "'").replace(':',' -')} - {s00e00} - {t.replaceAll(/[!?.]+$/).replaceAll(/['
Rename episodes using [TheTVDB]
Auto-detected query: [haven]
Fetching episode data for [Haven]
[MOVE] Rename [/root/.pyload/Downloads/haven.s04e02.repack.720p.hdtv.x264-2hd.mkv/Haven 4x02 Survivors.mkv] to [/root/Haven.mkv]
Processed 1 files
Done ヾ(@⌒ー⌒@)ノ
Greetings
David

Re: Rename TV Episodes - w/out moving to "standard"dir struc

Posted: 21 Sep 2013, 21:39
by rednoah
U need more escaping. The character ` is a bash special character. So is $ btw.

@see https://www.gnu.org/software/bash/manua ... ution.html

Re: Rename TV Episodes - w/out moving to "standard"dir struc

Posted: 21 Sep 2013, 21:46
by davidh2k
Thank you rednoah, if you're are no programer your are not used to these kind of things. I apprecciate your help.

It works now correctly. I'm trying now to integrate it into pyload.

Again, many many thanks.

Greetings
David