Page 1 of 1
Move files from CLI after rename ?
Posted: 29 Dec 2016, 11:58
by boboch
Hi all,
I just discovered filebot (shame on me, i know) rename part works really great !
I wonder if there is a way to do more little tricks with CLI part of the program on my debian server.
Architecture:
/mnt/volume1/telechargements => folder to download files
/mnt/volume1/videos/series => folder to TV Show files
- -/mnt/volume1/videos/series/Dexter/Saison 1
-/mnt/volume1/videos/series/The Walking Dead/Saison 1
-/mnt/volume1/videos/series/StartUp/Saison 1
- etc...
/mnt/volume1/videos/films => folder to movies files
What i would like to do:
1-After rename by filebot, if file is a Movie then move it to movies folder from download folder
2- If TV show then move it to TV show folder while keeping my current tree and create it if doesn't exist, e.g:
I already have "The Walking Dead", and sub directory "Saison 1", if filebot rename a new episode from Season 2 then create sub directory "Saison 2" and move file into it.
Is there a way to do that or is too little tricky for CLI ?
Thanks!
Re: Move files from CLI after rename ?
Posted: 29 Dec 2016, 12:26
by rednoah
Did you read FAQ #1 yet? It's just a matter of passing in the
--format you want.
e.g.
Code: Select all
--output "/mnt/volume1/videos" --format "{plex}"
Re: Move files from CLI after rename ?
Posted: 01 Jan 2017, 18:54
by boboch
Hi rednoah,
I read the FAQ, i only use CLI, but i don't really understand where i can put this different argument.
e.g. with Chuck S01E05.mkv in "telechargements" folder
Code: Select all
filebot -rename -r -non-strict /mnt/volume1/telechargements/ --output "/mnt/volume1/videos" --format "{plex}" --lang fr
This one, make the job perfectly, but create new folder and subfolder (TV Show/Chuck/Season 01/), but i already have it (videos/series/Chuck/Saison 1) and don't want filebot make a new one if one already exist.
I think i should use naming scheme, but don't understand really how it works
Is there any space where i can found some example of
complete CLI ?
Thanks
PS: HAPPY NEW YEAR (from France) !

Re: Move files from CLI after rename ?
Posted: 01 Jan 2017, 19:06
by rednoah
Yes, you should use a custom naming scheme.
Use the GUI to prototype your custom naming scheme:
Reusing bits and pieces of the
{plex} binding might be helpful:
viewtopic.php?f=5&t=4116
Re: Move files from CLI after rename ?
Posted: 02 Jan 2017, 09:43
by boboch
Thanks for answer.
I found the solution, i use the amc script:
Code: Select all
filebot -script fn:amc --output "/mnt/volume1/videos" --action move -non-strict "/mnt/volume1/telechargements/" --def "seriesFormat=/mnt/volume1/videos/series/{n}/{'Saison '+s}/{n} - {s00e00} - {t}" "movieFormat=/mnt/volume1/videos/films/{n} - ({y})" "animeFormat=/mnt/volume1/videos/animations/{n} - ({y})" --lang fr
I made a incron task for new files into "/mnt/volume1/telechargements/" which call a little bash script (2 lines) for chown new files and execute the above filebot CLI, my first chown command is execute when a new files appear into the watched folder, the filebot CLI, does not BUT when i execute manually my script, everything works fine.
Any recommendations ?
Re: Move files from CLI after rename ?
Posted: 02 Jan 2017, 13:31
by rednoah
1.
rednoah wrote:Note that if you call this script in intervals every hour or every day you must set --def excludeList or you will get banned.
--def excludeList is absolutely mandatory if you're doing what you're doing!
2.
You can use the
--def exec option to chown newly processed files or folders.
Re: Move files from CLI after rename ?
Posted: 02 Jan 2017, 22:32
by boboch
1- yes, i add the following --def excludeList=amc.txt
2- I try different way to be able to run my script with an incron task, but the filebot command does not execute...
Here my incron task:
Code: Select all
/mnt/volume1/telechargements IN_CLOSE_WRITE /opt/Script/chown_rename.sh
Here my script with no chown command but chown command inside filebot CL with "--def exec=" :
Code: Select all
#!/bin/bash
echo $PATH
/usr/bin/filebot -script fn:amc --output "/mnt/volume1/videos" --action move -non-strict "/mnt/volume1/telechargements/" --def "seriesFormat=/mnt/volume1/videos/series/{n}/{'Saison '+s}/{n} - {s00e00} - {t}" "movieFormat=/mnt/volume1/videos/films/{n} - ({y})" "animeFormat=/mnt/volume1/videos/animations/{n} - ({y})" --lang fr --def excludeList=amc.txt --def exec="chown qwrty:qwrty '{file}'"
Nothing is happening, expect syslog entry for both case.
Without:
Code: Select all
#!/bin/bash
echo $PATH
chown -R /mnt/volume1/telechargement
/usr/bin/filebot -script fn:amc --output "/mnt/volume1/videos" --action move -non-strict "/mnt/volume1/telechargements/" --def "seriesFormat=/mnt/volume1/videos/series/{n}/{'Saison '+s}/{n} - {s00e00} - {t}" "movieFormat=/mnt/volume1/videos/films/{n} - ({y})" "animeFormat=/mnt/volume1/videos/animations/{n} - ({y})" --lang fr --def excludeList=amc.txt
Only chown is execute.
Syslog entry:
Code: Select all
Jan 2 23:18:12 LINOLOGY incrond[21804]: (root) CMD (/opt/Script/chown_rename.sh)
When i execute manually the script everything works fine...
Re: Move files from CLI after rename ?
Posted: 03 Jan 2017, 05:19
by rednoah
Did you confirm that FileBot is even called in the first place?
viewtopic.php?f=4&t=3067
PS:
--log-file amc.log is mandatory as well
(unless you take care of IO redirection and synchronisation yourself).
Re: Move files from CLI after rename ?
Posted: 03 Jan 2017, 17:16
by boboch
Ok, so after debug, i feel like an idiot...
The output said me: "$HOME must be define"
So i add the following line to my script: export HOME=/root
Everything works good now !
Many thanks rednoah.