AMC: temporary location for processing

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
Clint
Donor
Posts: 50
Joined: 24 Sep 2013, 19:42

AMC: temporary location for processing

Post by Clint »

First a BIG thanks for this, its simply amazing! I have gotten quite far with setting up my media center as I want it! I use a Debian driven NAS to download, sort and make my own posters and metadata much similar to YAMJ and others. Filebot is the core function its all built on! :D

As of now I process the media when in place which means my scripts scans through the whole collection looking for "untreated" media. This is not optimal as it takes unnecessary time and cycles from the NAS's tiny CPU. I would be much better to have the treatment done in a temporary location and then copied to the mediashare. I believe it would be best if filebot was involved in this as I presume it would "know" the mediashare and its structure so no conflicts, overwriting or such could happen. Is it possible to arrange like that with any solution here?

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

Re: AMC: temporary location for processing

Post by rednoah »

Usually people use the amc script to sort files from an incoming folder to the output folder structure:
http://www.filebot.net/forums/viewtopic.php?f=4&t=215

So everything in incoming is either untreated, or can't be auto-sorted, and the rest is moved the the final folder structure (which mustn't be a sub-folder of incoming obviously).

The only thing u need to do is call filebot/amc everyonce in a while on your incoming folder, or have other software trigger it on completed downloads.
:idea: Please read the FAQ and How to Request Help.
Clint
Donor
Posts: 50
Joined: 24 Sep 2013, 19:42

Re: AMC: temporary location for processing

Post by Clint »

Hmm, I think I was a bit unclear in my preious post...too late I guess.

1. I download stuffs and a script is called when completed.
2. The script calls Filebot and media is processed per amc standard and then moved to my library (Movies, TV Shows)
3. Based on the movie.info and artwork generated by Filebot amc next script grabs further metadata (mediainfo) to "paint up" a "metadata poster" to the new media

This means that I have to scan for the new untreated media in the library becuse its been moved there by Filebot. My question was if I could do the scanning and building of the metadata posters in a temporary folder in between the move from finished downloads and to the library. Could I maybe just call amc again but only use the move function? I assume that the cache, log and history in filebot folder has some function to as remember what has been moved to the library so TV Show episodes and such could be moved in without new metadata been pulled again?

I hope this makes more sense. :oops:
User avatar
rednoah
The Source
Posts: 23004
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC: temporary location for processing

Post by rednoah »

I doesn't remember what has been moved. After move it doesn't have to worry about it anyway. Artwork will only be downloaded if it doesn't already exist.

So you generate extra artwork? Why not just check if your extra artwork already exists or not per movie folder?
:idea: Please read the FAQ and How to Request Help.
Clint
Donor
Posts: 50
Joined: 24 Sep 2013, 19:42

Re: AMC: temporary location for processing

Post by Clint »

Aha, that is good news in a way, no need to ponder around that more then. Yes, I use the presence of Filebot generated artwork (poster, fanart) as a trigger to enter a conditional traversing where my script looks for own generated artwork as trigger to either make new or exit. It works fairly well but it is not optimal as I would prefer to only scan through the fresh material. Every CPU cycle counts on an ARM gadget.. :) Im using imagemagick quite extensively to mimick YAMJ's metadataposters, even borrowed a few icons from their thing to easen up the burden for the CPU. Anyway, I'm looking toward some kind of conditional move with Bash then, should be feasable to do.

