Script works, but takes unfinish download to

Running FileBot from the console, Groovy / FileBot scripting, shell scripts, etc
Post Reply
MickeMM
Posts: 30
Joined: 03 Apr 2019, 10:52

Script works, but takes unfinish download to

Post by MickeMM »

Hello!
Im using this code and everything works. But i have some problem with unfinish downloads that also copies.

Code: Select all

#!/bin/bash
PATH=/root:/usr/bin:/bin:/sbin:/home/micke

filebot -script fn:amc --output "/home/micke/rtorrent/test" --action duplicate --conflict skip -non-strict "/home/micke/rtorrent/download/filmer/svensk_text" --log-file amc_film.log --def excludeList=amc_filmer.txt --def ut_label=Movie --def movieFormat="/home/micke/rtorrent/test/film/{plex}";
filebot -script fn:amc --output "/home/micke/rtorrent/test" --action duplicate --conflict skip -non-strict "/home/micke/rtorrent/download/animerat" --log-file amc_animerat.log --def excludeList=amc_animerat.txt ut_label=Movie --def movieFormat="/home/micke/rtorrent/test/animerat/{plex}";
filebot -script fn:amc --output "/home/micke/rtorrent/test" --action duplicate --conflict skip -non-strict "/home/micke/rtorrent/download/serier" --log-file amc_serie.log --def excludeList=amc_serier.txt --def ut_label=TV --def seriesFormat="/home/micke/rtorrent/test/serie/{plex}";
filebot -script fn:amc --output "/home/micke/rtorrent/test" --action duplicate --conflict skip -non-strict "/home/micke/rtorrent/download/filmer/boxar" --log-file amc_boxar.log --def excludeList=amc_boxar.txt ut_label=Movie --def movieFormat="/home/micke/rtorrent/test/boxar/{plex}";

exit 0
Any solution how i can fix it?
Im using rtorrent and rtorrent-postprocess.sh

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

Re: Script works, but takes unfinish download to

Post by rednoah »

You'll need to separate complete / incomplete downloads. You're calling the amc script so it's your responsibility to not command it to process unfinished downloads. ;)


:idea: Typically, the amc script is called on newly completed downloads only, not your entire downloads folder, that's what the rtorrent-postprocess.sh glue logic script does:
https://github.com/filebot/plugins/blob ... process.sh
:idea: Please read the FAQ and How to Request Help.
MickeMM
Posts: 30
Joined: 03 Apr 2019, 10:52

Re: Script works, but takes unfinish download to

Post by MickeMM »

Thanks!

I have searching but couldn't find any solution for that. I only use rss for my downloads.
Maybe you know?
User avatar
rednoah
The Source
Posts: 19140
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Script works, but takes unfinish download to

Post by rednoah »

If you're using rT, then this:
viewtopic.php?f=4&t=215#p5316

How you pass torrents into rT is irrelevant as far as post-processing scripts are concerned.
:idea: Please read the FAQ and How to Request Help.
MickeMM
Posts: 30
Joined: 03 Apr 2019, 10:52

Re: Script works, but takes unfinish download to

Post by MickeMM »

It is possible to do this, with one line of code?

filebot
-Animated
-All other movies
-TV shows

Thanks!
User avatar
rednoah
The Source
Posts: 19140
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Script works, but takes unfinish download to

Post by rednoah »

Yes, that's how most people use the amc script. Though doing different calls for different types of content isn't a bad idea. Makes it easier to reason about things, and less auto-detection means lower chance on incorrect auto-detection.
:idea: Please read the FAQ and How to Request Help.
MickeMM
Posts: 30
Joined: 03 Apr 2019, 10:52

Re: Script works, but takes unfinish download to

Post by MickeMM »

Thanks!

I have read some links but cant understand really how the script should look like.
I use the code above and dosent know how i should change it.
MickeMM
Posts: 30
Joined: 03 Apr 2019, 10:52

Re: Script works, but takes unfinish download to

Post by MickeMM »

Im trying this, but "Open Season" animated movie goes to moviefolder and not animated folder.

filebot -script fn:amc --output "/home/micke/rtorrent/test" --action duplicate --conflict auto -non-strict "/home/micke/rtorrent/download" --log-file amc_film.log --def excludeList=amc_filmer.txt --def movieFormat="/home/micke/rtorrent/test/film/{plex}" seriesFormat="/home/micke/rtorrent/test/serie/{plex}" animeFormat="/home/micke/rtorrent/test/animerat/{plex}";
kim
Power User
Posts: 1046
Joined: 15 May 2014, 16:17

Re: Script works, but takes unfinish download to

Post by kim »

you cant do this with only {plex}... you need a custom format like this:

Code: Select all

