############################################ # YAMJ Plugin by Dan Kessler # Release Version v0.3.3 ############################################ ############################################ # Changlelog # ---------- # 0.3.3 - Added plugin forum link to WEBUI # - Added option to open last log in new window # - Added option to open script file in new window # - Added --timeout=60 to all wget commands # 0.3.2 - Fixed bottom of page is sometimes not visible due to unRAID progressframe # 0.3.1 - Fixed YAMJ manual background scan from WEBUI # 0.3 - Fixed possibility of multiple scheduled YAMJ Scans in crontab[/b] # 0.2 - Initial Release ############################################ ############################################ # cleanup file ############################################ ############################################ # configuration file ############################################ # UPGRADE_PLG_ON_BOOT - Check and Install new plugin version if exists on hosting server during array mount (true/false) # YAMJ_DOWN_STABLE_ON_BOOT - Download Latest YAMJ Stable version during during array mount (true/false) # YAMJ_DOWN_SNAPSHOT_ON_BOOT - Download Latest YAMJ Snapshot version during during array mount (true/false) # YAMJ_ADD_CRON_ON_BOOT - Add CRON job during array mount (true/false) # YAMJ_CRON_MIN - Cron minutes settings for YAMJ automation # YAMJ_CRON_HOUR - Cron hours settings for YAMJ automation # YAMJ_CRON_DAY - Cron days settings for YAMJ automation # YAMJ_CRON_MONTH - Cron months settings for YAMJ automation # YAMJ_CRON_WEEKDAY - Cron weekdays settings for YAMJ automation # YAMJ_LOCATION - Location (folder) of existing YAMJ installation # YAMJ_DOWNLOAD_LOCATION - Location (folder) for YAMJ download # YAMJ_RUN_SCRIPT - Full path for YAMJ run script # YAMJ_RUN_SCRIPT_OUT - Where to send the output of YAMJ run ############################################ ############################################ # Get Icon file (must be after configuration file creation - needs plugin folder) ############################################ /dev/null 2>&1 logger -trc.yamj -plocal7.info -is "Icon downloaded from icon hosting server" echo "Icon downloaded from icon hosting server" else logger -trc.yamj -plocal7.info -is "No icon to download from icon hosting server" echo "No icon to download from icon hosting server" fi if [ -f /boot/config/plugins/yamj/yamj.png ] ; then mkdir --parents /usr/local/emhttp/plugins/yamj cp --force /boot/config/plugins/yamj/yamj.png /usr/local/emhttp/plugins/yamj/yamj.png logger -trc.yamj -plocal7.info -is "Icon copied to emhttp plugin folder" echo "Icon copied to emhttp plugin folder" else logger -trc.yamj -plocal7.info -is "Icon does not exist locally - cannot copy to emhttp plugin folder" echo "Icon does not exist locally - cannot copy to emhttp plugin folder" fi rm /tmp/yamj-icon ]]> ############################################ # rc.yamj file ############################################ ${YAMJ_PLUGIN_PATH}/yamj.cfg echo "UPGRADE_PLG_ON_BOOT=\"$UPGRADE_PLG_ON_BOOT\"" >> ${YAMJ_PLUGIN_PATH}/yamj.cfg echo "YAMJ_DOWN_STABLE_ON_BOOT=\"$YAMJ_DOWN_STABLE_ON_BOOT\"" >> ${YAMJ_PLUGIN_PATH}/yamj.cfg echo "YAMJ_DOWN_SNAPSHOT_ON_BOOT=\"$YAMJ_DOWN_SNAPSHOT_ON_BOOT\"" >> ${YAMJ_PLUGIN_PATH}/yamj.cfg echo "YAMJ_ADD_CRON_ON_BOOT=\"$YAMJ_ADD_CRON_ON_BOOT\"" >> ${YAMJ_PLUGIN_PATH}/yamj.cfg echo "YAMJ_CRON_MIN=\"$YAMJ_CRON_MIN\"" >> ${YAMJ_PLUGIN_PATH}/yamj.cfg echo "YAMJ_CRON_HOUR=\"$YAMJ_CRON_HOUR\"" >> ${YAMJ_PLUGIN_PATH}/yamj.cfg echo "YAMJ_CRON_DAY=\"$YAMJ_CRON_DAY\"" >> ${YAMJ_PLUGIN_PATH}/yamj.cfg echo "YAMJ_CRON_MONTH=\"$YAMJ_CRON_MONTH\"" >> ${YAMJ_PLUGIN_PATH}/yamj.cfg echo "YAMJ_CRON_WEEKDAY=\"$YAMJ_CRON_WEEKDAY\"" >> ${YAMJ_PLUGIN_PATH}/yamj.cfg echo "YAMJ_LOCATION=\"$YAMJ_LOCATION\"" >> ${YAMJ_PLUGIN_PATH}/yamj.cfg echo "YAMJ_DOWNLOAD_LOCATION=\"$YAMJ_DOWNLOAD_LOCATION\"" >> ${YAMJ_PLUGIN_PATH}/yamj.cfg echo "YAMJ_RUN_SCRIPT=\"$YAMJ_RUN_SCRIPT\"" >> ${YAMJ_PLUGIN_PATH}/yamj.cfg echo "YAMJ_RUN_SCRIPT_OUT=\"$YAMJ_RUN_SCRIPT_OUT\"" >> ${YAMJ_PLUGIN_PATH}/yamj.cfg logit "Plugin configuration written" } ################# # W R I T E S T A T U S ################# write_status() { echo "# YAMJ status" > $STATUS_FILE echo "YAMJ_PLG_HOSTING_SERVER_EXISTS=\"$YAMJ_PLG_HOSTING_SERVER_EXISTS\"" >> $STATUS_FILE echo "YAMJ_PLG_ONLINE_EXIST=\"$YAMJ_PLG_ONLINE_EXIST\"" >> $STATUS_FILE echo "YAMJ_PLG_ONLINE_VER=\"$YAMJ_PLG_ONLINE_VER\"" >> $STATUS_FILE echo "YAMJ_PLG_LOCAL_VER=\"$YAMJ_PLG_LOCAL_VER\"" >> $STATUS_FILE echo "YAMJ_SNP_HOSTING_SERVER_EXISTS=\"$YAMJ_SNP_HOSTING_SERVER_EXISTS\"" >> $STATUS_FILE echo "YAMJ_SNP_ONLINE_EXIST=\"$YAMJ_SNP_ONLINE_EXIST\"" >> $STATUS_FILE echo "YAMJ_SNP_ONLINE_VER=\"$YAMJ_SNP_ONLINE_VER\"" >> $STATUS_FILE echo "YAMJ_SNP_ONLINE_REV=\"$YAMJ_SNP_ONLINE_REV\"" >> $STATUS_FILE echo "YAMJ_FNL_HOSTING_SERVER_EXISTS=\"$YAMJ_FNL_HOSTING_SERVER_EXISTS\"" >> $STATUS_FILE echo "YAMJ_FNL_ONLINE_EXIST=\"$YAMJ_FNL_ONLINE_EXIST\"" >> $STATUS_FILE echo "YAMJ_FNL_ONLINE_VER=\"$YAMJ_FNL_ONLINE_VER\"" >> $STATUS_FILE echo "YAMJ_FNL_ONLINE_REV=\"$YAMJ_FNL_ONLINE_REV\"" >> $STATUS_FILE echo "YAMJ_LOCAL_VER=\"$YAMJ_LOCAL_VER\"" >> $STATUS_FILE echo "YAMJ_LOCAL_REV=\"$YAMJ_LOCAL_REV\"" >> $STATUS_FILE echo "YAMJ_SNP_DOWN_VER=\"$YAMJ_SNP_DOWN_VER\"" >> $STATUS_FILE echo "YAMJ_SNP_DOWN_REV=\"$YAMJ_SNP_DOWN_REV\"" >> $STATUS_FILE echo "YAMJ_FNL_DOWN_VER=\"$YAMJ_FNL_DOWN_VER\"" >> $STATUS_FILE } ################# # C R O N A D D ################# #yamj_cron_add() #{ #} #################### # G E T O N L I N E V E R S I O N S #################### yamj_getonlineversions() { # YAMJ Snapshot hosting server by lainie YAMJ_SNP_HOSTING_SERVER="mediaplayersite.com/YAMJ_Latest" # Get online/offline status of YAMJ Snapshot hosting server wget --quiet --spider --timeout=60 $YAMJ_SNP_HOSTING_SERVER YAMJ_SNP_HOSTING_SERVER_EXISTS=$? # Check if YAMJ Snapshot hosting server is online if [ "$YAMJ_SNP_HOSTING_SERVER_EXISTS" == "0" ] ; then # Get latest version number from server YAMJ_SNP_ONLINE_VER=$(wget --timeout=60 ${YAMJ_SNP_HOSTING_SERVER} -q -O - | grep -m 1 "Current version: " | awk 'gsub(/.*Current version: |\/.*/,"")') YAMJ_SNP_ONLINE_VER=$(echo "${YAMJ_SNP_ONLINE_VER%?}") YAMJ_SNP_ONLINE_REV=$(wget --timeout=60 ${YAMJ_SNP_HOSTING_SERVER} -q -O - | grep -m 1 "Latest revision: r" | awk 'gsub(/.*Latest revision: r|\/.*/,"")') YAMJ_SNP_ONLINE_REV=$(echo "${YAMJ_SNP_ONLINE_REV%?}") else # Set version to server_down - does not exist YAMJ_SNP_ONLINE_VER="server_down" YAMJ_SNP_ONLINE_REV="server_down" fi # YAMJ Snapshot filename YAMJ_SNP_ONLINE_FILENAME="yamj-${YAMJ_SNP_ONLINE_VER}-r${YAMJ_SNP_ONLINE_REV}-bin.zip" # YAMJ Snapshot hosting server URL YAMJ_SNP_URL="http://mediaplayersite.com/sites/default/files/YAMJ" # Check if YAMJ Snapshot file exists online wget --quiet --spider --timeout=60 ${YAMJ_SNP_URL}/${YAMJ_SNP_ONLINE_FILENAME} YAMJ_SNP_ONLINE_EXIST=$? # YAMJ Stable hosting server YAMJ_FNL_HOSTING_SERVER="http://code.google.com/p/moviejukebox/downloads/list" # Get online/offline status of YAMJ Stable hosting server wget --quiet --spider --timeout=60 $YAMJ_FNL_HOSTING_SERVER YAMJ_FNL_HOSTING_SERVER_EXISTS=$? # Check if YAMJ Stable hosting server is online if [ "$YAMJ_FNL_HOSTING_SERVER_EXISTS" == "0" ] ; then # Get latest version number from server YAMJ_FNL_ONLINE_VER=$(wget --timeout=60 ${YAMJ_FNL_HOSTING_SERVER} -q -O - | grep -m 1 "Moviejukebox v" | awk 'gsub(/.*Moviejukebox v|\n.*/,"")' | tr -d '\n' | tr -d '\r') YAMJ_FNL_ONLINE_REV=$(wget --timeout=60 ${YAMJ_FNL_HOSTING_SERVER} -q -O - | grep -m 1 "Featured, OpSys-All, Type-Archive, r" | awk 'gsub(/.* r|].*/,"")') YAMJ_FNL_ONLINE_REV=$(echo "${YAMJ_FNL_ONLINE_REV%?}") else # Set version to server_down - does not exist YAMJ_FNL_ONLINE_VER="server_down" YAMJ_FNL_ONLINE_REV="server_down" fi # YAMJ Stable filename YAMJ_FNL_ONLINE_FILENAME="moviejukebox-${YAMJ_FNL_ONLINE_VER}.zip" # YAMJ Stable hosting server URL YAMJ_FNL_URL="http://moviejukebox.googlecode.com/files" # Check if YAMJ Stable file exists online - NOT SUPPORTED BY GOOGLE-CODE yet # wget --quiet --spider --timeout=60 ${YAMJ_FNL_URL}/${YAMJ_FNL_ONLINE_FILENAME} # YAMJ_FNL_ONLINE_EXIST=$? YAMJ_FNL_ONLINE_EXIST=0 # Write status to update WEBUI write_status } ################### # G E T L O C A L V E R S I O N S ################### yamj_getlocalversions() { if [ -d $YAMJ_LOCATION ] ; then if [ -f ${YAMJ_LOCATION}/version.txt ] ; then # Get Existing local YAMJ version YAMJ_LOCAL_VER=$(cat ${YAMJ_LOCATION}/version.txt | grep "Version: " | awk 'gsub(/.*Version: |\n.*/,"")') YAMJ_LOCAL_REV=$(cat ${YAMJ_LOCATION}/version.txt | grep "Revision: r" | awk 'gsub(/.*Revision: r|\n.*/,"")') else YAMJ_LOCAL_VER="no_ver_file" YAMJ_LOCAL_REV="no_ver_file" fi else # Set non existing local YAMJ version YAMJ_LOCAL_VER="no_local_ver" YAMJ_LOCAL_REV="no_local_ver" fi if [ -d $YAMJ_DOWNLOAD_LOCATION ] ; then YAMJ_SNP_FILES=$(ls -1Art ${YAMJ_DOWNLOAD_LOCATION}/yamj-*-r*-bin.zip 2>/dev/null) ls -1Art /mnt/cache/unRAID_Apps/YAMJ/YAMJ_Downloads/yamj-*-r*-bin.zip 2>/dev/null if [ "$YAMJ_SNP_FILES" != "" ] ; then # Get existing downloaded YAMJ version YAMJ_SNP_DOWN_VER=$(echo $YAMJ_SNP_FILES | tail -n1 | awk 'gsub(/.*yamj-|-r.*/,"")') YAMJ_SNP_DOWN_REV=$(echo $YAMJ_SNP_FILES | tail -n1 | awk 'gsub(/.*-r|-bin.*/,"")') else YAMJ_SNP_DOWN_VER="no_snp_down" YAMJ_SNP_DOWN_REV="no_snp_down" fi YAMJ_FNL_FILES=$(ls -1Art ${YAMJ_DOWNLOAD_LOCATION}/moviejukebox-*.zip 2>/dev/null) if [ "$YAMJ_FNL_FILES" != "" ] ; then YAMJ_FNL_DOWN_VER=$(echo $YAMJ_FNL_FILES | tail -n1 | awk 'gsub(/.*moviejukebox-|.zip.*/,"")') else YAMJ_FNL_DOWN_VER="no_fnl_down" fi else # Set non existing downloaded YAMJ version YAMJ_SNP_DOWN_VER="no_down_loc" YAMJ_SNP_DOWN_VER="no_down_loc" YAMJ_FNL_DOWN_VER="no_down_loc" fi # Write status to update WEBUI write_status } ################### # D O W N L O A D F N L ################### yamj_download_fnl() { # Check online status yamj_getonlineversions # Check if YAMJ Stable hosting servers are online if [ "$YAMJ_FNL_HOSTING_SERVER_EXISTS" == "0" ] ; then # Check if latest version is available on server if [ "$YAMJ_FNL_ONLINE_EXIST" == "0" ] ; then if [ ! -d $YAMJ_DOWNLOAD_LOCATION ] ; then logit "No YAMJ doaload folder exists - Creating folder..." mkdir --parents $YAMJ_DOWNLOAD_LOCATION fi if [ ! -f ${YAMJ_DOWNLOAD_LOCATION}/${YAMJ_FNL_ONLINE_FILENAME} ] ; then logit "Latest YAMJ Stable (v${YAMJ_FNL_ONLINE_VER}) does not exist in download location - Removing all existing downloaded Stable versions and downloading..." rm ${YAMJ_DOWNLOAD_LOCATION}/moviejukebox-*.zip >/dev/null 2>&1 wget -nv --timeout=60 -O ${YAMJ_DOWNLOAD_LOCATION}/${YAMJ_FNL_ONLINE_FILENAME} ${YAMJ_FNL_URL}/${YAMJ_FNL_ONLINE_FILENAME} >/dev/null 2>&1 else logit "Latest YAMJ Stable (v${YAMJ_FNL_ONLINE_VER}) exists locally in download location - No need to download" fi else logit "Latest YAMJ Stable version does not exist online - Cannot download new version" fi else logit "Latest YAMJ Stable hosting server is OFFLINE - Cannot check for new version" fi } ################### # D O W N L O A D S N P ################### yamj_download_snp() { # Check online status yamj_getonlineversions # Check if YAMJ Snapshot hosting servers are online if [ "$YAMJ_SNP_HOSTING_SERVER_EXISTS" == "0" ] ; then # Check if latest version is available on server if [ "$YAMJ_SNP_ONLINE_EXIST" == "0" ] ; then if [ ! -d $YAMJ_DOWNLOAD_LOCATION ] ; then logit "No YAMJ download folder exists - Creating folder..." mkdir --parents $YAMJ_DOWNLOAD_LOCATION fi if [ ! -f ${YAMJ_DOWNLOAD_LOCATION}/${YAMJ_SNP_ONLINE_FILENAME} ] ; then logit "Latest YAMJ Snapshot (v${YAMJ_SNP_ONLINE_VER} r${YAMJ_SNP_ONLINE_REV}) does not exist in download location - Removing all existing downloaded Snapshot versions and downloading..." rm ${YAMJ_DOWNLOAD_LOCATION}/yamj-*-bin.zip >/dev/null 2>&1 wget -nv --timeout=60 -O ${YAMJ_DOWNLOAD_LOCATION}/${YAMJ_SNP_ONLINE_FILENAME} ${YAMJ_SNP_URL}/${YAMJ_SNP_ONLINE_FILENAME} >/dev/null 2>&1 else logit "Latest YAMJ Snapshot (v${YAMJ_SNP_ONLINE_VER} r${YAMJ_SNP_ONLINE_REV}) exists locally in downlaod location - No need to download" fi else logit "Latest YAMJ Snapshot version does not exist online - Cannot download new version" fi else logit "Latest YAMJ Snapshot hosting server is OFFLINE - Cannot check for new version" fi } ################# # G E T P L G V E R S I O N S ################# yamj_getplgversions() { # Plugin hosting server YAMJ_PLG_HOSTING_SERVER="https://github.com/theone11/YAMJ_plugin" # Plugin hosting server URL + filename YAMJ_PLG_URL="https://raw.github.com/theone11/YAMJ_plugin/master/yamj.plg" # Get online/offline status of plugin hosting server wget --quiet --spider --no-check-certificate --timeout=60 $YAMJ_PLG_HOSTING_SERVER YAMJ_PLG_HOSTING_SERVER_EXISTS=$? # Check if plugin hosting server is online if [ "$YAMJ_PLG_HOSTING_SERVER_EXISTS" == "0" ] ; then # Check if plugin file exists online wget --quiet --spider --no-check-certificate --timeout=60 $YAMJ_PLG_URL YAMJ_PLG_ONLINE_EXIST=$? if [ "$YAMJ_PLG_ONLINE_EXIST" == "0" ] ; then # Get latest version number from server YAMJ_PLG_ONLINE_VER=$(wget --no-check-certificate --quiet --timeout=60 $YAMJ_PLG_URL -O - | grep -m 1 "Release Version v" | awk 'gsub(/.*Release Version v|*/,"")') else YAMJ_PLG_ONLINE_VER="no_online_plg" fi else # Set version to server_down - does not exist YAMJ_PLG_ONLINE_VER="server_down" fi # Check if local plugin file exists if [ -f /boot/config/plugins/yamj.plg ] ; then # Get existing version number from local file YAMJ_PLG_LOCAL_VER=$(grep -m 1 "Release Version v" /boot/config/plugins/yamj.plg | awk 'gsub(/.*Release Version v|*/,"")') else # Set version to no_local_plg - does not exist YAMJ_PLG_LOCAL_VER="no_local_plg" fi # Write status to update WEBUI write_status } ####################### # U P D A T E P L G ####################### yamj_updateplg() { # Get online and local plugin versions yamj_getplgversions # Check if Plugin hosting server is online if [ "$YAMJ_PLG_HOSTING_SERVER_EXISTS" == "0" ] ; then # Check if latest version is available on server if [ "$YAMJ_PLG_ONLINE_EXIST" == "0" ] ; then # Check if online and local versions are different if [ "$YAMJ_PLG_ONLINE_VER" != "$YAMJ_PLG_LOCAL_VER" ] ; then # Check if local plugin doesn't exist if [ "$YAMJ_PLG_LOCAL_VER" == "no_local_plg" ] ; then logit "Local plugin does not exist. Installing latest plugin version from hosting server (v$YAMJ_PLG_ONLINE_VER)" else logit "Upgrading local plugin (v$YAMJ_PLG_LOCAL_VER) to hosting server plugin (v$YAMJ_PLG_ONLINE_VER)" fi # Download new plugin version wget --no-check-certificate --quiet --timeout=60 $YAMJ_PLG_URL -O /boot/config/plugins/yamj.plg # Install new plugin /usr/local/sbin/installplg /boot/config/plugins/yamj.plg logit "New/Updated plugin installation complete" # Plugin hosting server is offline else logit "Local plugin is the same version as on hosting server (v$YAMJ_PLG_LOCAL_VER)" fi # Online version and local version are the same else logit "Plugin does not exist on plugin hosting server - Cannot download new plugin" fi else logit "YAMJ Plugin hosting servers is OFFLINE - Cannot check for new packages versions" fi } ################### # R U N S C R I P T ################### yamj_runscript() { # Check if YAMJ exists if [ -d $YAMJ_LOCATION ] ; then if [ -f $YAMJ_RUN_SCRIPT ] ; then logit "Running YAMJ script in background ..." nohup $YAMJ_RUN_SCRIPT > $YAMJ_RUN_SCRIPT_OUT 2>&1 & else logit "YAMJ script ($YAMJ_RUN_SCRIPT) does not exist - Nothing to run" fi else logit "YAMJ installation ($YAMJ_LOCATION) does not exist - Cannot run script" fi } ################### # B O O T ################### yamj_boot() { # Check if new plugin should be updated during array mount if [ $UPGRADE_PLG_ON_BOOT == "true" ] ; then logit "Checking for YAMJ plugin update during array mount ..." yamj_updateplg # Plugin update should not be done during boot else logit "YAMJ plugin update during array mount is disabled" fi # Check if YAMJ CRON job should be added during array mount if [ $YAMJ_ADD_CRON_ON_BOOT == "true" ] ; then logit "Adding Scheduled YAMJ Scan during array mount ..." yamj_removecron yamj_addcron else logit "Adding Scheduled YAMJ Scan during array mount is disabled" fi # Check if YAMJ Stable verison should be downloaded during array mount if [ $YAMJ_DOWN_STABLE_ON_BOOT == "true" ] ; then logit "Downloading Latest YAMJ Stable version during array mount ..." yamj_donload_fnl else logit "Downloading Latest YAMJ Stable version during array mount is disabled" fi # Check if YAMJ Snapshot verison should be downloaded during array mount if [ $YAMJ_DOWN_SNAPSHOT_ON_BOOT == "true" ] ; then logit "Downloading Latest YAMJ Snapshot version during array mount ..." yamj_download_snp else logit "Downloading Latest YAMJ Snapshot version during array mount is disabled" fi } ################### # R E M O V E C R O N ################### yamj_removecron() { # Delete YAMJ CRON job crontab -l | grep -v "# Scheduled YAMJ Scan" | grep -v $YAMJ_RUN_SCRIPT > /tmp/yamj_crontab crontab /tmp/yamj_crontab rm --force /tmp/yamj_crontab logit "Deleted Scheduled YAMJ Scan from crontab if existed" } ################### # A D D C R O N ################### yamj_addcron() { # Add YAMJ CRON job crontab -l > /tmp/yamj_crontab echo "# Scheduled YAMJ Scan" >> /tmp/yamj_crontab echo "${YAMJ_CRON_MIN} ${YAMJ_CRON_HOUR} ${YAMJ_CRON_DAY} ${YAMJ_CRON_MONTH} ${YAMJ_CRON_WEEKDAY} ${YAMJ_RUN_SCRIPT} > ${YAMJ_RUN_SCRIPT_OUT} 2>&1" >> /tmp/yamj_crontab crontab /tmp/yamj_crontab rm --force /tmp/yamj_crontab logit "Added Scheduled YAMJ Scan to crontab" } ################### # U P D A T E C F G ################### yamj_updatecfg() { # Arguments file used for WEBUI configuration update ARGUMENTS_FILE="/usr/local/emhttp/plugins/yamj/yamj.args" [ -f $ARGUMENTS_FILE ] && source $ARGUMENTS_FILE UPGRADE_PLG_ON_BOOT=$UPGRADE_PLG_ON_BOOT_NEW YAMJ_DOWN_STABLE_ON_BOOT=$YAMJ_DOWN_STABLE_ON_BOOT_NEW YAMJ_DOWN_SNAPSHOT_ON_BOOT=$YAMJ_DOWN_SNAPSHOT_ON_BOOT YAMJ_ADD_CRON_ON_BOOT=$YAMJ_ADD_CRON_ON_BOOT_NEW YAMJ_LOCATION=$YAMJ_LOCATION_NEW # Check if new CRON settings are all empty if [ "$YAMJ_CRON_MIN_NEW" == "" ] && [ "$YAMJ_CRON_HOUR_NEW" == "" ] && [ "$YAMJ_CRON_DAY_NEW" == "" ] && \ [ "$YAMJ_CRON_MONTH_NEW" == "" ] && [ "$YAMJ_CRON_WEEKDAY_NEW" == "" ] ; then # Delete YAMJ CRON job yamj_removecron # Save new settings YAMJ_CRON_MIN=$YAMJ_CRON_MIN_NEW YAMJ_CRON_HOUR=$YAMJ_CRON_HOUR_NEW YAMJ_CRON_DAY=$YAMJ_CRON_DAY_NEW YAMJ_CRON_MONTH=$YAMJ_CRON_MONTH_NEW YAMJ_CRON_WEEKDAY=$YAMJ_CRON_WEEKDAY_NEW YAMJ_RUN_SCRIPT=$YAMJ_RUN_SCRIPT_NEW YAMJ_RUN_SCRIPT_OUT=$YAMJ_RUN_SCRIPT_OUT_NEW else # Check if any CRON settings is empty if [ "$YAMJ_CRON_MIN_NEW" == "" ] || [ "$YAMJ_CRON_HOUR_NEW" == "" ] || [ "$YAMJ_CRON_DAY_NEW" == "" ] || \ [ "$YAMJ_CRON_MONTH_NEW" == "" ] || [ "$YAMJ_CRON_WEEKDAY_NEW" == "" ] || [ "$YAMJ_RUN_SCRIPT_NEW" == "" ] || \ [ "$YAMJ_RUN_SCRIPT_OUT_NEW" == "" ] ; then logit "At least one Scheduled YAMJ Scan setting is missing - New schedule related settings not saved" else # Check if any off the new CRON settings are different than the existing settings if [ "$YAMJ_CRON_MIN_NEW" != "$YAMJ_CRON_MIN" ] || [ "$YAMJ_CRON_HOUR_NEW" != "$YAMJ_CRON_HOUR" ] || \ [ "$YAMJ_CRON_DAY_NEW" != "$YAMJ_CRON_DAY" ] || [ "$YAMJ_CRON_MONTH_NEW" != "$YAMJ_CRON_MONTH" ] || \ [ "$YAMJ_CRON_WEEKDAY_NEW" != "$YAMJ_CRON_WEEKDAY" ] || [ "$YAMJ_RUN_SCRIPT_NEW" != "$YAMJ_RUN_SCRIPT" ] || \ [ "$YAMJ_RUN_SCRIPT_OUT_NEW" != "$YAMJ_RUN_SCRIPT_OUT" ] ; then # Delete YAMJ CRON job yamj_removecron # Save new settings YAMJ_CRON_MIN=$YAMJ_CRON_MIN_NEW YAMJ_CRON_HOUR=$YAMJ_CRON_HOUR_NEW YAMJ_CRON_DAY=$YAMJ_CRON_DAY_NEW YAMJ_CRON_MONTH=$YAMJ_CRON_MONTH_NEW YAMJ_CRON_WEEKDAY=$YAMJ_CRON_WEEKDAY_NEW YAMJ_RUN_SCRIPT=$YAMJ_RUN_SCRIPT_NEW YAMJ_RUN_SCRIPT_OUT=$YAMJ_RUN_SCRIPT_OUT_NEW # Add new YAMJ CRON job yamj_addcron else # Save new settings YAMJ_CRON_MIN=$YAMJ_CRON_MIN_NEW YAMJ_CRON_HOUR=$YAMJ_CRON_HOUR_NEW YAMJ_CRON_DAY=$YAMJ_CRON_DAY_NEW YAMJ_CRON_MONTH=$YAMJ_CRON_MONTH_NEW YAMJ_CRON_WEEKDAY=$YAMJ_CRON_WEEKDAY_NEW YAMJ_RUN_SCRIPT=$YAMJ_RUN_SCRIPT_NEW YAMJ_RUN_SCRIPT_OUT=$YAMJ_RUN_SCRIPT_OUT_NEW fi fi fi # Check if download location changed if [ "$YAMJ_DOWNLOAD_LOCATION_NEW" != "$YAMJ_DOWNLOAD_LOCATION" ] ; then # Check if new download location exists if [ ! -d $YAMJ_DOWNLOAD_LOCATION_NEW ] ; then # Create new download location mkdir --parents $YAMJ_DOWNLOAD_LOCATION_NEW logit "New download location created" fi # Check if download location exists if [ -d $YAMJ_DOWNLOAD_LOCATION ] ; then # Move any existing files to new download location cp --force --recursive ${YAMJ_DOWNLOAD_LOCATION}/* ${YAMJ_DOWNLOAD_LOCATION_NEW} rm --force --recursive ${YAMJ_DOWNLOAD_LOCATION} logit "Moved existing files from ${YAMJ_DOWNLOAD_LOCATION} (removed folder) to ${YAMJ_DOWNLOAD_LOCATION_NEW}" else logit "No download location currently exists - Nothing to do" fi fi YAMJ_DOWNLOAD_LOCATION=$YAMJ_DOWNLOAD_LOCATION_NEW write_cfg } ################### # M A I N ################### # YAMJ plugin folder on boot flash drive YAMJ_PLUGIN_PATH="/boot/config/plugins/yamj" # YAMJ status file used for WEBUI updates STATUS_FILE="/usr/local/emhttp/plugins/yamj/yamj.status" [ -f ${YAMJ_PLUGIN_PATH}/yamj.cfg ] && source ${YAMJ_PLUGIN_PATH}/yamj.cfg [ -f $STATUS_FILE ] && source $STATUS_FILE case "$1" in 'updatecfg') yamj_updatecfg ;; 'writecfg') write_cfg ;; 'getonlineversions') yamj_getonlineversions ;; 'getlocalversions') yamj_getlocalversions ;; 'getplgversions') yamj_getplgversions ;; 'downloadfnl') yamj_download_fnl ;; 'downloadsnp') yamj_download_snp ;; 'updateplg') yamj_updateplg ;; 'boot') yamj_boot ;; 'writestatus') write_status ;; 'runscript') yamj_runscript ;; *) echo "usage $0 cron_add | updatecfg | writecfg | updateplg | getplgversions" esac ]]> ############################################ # Event handlers ############################################ ############################################ # Files required to hook the plugin into the unRaid webGui menu system ############################################ ############################################ # The page file defines which menu page the plugin will appear on ############################################ ############################################ # WEBUI page ############################################
Status

