ubuntu filebot script not seeing directories

Support for Ubuntu and other Desktop Linux distributions
Post Reply
elgallo
Posts: 40
Joined: 29 Apr 2014, 10:33

ubuntu filebot script not seeing directories

Post by elgallo »

Ubuntu 16.04.1 Server filebot_4.7.5_amd64.deb installed, java 8 installed,

running this script

Code: Select all

#!/bin/bash 

#### Media file processing script for Filebot
# This script gets triggered by some means (inotify, auditd, cron, etc.) and processes media files in some locations.
# It will run the filebot amc.groovy script against these files and output them into user defined locations for HTPC use.
#
# Known Limitations: 
# 	Not dealing with music files, just video files.  I use beets for music tagging.
#	Not dealing with unique video types just yet, such as comedy specials, concerts, etc.  Filebot might match it okay but I am not confident about it.	


command -v filebot >/dev/null 2>&1 || { echo >&2 "I require filebot but it's not installed or in my $PATH.  Aborting."; exit 1; }

# Set up some logging
NOW=$(date +"%m%d%Y")
LOGDIR="/var/log/nasbox"
LOGFILE="filebot-wrapper-$NOW.log"

# base destinations to move files, no trailing slash.  The subfolder is defined in the format string.
DESTINATION="/home/hk/data/Plex"

# path(s) to search for files to process
SEARCH_PATH=("/home/hk/data/complete")

# gmail username:password (app password)
#GMAIL="xxxxxxxx:yyyyyyyyy"

# format strings for filebot, please see: http://www.filebot.net/naming.html
TV_FORMAT="series/{n.removeTrailingBrackets()}/{episode.special ? 'Season 0' : 'Season '+s}/{n}.{episode.special ? 'S00E'+special.pad(2) : s00e00}.{t}"
ANIME_FORMAT="anime/{n}/{n}.S{(episode.season ? s : 1).pad(2)}E{e.pad(2)}.{t}" 
MOVIE_FORMAT="cinema/{n} ({y})/{n} ({y})"
UNSORTED_FORMAT="nonsort/{file.structurePathTail}"

# filebot is much more accurate when we tell it what type of media it is looking at, so we do that
MEDIA_TAGS=('movie' 'tv' 'anime');

# Test if script is run interactively, do not log the output if so
if [ -v PS1 ]
then
    exec 1>> $LOGDIR/$LOGFILE 2>&1
    echo "Logging to: ${LOGDIR}/${LOGFILE}"
    # Delete old log files, comment this out if you just want to use logrotate or something
    echo "Deleting log files older than 7 days..."
    find $LOGDIR/ -name '*.log' -type f -mtime +7 -delete
fi

METHOD="auto"

# parameter 1 can override the search path
# parameter 2 can override the download tag (type of file)
if [ $# -gt 0 ]
then
    SEARCH_PATH=($1)
	unset $MEDIA_TAGS
	MEDIA_TAGS=($2)
	METHOD="manual"
	echo "User provided parameters, using manual mode."
fi

# Fix the IFS to deal with spaces in files
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")

echo "Start Processing - ${0} on $(date)"

for path in "${SEARCH_PATH[@]}"; do
	for tag in "${MEDIA_TAGS[@]}"; do
		echo "Current tag: <$tag>"
		if [ $METHOD == "auto" ]
		then
			MEDIA_PATH=$path/$tag
		else
			MEDIA_PATH=$path
		fi
		if find "$MEDIA_PATH" -mindepth 1 -print -quit | grep -q .; then
			echo "Running Filebot in $MEDIA_PATH using media tag <$tag>"
			filebot -script fn:amc \
					--output $DESTINATION \
					--log-file $LOGDIR/filebot-amc.log \
					--action symlink \
					--conflict override \
					-non-strict \
					-no-xattr \
					"$MEDIA_PATH" \
					--def \
					excludeList=$LOGDIR/filebot-history.log \
					music=n \
					subtitles=en \
					artwork=y \
					extras=y \
					gmail=$GMAIL \
					clean=n \
					unsorted=y \
					"seriesFormat=$TV_FORMAT" \
					"animeFormat=$ANIME_FORMAT" \
					"movieFormat=$MOVIE_FORMAT"
		
			echo "Finished processing for tag: <$tag> in $MEDIA_PATH"
		else
			echo "$MEDIA_PATH is empty, moving on..."
		fi
	done
done

echo "Finished Searching for files."

IFS=$SAVEIFS

echo "Script Complete."
and I get the following

Code: Select all

(1:505)$ bash .config/script/filebot-process.sh
Start Processing - .config/script/filebot-process.sh on Sun Dec 11 14:17:24 CST 2016
Current tag: <movie>
Running Filebot in /home/hk/data/complete/movie using media tag <movie>
Error during startup: java.io.IOException: No such file or directory
java.io.IOException: No such file or directory
	at net.filebot.Main.initializeLogging(Main.java:411)
	at net.filebot.Main.main(Main.java:108)

Finished processing for tag: <movie> in /home/hk/data/complete/movie
Current tag: <tv>
Running Filebot in /home/hk/data/complete/tv using media tag <tv>
Error during startup: java.io.IOException: No such file or directory
java.io.IOException: No such file or directory
	at net.filebot.Main.initializeLogging(Main.java:411)
	at net.filebot.Main.main(Main.java:108)

Finished processing for tag: <tv> in /home/hk/data/complete/tv
Current tag: <anime>
find: ‘/home/hk/data/complete/anime’: No such file or directory
/home/hk/data/complete/anime is empty, moving on...
Finished Searching for files.
Script Complete.
same script worked previously with 4.6

file structure does exist. however `~/data` is actually a 12TB RAID 0 Volume mounted to `~/data` instead of `/media/md0`

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

Re: ubuntu filebot script not seeing directories

Post by rednoah »

If even "find" doesn't give you any results, then it's definitely not a FileBot issue.

Double and triple check Unix permissions (and maybe app armour profiles or similar sandboxing technologies).
:idea: Please read the FAQ and How to Request Help.
Post Reply