Page 1 of 2
Lots of questions about basic custom formats
Posted: 10 May 2016, 20:12
by macdalor
Hi, this is a special request...I am no developer trying to create a script and wasting lots of time because cannot really put myself into it, mainly because of kids and general busy life...
so I was asking myself wether or not a scripts could be created for me by someone who knows and understand more than I do...
I bought the GUI version and have been using it manually to rename multimedia files but would now like to integrate an automatic script to my QNAP NAS in order to rename and move files without manual intervention, ready to be accessed from my PLEX server.
I download multi-language (mainly english, french & spanish) files into a specific folder ("download") and the script should (of course) only rename and move fully downloaded files.
The script requirements are:
- Rename english, french and spanish movies, series and animes to the french title if an original french movie, in the original Spanish title for a Spanish movie and in English for any others even if the original title isn't English (it could be a Japanese, German etc).
- Once all renamed, move files to specific folders according to type and language ("Films" folder for french movies, "Movies" for English movies etc..)
- "Animation" genre movies should be moved together with "animes" in a "animes" folder for french ones, "cartoons" folder for english ones and "dibujos" folder for spanish ones.
- Series are also separated between those 3 languages
- Audio should simply go to an "Audio" folder and be grouped in artists folders, except for compilations which go into a "compilation" folder.
- There are a few specific "Actors" folders where movies from these actors are moved to specific folders named after the particular actor.
The renaming is simply to enable "plex reading" so nothing fancy is required, just title and year.
I think that's it but if anyone thinks of anything important I forgot then feel free to comment
Thank you for anyone taking part in this

Re: Script creation for non developper
Posted: 11 May 2016, 05:29
by rednoah
So here's a thing you need to get done first:
1.
Current Downloads / Completed Downloads must be separated into different folders. That'll save you a lot of trouble, and shouldn't be hard to do depending on what download programs you're using
2.
QNAP needs to support running scheduled tasks (i.e. run shell scripts in intervals). Not sure if QNAP has a GUI for that though, or just cron. On Synology DSM it's called Task Scheduler.
3.
macdalor wrote:- Rename english, french and spanish movies, series and animes to the french title if an original french movie, in the original Spanish title for a Spanish movie and in English for any others even if the original title isn't English (it could be a Japanese, German etc).
- Once all renamed, move files to specific folders according to type and language ("Films" folder for french movies, "Movies" for English movies etc..)
- "Animation" genre movies should be moved together with "animes" in a "animes" folder for french ones, "cartoons" folder for english ones and "dibujos" folder for spanish ones.
- Series are also separated between those 3 languages
- Audio should simply go to an "Audio" folder and be grouped in artists folders, except for compilations which go into a "compilation" folder.
- There are a few specific "Actors" folders where movies from these actors are moved to specific folders named after the particular actor.
This is all in the format. I can help with that. I will need some examples (i.e. filenames) and expected output paths.
Re: Script creation for non developper
Posted: 11 May 2016, 15:52
by macdalor
thank you for your help Rednoah!
1. I actually already have this set up, just didn't mention it in my post
2. I am currentl checking this out as QNAP works with CRON and I'm not sure wether there is a GUI version of this but will find a solution.
3. filenames will really be any movie/animes/series files I download via torrent so could be anything ...
Also, I can identify and manage the output path in the script.

Re: Script creation for non developper
Posted: 11 May 2016, 17:15
by rednoah
2.
Start with calling the
amc script on a schedule:
You're gonna have to set your scheduler to run this command once per day:
Code: Select all
filebot -script fn:amc "/path/to/input" --output "/path/to/output" --action duplicate -non-strict --log-file amc.log --def excludeList=amc.txt
You can try this first, once it's working, you can try customizing the output format.
3.
Since you didn't give me any file names to test with,
the following formats are untested.
Here's a few snippets:
Code: Select all
{languages[0] =~ 'Spanish|French' ? localize[languages[0]].name : n}
Code: Select all
{languages[0] =~ 'French' ? genres =~ /Animation/ ? 'Animes' : 'Films' : genres =~ /Animation/ ? 'Cartoons' : 'Movies'}
This one is based on known "spoken languages" as has been entered on TheMovieDB. For series, this won't work because TheTVDB doesn't have that information. Audio streams of MKV/MP4 files may be tagged with language information, so we may be able to make it work with that.
I assume that by "compilation" you mean
{album}.
These are the freebies, for a complete solution (and continuous help with that) I'll be charging 50-75 USD.