Here is a screenshot of the finished result if anyone is interested, pointers on positioning very much welcomed:
[IMG=http://img818.imageshack.us/img818/1088/h69j.jpg][/IMG]
User avatar
rednoah
The Source
Posts: 23004
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC: temporary location for processing

Post by rednoah »

Have you played with the exec options of AMC?
--def exec=command {file} Run program on newly processed files
It'll be called on each media file that has been processed. So you can have the amc kick-off your script.


e.g.

Code: Select all

--def "exec=/bin/update-artwork \"{folder}\""
:idea: Please read the FAQ and How to Request Help.
Clint
Donor
Posts: 50
Joined: 24 Sep 2013, 19:42

Re: AMC: temporary location for processing

Post by Clint »

In all honesty I havent looked much on the exec options but that surely looks interesting! :D
Clint
Donor
Posts: 50
Joined: 24 Sep 2013, 19:42

Re: AMC: temporary location for processing

Post by Clint »

Did have a go at the exec feature but its hard to throw out a variable between scripts to make it work. However, I made some use of the history.xml instead which turns out to work rather well. :D
One question though: is it possible to limit/control filebot to only process one or two files at a time even if the parsing directory holds multiple files?
User avatar
rednoah
The Source
Posts: 23004
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC: temporary location for processing

Post by rednoah »

amc processes whatever you pass in from cmdline. If you only pass in two file paths (and not a folder) it'll process only those.
:idea: Please read the FAQ and How to Request Help.
Clint
Donor
Posts: 50
Joined: 24 Sep 2013, 19:42

Re: AMC: temporary location for processing

Post by Clint »

Ahh, thats quite obvious. :oops: This means that I possibly can make use of transmission and start filebot from within my cleaningscript and pull the filename as variable from transmission itself. That in the combination with the "flock" function and I can have a nice little queue system when it clogs up...100mbit's downloading can be nasty to a hardworking ARM, lots of info to process in parallell sometimes. I'm digging myself deeper here with very little coding knowledge, and it's all your fault, hehe! :D

Thanks again!! (donation on its way..)
User avatar
rednoah
The Source
Posts: 23004
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC: temporary location for processing

Post by rednoah »

Feel free to share any bash/groovy scripts back here. ;)

Also you should really call AMC on a batch of files. Just loading up FileBot/AMC (Groovy engine, movie/series index, etc) will take ALOT more CPU cycles than anything else you're running I'm sure. :D
:idea: Please read the FAQ and How to Request Help.
Clint
Donor
Posts: 50
Joined: 24 Sep 2013, 19:42

Re: AMC: temporary location for processing

Post by Clint »

Yes, I realize that. Java is quite the hogger... The weak point for me is the imagemagick. It flunks out when more than two instances is running in parallell, images goes lost and what not..probably memory issues. Even worse if Filebot pulls another process after just finished one. I think I'd prefer having it linear. This would possibly fix another issue that arrived with the usage of mediainfo. I do need the specific name of the file to be able to pull the info from it which I don't get when just scanning through and halting on trigger fanart. Today I'm doing a while loop where I compare file extensions of all files with same name as the folder I'm in based on a known extension list. Its truly a dirty hack but works... If I can call each subsequent script from previous I might be able to keep the filename all through which would be nicer. Wellwell, I'm learning. :D Once it's all decent I'll share the whole sheebang ofcourse. If anyone has pointers on how grabbing the filename please tell..

Ugly hackling:

Code: Select all

#!/bin/bash

# Specifics for scraper/mediaplayer (MED400xmini)
THUMBNAIL="folder.jpg"
THUMBSIZE="158x237!"
METAPOSTER="about.jpg"
METASIZE="1280x720!"
COVERSIZE="238x357!"
MEDIA_DIR="/share/MEDIA"

# Resources
ART="/share/config/MED400Xmini/artwork"
FONT="/usr/share/fonts/type1/gsfonts"
BOLD=`tput bold`
NORMAL=`tput sgr0`

  # Creating poster
find $MEDIA_DIR -type f -name 'fanart.jpg' |
while read file; do
WORKDIR="$(dirname "$file")"
MEDIANAME="$(basename "$WORKDIR")"
   if [[ -f "$WORKDIR/about.jpg" ]];
   then
echo ""${BOLD}"$MEDIANAME"${NORMAL}", metaposter already processed, skipping!"
   elif [[ ( ! -f "$WORKDIR/movie.nfo" ) && ( ! -f "$WORKDIR/tvshow.nfo" ) ]];
   then
echo ""${BOLD}"$MEDIANAME"${NORMAL}", media metadata not present, let's create a basic poster!"
convert "$file" -resize $METASIZE -quality 100 "$WORKDIR/$METAPOSTER"
   else
echo ""${BOLD}"$MEDIANAME"${NORMAL}", metaposter not present, let's create one!"

  # Get that media name..(hackling)
while read LINE; do 
    if grep -Fxq "$(find "$WORKDIR" -maxdepth 1 -type f | sed -rn 's|.*/[^/]+\.([^/.]+)$|\1|p' | sort -u)" <<< "$LINE"; then
MEDIAFILE=$""$MEDIANAME"."$LINE""
    break
    fi
done < "$ART/video_extensions.txt"

  # Parsing media data
mediainfo --output=XML "$WORKDIR/$MEDIAFILE" > "$WORKDIR/media.nfo"

...snip..

Post Reply