Local YAMJ : YAMJ folder does not exist YAMJ version file does not exist in YAMJ folder v r

Currently defined Scheduled YAMJ Scan in crontab: No Scheduled YAMJ Scan defined



Package Online Version Downloaded Version
YAMJ Stable v r No online stable version OFFLINE v No downloaded stable version Download location does not exist
YAMJ Snapshot v r No online snapshot version OFFLINE v r No downloaded snapshot version Download location does not exist
YAMJ Plugin v No online plugin OFFLINE v No local plugin

Stable version taken from MovieJukebox on Googlecode

Snapshot version taken from YAMJ on Omertron's Media Player Site

unRAID forum thread for YAMJ Plugin for unRAID v5

Actions


Control Actions
Run YAMJ script in background now
No Control Actions available


Version Actions
Stable ONLINE version different than Stable LOCAL version
Snapshot ONLINE version different than Snapshot LOCAL version
ONLINE Plugin version different than LOCAL Plugin version
No Version Actions available




Configuration
Mount and Startup options
Check & Update Plugin during array mount:
Download Latest YAMJ Stable version during array mount:
Download Latest YAMJ Snapshot version during array mount:
Add CRON job for YAMJ during array mount:


YAMJ Settings
YAMJ folder (existing installation):
YAMJ download folder (Will move existing files):
Schedule YAMJ Scan Settings
Script used for running YAMJ scan:
Log file to output YAMJ scan (use /dev/null for no log):
- To remove scheduled YAMJ scan clear all fields below
- See here for options
Minutes: Hours: Days: Months: Weekdays:




]]>
############################################ # WEBUI Submit page ############################################ ]]> ############################################ # WEBUI Run Script in BackGround page ############################################ ]]>