Re: Script creation for non developper
Posted: 11 May 2016, 18:58
by macdalor
rednoah wrote:2.
These are the freebies, for a complete solution (and continuous help with that) I'll be charging 50-75 USD.
Ok thx Rednoah, I'll give a try to all these newbies...Now I don't want to be a tight ars but given that I've already bought your 10euro GUI app maybe we can come to better arrangement

Re: Script creation for non developper
Posted: 11 May 2016, 19:31
by rednoah
2.
Well, that's the difference between me making FileBot better for everyone (free), and me working for you specifically on a problem that benefits only you (very expensive).
I think it's reasonable to assume that it'll take at least 1-2 hours until it works exactly the way you want. Assuming you're living in France, what would you a pay a freelance software engineer for 1-2 hours of work? Make me an offer.
For your reference,
last time it was 100 EUR, but that one was a bit more complicated.
3.
Plenty of
formats you can copy & paste. Plenty of people are perfectly happy with those.

Re: Script creation for non developper
Posted: 11 May 2016, 19:51
by macdalor
rednoah wrote:Well, that's the difference between me making FileBot better for everyone (free), and me working for you specifically on a problem that benefits only you (very expensive).
I think it's reasonable to assume that it'll take at least 1-2 hours until it works exactly the way you want. Assuming you're living in France, what would you a pay a freelance software engineer for 1-2 hours of work? Make me an offer.
For your reference,
last time it was 100 EUR, but that one was a bit more complicated.
First of all I live in Madrid (spain), not France, much cheaper
Anyway, I'm not trying to value your work which I think is excellent given what you've already achieved with filebot (hence me buying the app); what I'm asking is help to create a small script (I think, compare to what some users here are creating) which I am of course willing to donate against as mentioned in my private post...
As I said I'll first work on the steps you've mentioned above and we'll chat later about the rest

Re: Script creation for non developper
Posted: 11 May 2016, 20:25
by rednoah
Well, lucky for you, you don't need a script. The amc script would be a few months of full time employment. Lucky for you it's already there.
The only thing you might need is a quite complicated custom format. However, the amc script has very reasonable default formats and it'll work out of the box. Just not exactly the way you describe in the OP.
Personally, I'd recommend sticking to the defaults. They're defaults for a reason.
Re: Script creation for non developper
Posted: 12 May 2016, 13:25
by rednoah
Your OP does contain a few interesting problems for which there isn't many examples here in the forums yet.
This post might help you and others that want to express this kind of logic as filebot format:
viewtopic.php?f=4&t=3761
Re: Script creation for non developper
Posted: 12 May 2016, 15:37
by macdalor
rednoah wrote:Your OP does contain a few interesting problems for which there isn't many examples here in the forums yet.
This post might help you and others that want to express this kind of logic as filebot format:
viewtopic.php?f=4&t=3761
nice one Rednoah! I have actually been searching hard before posting so I appreciate this additional info... I am still working on this, VI editing (needed for the scheduled task) is a pain in the butt! but I'll get there...