{genres.contains(/Animation/) ? 'animerat/' : 'moviefolder/'}{plex.tail}
output:
animerat/Open Season (2006)/Open Season (2006)
MickeMM
Posts: 30
Joined: 03 Apr 2019, 10:52

Re: Script works, but takes unfinish download to

Post by MickeMM »

kim wrote: 31 Dec 2019, 02:20 you cant do this with only {plex}... you need a custom format like this:

Code: Select all

{genres.contains(/Animation/) ? 'animerat/' : 'moviefolder/'}{plex.tail}
output:
animerat/Open Season (2006)/Open Season (2006)
Thanks for the help.
I cant get it to work, dont know what im doing wrong :(

Code: Select all

filebot -script fn:amc --output "/home/micke/rtorrent/test" --action duplicate --conflict auto -non-strict "/home/micke/rtorrent/download" --log-file amc_film.log --def excludeList=amc_filmer.txt --def movieFormat="/home/micke/rtorrent/test/film/{plex}" seriesFormat="/home/micke/rtorrent/test/serie/{plex}" animeFormat="/home/micke/rtorrent/test/animerat/{genres.contains(/Animation/) ? 'animerat/' : 'Movies/'}{plex.tail}";
Open Season ( https://www.imdb.com/title/tt0400717 ) stil comes in the /test/film/ folder and not /test/animerat
User avatar
rednoah
The Source
Posts: 19140
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Script works, but takes unfinish download to

Post by rednoah »

:!: Anime refers to Japanese Animated TV Series for which episode listings are available on AniDB, and not American Animated Movies which are just movies on TheMovieDB like any other movie.
rednoah wrote: 01 Aug 2012, 13:04 Anime are inherently TV Shows, so Anime will only be detected as Anime and processed with AniDB if the files have Anime-like characteristics.
Does your file have Anime-like characteristics? If yes, it will be processed as Anime, if not it will not be processed as Anime.

Please read the console output carefully. The console output will tell you which path is taken, and which database / format is being used. Presumably, your --def animeFormat isn't used, because none of your content is Anime (i.e. Japanese Animated TV Series, not Animated American Movies).
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 19140
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Script works, but takes unfinish download to

Post by rednoah »

:idea: You are testing your formats in the GUI, before copy & pasting them into your shell script, right? Right? That's how I do it. That's how kim does it. It saves time and energy. ;)

Image
:idea: Please read the FAQ and How to Request Help.
MickeMM
Posts: 30
Joined: 03 Apr 2019, 10:52

Re: Script works, but takes unfinish download to

Post by MickeMM »

Nop! I have not test it in gui, i have ubuntu server.
Ok, so if im understand this correct it wont work to take animated movie and put them in a folder and rest of the movie in moviefolder.
User avatar
rednoah
The Source
Posts: 19140
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Script works, but takes unfinish download to

Post by rednoah »

It's perfectly possible to movie different movies into different folders, based on arbitrary conditions, for example, based {genres}, as explained by kim previously:
viewtopic.php?f=4&t=11323#p47707

Image

:idea: If genres contains Animation, then use Animated Movies folder, otherwise use Movies folder.
:idea: Please read the FAQ and How to Request Help.
MickeMM
Posts: 30
Joined: 03 Apr 2019, 10:52

Re: Script works, but takes unfinish download to

Post by MickeMM »

Thanks for the help. Everything works now.

Code: Select all

filebot -script fn:amc --output "/home/micke/rtorrent/test/" --action duplicate --conflict auto -non-strict "/home/micke/rtorrent/download" --log-file amc_film.log --def excludeList=amc_filmer.txt --def ignore="dansk_text" --def movieFormat="/home/micke/rtorrent/test/{/Animation/ in genres ? 'animerat/Movies' : 'film/Movies'}/{plex.tail}" seriesFormat="/home/micke/rtorrent/test/serie/{plex}";
I only have one problem left :)
This movie https://www.themoviedb.org/movie/602797 hasen't any genre and was placed in /test/ folder (root of output).
User avatar
rednoah
The Source
Posts: 19140
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Script works, but takes unfinish download to

Post by rednoah »

You can catch the "genres is undefined" corner case like so:

Code: Select all

{any{/Animation/ in genres ? 'Animated Movies' : 'Movies'}{'No Genres Movies'}}/{plex.tail}
:idea: Please read the FAQ and How to Request Help.
MickeMM
Posts: 30
Joined: 03 Apr 2019, 10:52

Re: Script works, but takes unfinish download to

Post by MickeMM »

I'm grateful for the help. Thank you and a Happy New year to u and all members!
MickeMM
Posts: 30
Joined: 03 Apr 2019, 10:52

Re: Script works, but takes unfinish download to

Post by MickeMM »

I have a new problem :)

This is my rtorrent code:

Code: Select all

method.set_key=event.download.finished,filebot,"execute={/home/micke/rtorrent-postprocess.sh,$d.base_path=,$d.name=,$d.custom1=}"
This is my code in rtorrent-postprocess.sh

