Groovy for Books and Comics

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
plittlefield
Posts: 101
Joined: 09 Mar 2014, 19:15

Groovy for Books and Comics

Post by plittlefield »

Hi Folks

I currently use the amc.groovy to automate the renaming and moving of Movies and TV Shows.

Is there a way to edit this so that it just moves *.epub, *.pdf to a particular folder when it has downloaded?

I am using Ubuntu Linux with Transmission and the latest FileBot.

Thanks.

Paully
User avatar
rednoah
The Source
Posts: 23132
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Groovy for Books and Comics

Post by rednoah »

You can try enabling --def unsorted=y and see if you like it.

The unsorted format can't be modified currently without editing the script, but that'd be an easy fix.
:idea: Please read the FAQ and How to Request Help.
plittlefield
Posts: 101
Joined: 09 Mar 2014, 19:15

Re: Groovy for Books and Comics

Post by plittlefield »

Hi Rednoah

Thanks for that.

Sorry, bit of a newbie, how do I integrate that with my current script and tell it to put certain files in certain places?

e.g.

*.epub --> ~/Downloads/Books
*.pdf --> ~/Downloads/Magazines
*.cbr --> ~/Downloads/Comics

My current script which is run when Transmission completes a download is...

Code: Select all

/usr/bin/filebot -script "/home/paully/Bin/amc_paully.groovy" --output "/home/paully/Videos" --log-file "/home/paully/.filebot/logs/amc_paully.log" --action copy --conflict override -non-strict --def subtitles=en artwork=y clean=y xbmc=localhost "ut_dir=$TR_TORRENT_DIR/$TR_TORRENT_NAME" "ut_kind=multi" "ut_title=$TR_TORRENT_NAME"
...which puts all the Movies and TV Shows in their folders in my ~/Videos directory.

Thanks for your expertise.

:-)

Paully
plittlefield
Posts: 101
Joined: 09 Mar 2014, 19:15

Re: Groovy for Books and Comics

Post by plittlefield »

...and the part of the groovy script which does the magic is...

Code: Select all

def format = [
        tvs:   tryQuietly{ seriesFormat } ?: '''TV/{n}/{n} {s00e00}''',
        anime: tryQuietly{ animeFormat  } ?: '''Anime/{n}/{n} - {sxe} - {t.replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, "'").replacePart(', Part $1')}''',
        mov:   tryQuietly{ movieFormat  } ?: '''Movies/{n} ({y})/{n} ({y}){" CD$pi"}{".$lang"}''',
        music: tryQuietly{ musicFormat  } ?: '''Music/{n}/{album+'/'}{pi.pad(2)+'. '}{artist} - {t}'''
]
Paully
plittlefield
Posts: 101
Joined: 09 Mar 2014, 19:15

Re: Groovy for Books and Comics

Post by plittlefield »

Having thought about it, I could just write a BASH script to do what I want at a specific time of the day... it would be nice if FileBot did it - like defining entries for 'books', 'comics' and 'magazines' then not doing any fancy renaming and just copy them to a specific folder... but I don't know enough about groovy to do it :-(

I guess this would work in the meantime...

Code: Select all

find ~/Downloads/transmission -type f -name *.epub -exec cp {} ~/Downloads/Books/ \;
What do you think?

Paully
User avatar
rednoah
The Source
Posts: 23132
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Groovy for Books and Comics

Post by rednoah »

Running your own scripts first to deal with those files is probably easiest.

Alternatively you can change the format that is used for unsorted files, which by default is just Unsorted/{fn}.{ext} but could easily be changed to some other logic of your choosing.
:idea: Please read the FAQ and How to Request Help.
plittlefield
Posts: 101
Joined: 09 Mar 2014, 19:15

Re: Groovy for Books and Comics

Post by plittlefield »

Thanks rednoah for your suggestions - my own script is working just fine :-)
Post Reply