Re: Script creation for non developper
Posted: 12 May 2016, 16:14
by rednoah
1.
Prototyping the format is definitely something you want to do in the FileBot GUI.
2.
Passing in command-line arguments via text files will save you a lot of headache:
viewtopic.php?f=3&t=3244
Re: Script creation for non developper
Posted: 12 May 2016, 17:47
by macdalor
testing out
Code: Select all
{languages[0] =~ 'Spanish|French' ? localize[languages[0]].name : n}
it works quite well; the only thing is that in my test I have a movie called "flic ou voyou" (
https://www.themoviedb.org/movie/40420-flic-ou-voyou) and since the beginning of my this movie either receives an english title (Flic (2005)) or a chinese title (フリック).
Do I need to do something in themoviedb for this to work?
EDIT: also tested
Code: Select all
{languages[0] =~ 'French' ? 'French Films' : 'Movies'}
and it renames the files as "french films" and "movies" instead of moving them into folders...
Re: Script creation for non developper
Posted: 12 May 2016, 18:50
by rednoah
1.
If a movie is not identified correctly in the first place, there is nothing you can do about that in the format. Also, I don't think the Chinese name is written in Japanese Katakana.
2.
Look at the code and think. Does it look like it describes the whole path?
Re: Script creation for non developper
Posted: 12 May 2016, 19:22
by macdalor
rednoah wrote:1.
If a movie is not identified correctly in the first place, there is nothing you can do about that in the format. Also, I don't think the Chinese name is written in Japanese Katakana.
ok
rednoah wrote:2.
Look at the code and think. Does it look like it describes the whole path?
my lack of coding knowledge is showing here...
I've added a "/" in front of "French Films" & "Movies" and resulted in each files being renamed "French Films" or "Movies" and placed into a folder each named the movies title...
As you said there are few examples of this around, making it hard for people like me to gather what to do, even if, I guess, this is basic coding...so sorry about this

Re: Script creation for non developper
Posted: 12 May 2016, 20:49
by macdalor
Code: Select all
{languages[0] =~ 'French' ? 'French Films' : 'Movies'}
So trying to analyse this and as I understand it means:
localising languages, if french then move to French films folder else to Movies.
I must be missing something because I can't make it work...give me a hint please

Re: Script creation for non developper
Posted: 13 May 2016, 03:44
by rednoah
Code: Select all
IF Spoken Language #1 is "French", THEN print "French", ELSE print "Movies".
This is literally what the code says, and it doesn't magically do anything other than that.

Re: Script creation for non developper
Posted: 13 May 2016, 03:47
by macdalor
ok, so I must have misinterpreted your post comment then...
If primary spoken language is French, move to "French Films" folder, or "Movies" folder otherwise:
Code: Select all
{languages[0] =~ 'French' ? 'French Films' : 'Movies'}
Re: Script creation for non developper
Posted: 13 May 2016, 03:51
by rednoah
I just added that one for you. I guess I'll remove that example then.

Re: Script creation for non developper
Posted: 13 May 2016, 03:54
by macdalor
What am I missing with the following then?
Code: Select all
{languages[0] =~ 'French' ? '/Films' : '/Movies'}
Re: Script creation for non developper
Posted: 13 May 2016, 05:22
by rednoah
If you want your output path to consist of anything other than "/Films" or "/Movies", than all of that is missing.
@see
http://www.filebot.net/naming.html
Re: Script creation for non developper
Posted: 13 May 2016, 10:15
by macdalor
I don' t want anything else as i am working in the same folder but as i commented before this renames each file films or movies and puts it in its own folder named the movie title...
Re: Script creation for non developper
Posted: 13 May 2016, 10:36
by rednoah
A typical movie format might look like this:
If these simple formats don't make sense, then just play with it in the Format Editor until you understand how it works. It's really not that difficult.
If you still feel that it is too difficult, then the custom format features just aren't for you, and you'll have to make due with the built-in formats. I recommend using
{plex} for everything.
Re: Script creation for non developper
Posted: 13 May 2016, 14:07
by macdalor
I must be badly explaining myself. I have a low level understanding of the custom formating but not that low
The output of the {languages[0] =~ 'French' ? 'French Films' : 'Movies'} script isn't what you say should be. It creates a folder for each movie instead of 1 named French Films and 1 named Movies.
Re: Script creation for non developper
Posted: 13 May 2016, 14:58
by rednoah
1.
macdalor wrote:It creates a folder for each movie instead of 1 named French Films and 1 named Movies.
You understand that this code could not possibly output anything other than "Films" or "Movie" (or nothing if there is an error) right? It could not possibly ever output a folder named after the movie name, not even if you tried a billion trillion times:
Code: Select all
{languages[0] =~ 'French' ? 'French Films' : 'Movies'}
If you make extremely unbelievable claims, then you should at least have included examples, explain what you're doing, and added screenshots.
2.
rednoah wrote:This one is based on known "spoken languages" as has been entered on TheMovieDB.
Guess what happens if that information has not been entered yet.
If somehow you only tested with extremely rare movies that nobody cares about, then it is very likely that
languages will be empty since nobody has bothered to enter the data, which means there will be an error when you try to get the first language.
@see
viewtopic.php?f=5&t=1895
PS: This is the kind of stuff you figure out by playing with it. Trial and error (with more than one single test file) until you figure it out.

Re: Lots of questions about basic custom formats
Posted: 13 May 2016, 16:34
by macdalor
I'm out until tuesday but i'll send you screen prints of the result i'm talking about at my return. I did try quite a bit with various files, not billio s times thats for sure

chat on tuesday
