sort series movies with genre in different folder

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
TheTaran
Posts: 2
Joined: 21 Nov 2023, 09:55

sort series movies with genre in different folder

Post by TheTaran »

Hi everybody
I have seen a lot of topics in witch peaplo sort there movies / series.
I have a special case.

Folders:
V:\1 Action - Thriller - Fantasy\
V:\2 Fun & Love\
V:\3 Comic\
V:\5 Serien\
V:\6 Serien Kinder\

is it possible to define a list of gernes and file bot uses this kind of list to then move the files to the folder with that genres?

The actual code cant do that and is executed in Windows by a cmd file.

Shell: Select all

filebot -script fn:amc "V:/0 TempZip/" --output "V:/0 TempNamed/" --action MOVE --conflict auto -non-strict --lang DE --log-file "V:/0 TempZip/amc.log" ^
--def movieDB=TheMovieDB seriesDB=TheMovieDB::TV animeDB=TheMovieDB::TV ^
--def movieFormat="{n} ({y}) {ac} - {aco} - {vf} - {hdr} - {vc}" ^
--def seriesFormat="{n}/{'Season '+s}/{n} - {s00e00} - {t} - {vf}" ^
--def animeFormat="V:/4 Serien Anime/{n}/{'Season '+s}/{n} - {s00e00} - {t} - {vf}" ^
--def subtitles=DE
--def clean=y
User avatar
rednoah
The Source
Posts: 22839
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: sort series movies with genre in different folder

Post by rednoah »

Yes, you can use {genres} to access the list of genres from the database and the generate file paths accordingly.


e.g. Conditional Structures (if-then-else)
rednoah wrote: 03 Oct 2016, 18:53 e.g. Move Documentary episodes and normal TV series episodes into different folders:

Format: Select all

{ genre ==~ /Documentary|News/ ? 'Documentaries' : 'TV Shows' }


:idea: Also, you'll want to use @file syntax for reading command-line arguments from external text files.



:idea: Many have done what you're trying to do. Collection and Genre sorting script might be useful as you will likely run into the same problems.
:idea: Please read the FAQ and How to Request Help.
TheTaran
Posts: 2
Joined: 21 Nov 2023, 09:55

Re: sort series movies with genre in different folder

Post by TheTaran »

I tried to create the file like this. (ore i am understanding the syntax wrong! :) )
Script to start the filebot

Shell: Select all

filebot -script fn:amc "V:/0 TempZip/" --output "V:/" --action MOVE --conflict auto -non-strict --lang DE --log-file "V:/0 TempZip/amc.log" @"C:/Program Files/FileBot/personalscript/filebotargs.txt" ^
--def movieDB=TheMovieDB seriesDB=TheMovieDB::TV animeDB=TheMovieDB::TV ^
--def movieDB=TheMovieDB seriesDB=TheMovieDB::TV animeDB=TheMovieDB::TV ^
--def movieFormat="{n} ({y}) {ac} - {aco} - {vf} - {hdr} - {vc}" ^
--def seriesFormat="{n}/{'Season '+s}/{n} - {s00e00} - {t} - {vf}" ^
--def animeFormat="V:/4 Serien Anime/{n}/{'Season '+s}/{n} - {s00e00} - {t} - {vf}" ^
--def clean=y ^

Content of the @"C:/Program Files/FileBot/personalscript/filebotargs.txt" file.

Shell: Select all

if {
{ genre ==~ /action|drama|Crime|Horror|Adventure|Fantasy|Martial Arts|Mystery|Thriller|Science Fiction/ ? 'V:/1 Action - Thriller - Fantasy/'}
{ genre ==~ /Musical|Love|Family|Comedy/ ? 'V:/2 Fun & Love/'}
{ genre ==~ /Animation|Children/ ? 'V:/3 Comic/'}
{ genre ==~ /Anime|/ ? 'V:/4 Serien Anime/'}
{ genre ==~ /action|drama|Crime|Horror|Adventure|Fantasy|Martial Arts|Mystery|Thriller|Science Fiction/ ? 'V:/5 Serien/'}
{ genre ==~ /Animation|Children/ ? 'V:/6 Serien Kinder/'}
else {
		return V:/0 TempNamed
	}
But something doesn't work... :/

Shell: Select all

C:\Program Files\FileBot\personalscript>jdownloader-postprocess.cmd
if {: No Such File: C:\Program Files\FileBot\personalscript\if {
{ genre ==~ /action|drama|Crime|Horror|Adventure|Fantasy|Martial Arts|Mystery|Thriller|Science Fiction/ ? 'V:/1 Action - Thriller - Fantasy/'}: No Such File: Trailing char < > at index 11: { genre ==~ /action|drama|Crime|Horror|Adventure|Fantasy|Martial Arts|Mystery|Thriller|Science Fiction/ ? 'V:/1 Action - Thriller - Fantasy/'}
{ genre ==~ /Musical|Love|Family|Comedy/ ? 'V:/2 Fun & Love/'}: No Such File: Trailing char < > at index 11: { genre ==~ /Musical|Love|Family|Comedy/ ? 'V:/2 Fun & Love/'}
{ genre ==~ /Animation|Children/ ? 'V:/3 Comic/'}: No Such File: Trailing char < > at index 11: { genre ==~ /Animation|Children/ ? 'V:/3 Comic/'}
{ genre ==~ /Anime|/ ? 'V:/4 Serien Anime/'}: No Such File: Trailing char < > at index 11: { genre ==~ /Anime|/ ? 'V:/4 Serien Anime/'}
{ genre ==~ /action|drama|Crime|Horror|Adventure|Fantasy|Martial Arts|Mystery|Thriller|Science Fiction/ ? 'V:/5 Serien/'}: No Such File: Trailing char < > at index 11: { genre ==~ /action|drama|Crime|Horror|Adventure|Fantasy|Martial Arts|Mystery|Thriller|Science Fiction/ ? 'V:/5 Serien/'}
{ genre ==~ /Animation|Children/ ? 'V:/6 Serien Kinder/'}: No Such File: Trailing char < > at index 11: { genre ==~ /Animation|Children/ ? 'V:/6 Serien Kinder/'}
else {: No Such File: C:\Program Files\FileBot\personalscript\else {
return V:/0 TempNamed: No Such File: Illegal char <:> at index 8: return V:/0 TempNamed
}: No Such File: C:\Program Files\FileBot\personalscript\}
User avatar
rednoah
The Source
Posts: 22839
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: sort series movies with genre in different folder

Post by rednoah »

You'll want to prototype your format in the GUI:
Screenshot


Once you have prototyped your format and tested it on a variety of files, then you can paste it into a *.groovy text file and reference it like so:

Shell: Select all

--def movieFormat=@/path/to/MovieFormat.groovy
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 22839
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: sort series movies with genre in different folder

Post by rednoah »

:arrow: :arrow: separate HD, 4K and genre has copy & paste example code for this use case.
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 22839
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: sort series movies with genre in different folder

Post by rednoah »

Yes, your format code can read external files.


e.g. the csv() function can be used to read a CSV file into a Map, the first column being the key:

Format: Select all

{ csv('/path/to/file.csv')[genre] }

:idea: Make sure to use TAB as column separator. Also make sure that the key matches the value of {genre} exactly:

Code: Select all

Action	V:/1 Action - Thriller - Fantasy
:idea: Please read the FAQ and How to Request Help.
Post Reply