Code: Select all

filebot -script fn:amc --output "/home/micke/rtorrent/test/" --action duplicate --conflict auto -non-strict "/home/micke/rtorrent/download" --log-file amc_film.log --def excludeList=amc_filmer.txt --def ignore="dansk_text" --def movieFormat="/home/micke/rtorrent/test/{any{/Animation/ in genres ? 'animerat/Movies' : genres =~ /Documentary/? 'dokumentar/Movies' : 'film/Movies'}{'film/Movies'}}/{plex.tail}" seriesFormat="/home/micke/rtorrent/test/serie/{plex}"
Now to my problem :)
1. As i understand filebot should only work with downloaded movies, but my take movies that are not completely downloaded to.
2. Lately filebot make cd1 and cd2, why and how can i remove it so it wont (if it possible).

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

Re: Script works, but takes unfinish download to

Post by rednoah »

1.
Why not use the official integration / model solution?
viewtopic.php?p=5316#p5316

Code: Select all

#!/bin/sh -xu

# Input Parameters
ARG_PATH="$1"
ARG_NAME="$2"
ARG_LABEL="$3"

# Configuration
CONFIG_OUTPUT="$HOME/Media"

filebot -script fn:amc --output "$CONFIG_OUTPUT" --action duplicate --conflict skip -non-strict --log-file amc.log --def unsorted=y music=y artwork=y excludeList=".excludes" ut_dir="$ARG_PATH" ut_kind="multi" ut_title="$ARG_NAME" ut_label="$ARG_LABEL" &
:idea: I'd start with the official solution, and the customize it for your needs. This code will only process the newly completed files, as opposed to your code, which always processes your entire download folder whenever any download is completed.



2.
CD1/2 is part of {plex}. If you have multi-part movies, each part will end up with the same name, if you remove the CD1/2 bit, and then the CD2 file will override the CD1 file, as you can't have 2 files with the exact same file path.
:idea: Please read the FAQ and How to Request Help.
MickeMM
Posts: 30
Joined: 03 Apr 2019, 10:52

Re: Script works, but takes unfinish download to

Post by MickeMM »

Thanks!

I will try to change my code ...

Okej, before i never seen any cd1 and cd2, it sins i change my code.
As it is now, i have on my google "movie" "movie.cd1" "Moviecd2" and all subfiles.
User avatar
rednoah
The Source
Posts: 19140
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Script works, but takes unfinish download to

Post by rednoah »

MickeMM wrote: 04 Jan 2020, 14:07 Okej, before i never seen any cd1 and cd2, it sins i change my code.
As it is now, i have on my google "movie" "movie.cd1" "Moviecd2" and all subfiles.
Well, if you paste the relevant logs on pastebin, I'll have a look and interpret them for you. ;)
:idea: Please read the FAQ and How to Request Help.
MickeMM
Posts: 30
Joined: 03 Apr 2019, 10:52

Re: Script works, but takes unfinish download to

Post by MickeMM »

Is this correct?

Code: Select all

# Configuration
CONFIG_OUTPUT="/home/micke/rtorrent/test"

filebot -script fn:amc --output "$CONFIG_OUTPUT" --action duplicate --conflict auto -non-strict --log-file amc.log --def excludeList=".excludes" ut_dir="$ARG_PATH" ut_kind="multi" ut_title="$ARG_NAME" ut_label="$ARG_LABEL" --def ignore="dansk_text" --def movieFormat="$CONFIG_OUTPUT/{any{/Animation/ in genres ? 'animerat/Movies' : genres =~ /Documentary/? 'dokumentar/Movies' : 'film/Movies'}{'film/Movies'}}/{plex.tail}" seriesFormat="$CONFIG_OUTPUT/serie/{plex}" &
MickeMM
Posts: 30
Joined: 03 Apr 2019, 10:52

Re: Script works, but takes unfinish download to

Post by MickeMM »

It works :)

Code: Select all

# Configuration
CONFIG_OUTPUT="/home/micke/rtorrent/test/"

filebot -script fn:amc --output "$CONFIG_OUTPUT" --action duplicate --conflict auto -non-strict --log-file amc.log --def excludeList=".excludes" ut_dir="$ARG_PATH" ut_kind="multi" ut_title="$ARG_NAME" ut_label="$ARG_LABEL" --def ignore="dansk_text" --def movieFormat=""$CONFIG_OUTPUT"{any{/Animation/ in genres ? 'animerat/Movies' : genres =~ /Documentary/? 'dokumentar/Movies' : 'film/Movies'}{'film/Movies'}}/{plex.tail}" seriesFormat=""$CONFIG_OUTPUT"/serie/{plex}" &
Thanks for helping me!..
Regards and a heart! ;)
Post Reply