Page 1 of 1

Groovy for Books and Comics

Posted: 05 Mar 2015, 08:58
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

Re: Groovy for Books and Comics

Posted: 05 Mar 2015, 09:41
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.

Re: Groovy for Books and Comics

Posted: 05 Mar 2015, 13:10
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

Re: Groovy for Books and Comics

Posted: 05 Mar 2015, 13:12
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

Re: Groovy for Books and Comics

Posted: 05 Mar 2015, 13:21
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

Re: Groovy for Books and Comics

Posted: 05 Mar 2015, 15:23
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.

Re: Groovy for Books and Comics

Posted: 07 Mar 2015, 21:53
by plittlefield
Thanks rednoah for your suggestions - my own script is working just fine :-)