Skip to content

Instantly share code, notes, and snippets.

@HanSooloo
Created September 18, 2016 13:14
Show Gist options
  • Save HanSooloo/caedbf3d7bf324c6eed2661393bcd2a8 to your computer and use it in GitHub Desktop.
Save HanSooloo/caedbf3d7bf324c6eed2661393bcd2a8 to your computer and use it in GitHub Desktop.
jdownloader-postprocess-exechelper.sh
#!/bin/sh
JD_DIR="/usr/local/JDownloader"
. "$JD_DIR"/functions.sh
# $1: Where the processed file resides, full path
# This is what gets passed on by FileBot script after processing complete
# e.g., /mnt/JDownloader/Format/MovieA Reboot/Movie A (2016)
OUTPUT_DIR="$1"
# $2: Where the procossed file hierarch is rooted, full path
# e.g., /mnt/JDownloader/Format
PROCESS_ROOT_DIR="$2"
# $3: Download directory
# e.g., /mnt/JDownloader/Download/movie_folder
PACKAGE_DIR="$3"
# Take the 1st directory of the path $OUTPUT_DIR - $PROCESS_ROOT_DIR
WORK_DIR=$(echo ${OUTPUT_DIR#$PROCESS_ROOT_DIR} | awk -F "/" '{print $2}')
FULL_WORK_DIR="$PROCESS_ROOT_DIR"/"$WORK_DIR"
chmod -R g+w "$FULL_WORK_DIR"
chown -R nobody:nobody "$FULL_WORK_DIR"
rsync -a --human-readable --progress --stats "$FULL_WORK_DIR" "$MOVIES_DIR"/
rm -rfv "$FULL_WORK_DIR"
rm -rfv "$PACKAGE_DIR"
curl -v "https://$PLEX_HOST:$PLEX_PORT/$PLEX_RESOURCE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment