Trying to combine these two...

Any questions? Need some help?
Post Reply
User avatar
bonelifer
Power User
Posts: 81
Joined: 23 Mar 2013, 18:27

Trying to combine these two...

Post by bonelifer »

Current TV renaming scheme:

Code: Select all

Y:/Videos/TV/{def a; new File('Y:/incoming/scripts/names.csv').splitEachLine(';'){ if (n == it[0]) a = it[1]}; a ?: n.upperInitial().replaceTrailingBrackets()}/{"Season"} {s.pad(2)}/{def a; new File('Y:/incoming/scripts/names.csv').splitEachLine(';'){ if (n == it[0]) a = it[1]}; a ?: n.upperInitial().replaceTrailingBrackets()} - [{s.pad(2)}x{e.pad(2)}] - {t}
I'd like to add this code to have it put the series on the drive with the most space if the Series doesn't already exist on one of them:

Code: Select all

{["T:", "Y:"].collect{"$it/Videos/TV/$n" as File}.sort{a,b -> a.exists() <=> b.exists() ?: a.root.freeSpace <=> b.root.freeSpace}.last()}/
Tried multiple times to combine them. Still want the renaming capability of the original script for naming the series folder.
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Trying to combine these two...

Post by rednoah »

You just need to create File objects to the series folder on different drives:

This is the key snipped:

Code: Select all

["T:", "Y:"].collect{ drive -> def a; new File('Y:/incoming/scripts/names.csv').splitEachLine(';'){ if (n == it[0]) a = it[1]}; return new File(drive+"/Videos/TV/", a)
Pretty much like this, minus the typos and syntax errors.
:idea: Please read the FAQ and How to Request Help.
User avatar
bonelifer
Power User
Posts: 81
Joined: 23 Mar 2013, 18:27

Re: Trying to combine these two...

Post by bonelifer »

Couldn't figure that out. Plus does that even check to see if the Series folder already exist?
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Trying to combine these two...

Post by rednoah »

Nope, that's just the part you couldn't figure out.

If you paste that into the format I posted you'd get this:

Code: Select all

{["T:", "Y:"].collect{ drive -> def a; new File('Y:/incoming/scripts/names.csv').splitEachLine(';'){ if (n == it[0]) a = it[1]}; return new File(drive+"/Videos/TV/", a) }.sort{ a,b -> a.exists() <=> b.exists() ?: a.diskSpace <=> b.diskSpace }.last()}/{episode}
:idea: Please read the FAQ and How to Request Help.
User avatar
bonelifer
Power User
Posts: 81
Joined: 23 Mar 2013, 18:27

Re: Trying to combine these two...

Post by bonelifer »

I get this error:
ambig.gif
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Trying to combine these two...

Post by rednoah »

Code: Select all

{["T:", "Y:"].collect{ drive -> def a=n; new File('D:/names.csv').splitEachLine(';'){if (n==it[0]) a=it[1]}; return new File(drive+"/Videos/TV/", a)}.sort{ a,b -> a.exists() <=> b.exists() ?: a.diskSpace <=> b.diskSpace }.last()}/{episode}
:idea: Please read the FAQ and How to Request Help.
User avatar
bonelifer
Power User
Posts: 81
Joined: 23 Mar 2013, 18:27

Re: Trying to combine these two...

Post by bonelifer »

Thanks. Works perfectly.
Post Reply