arr-scripts icon indicating copy to clipboard operation
arr-scripts copied to clipboard

[FEATURE] - Emby Notify Script

Open ChristoffBo opened this issue 2 years ago • 5 comments

Would it be possilbe to add an emby notify script such as plex notify? Or can plex notify be used for emby?

ChristoffBo avatar Nov 26 '23 05:11 ChristoffBo

When I last looked at it, I couldn’t find a way to do targeted scans. If you can find a way to do that and a link to some documentation, I’ll look into it. Because I wanted to implement the same thing for Jellyfin and Emby but couldn’t find a way to accomplish it…

RandomNinjaAtk avatar Nov 26 '23 20:11 RandomNinjaAtk

Would this API help?

https://api.jellyfin.org/#tag/Items/operation/GetItems /Items?artists=YOASOBI&albums=Idol

https://api.jellyfin.org/#tag/ItemRefresh /Items/c44cf79584cf3d3adee49bc97d45055c/Refresh?Recursive=true&ImageRefreshMode=Default&MetadataRefreshMode=Default&ReplaceAllImages=false&ReplaceAllMetadata=false

I might take a look at this. I just wished that I had found your repo sooner before my work break lol.

rairulyle avatar Jan 04 '24 04:01 rairulyle

No, those don't help. There is a feature request for what is needed to make what your asking for possible... But as of now, as far as I can tell, the functionality doesn't exist:

https://features.jellyfin.org/posts/1758/scan-specific-folders-from-a-larger-library

RandomNinjaAtk avatar Jan 04 '24 11:01 RandomNinjaAtk

#!/bin/bash

NOW=$(date +"%d-%m-%Y %H:%M") LOG_FILE="/config/logging/emby_scan.txt" TMP_FILE="/tmp/tmp_emby_radarr.txt" DL_FILE="/config/scripts/dl_radarr.txt" DEL_FILE="/config/scripts/del_radarr.txt" REN_FILE="/config/scripts/ren_radarr.txt" EMBY_URL="" EMBY_RADARR_APIKEY="" local_movie_path="" remote_movie_path=""

if [ "${radarr_eventtype}" != "" ]; then if [ "${radarr_eventtype}" == "ApplicationUpdate" ] || [ "${radarr_eventtype}" == "MovieAdded" ] || [ "${radarr_eventtype}" == "Grab" ] || [ "${radarr_eventtype}" == "HealthIssue" ] || [ "${radarr_eventtype}" == "Test" ]; then (echo "${NOW} - [Emby Library Scan] Radarr Event Type is ${radarr_eventtype}, exiting."; cat ${LOG_FILE}) > ${TMP_FILE}; mv ${TMP_FILE} ${LOG_FILE} exit fi

(echo "${NOW} - [Emby Library Scan] Radarr Event Type is ${radarr_eventtype}, updating Emby Library for ${radarr_movie_title}."; cat ${LOG_FILE}) > ${TMP_FILE}; mv ${TMP_FILE} ${LOG_FILE}

if [ "$radarr_eventtype" == "Download" ]; then echo "${radarr_movie_title} (${radarr_movie_year})" >> ${DL_FILE} UpdateType="Created" Path=$(echo "$radarr_movie_path" | sed "s|$local_movie_path|$remote_movie_path|") fi

if [ "${radarr_eventtype}" == "MovieDelete" ]; then echo "${radarr_movie_title} (${radarr_movie_year})" >> ${DEL_FILE} UpdateType="Deleted" Path=$(echo "$radarr_movie_path" | sed "s|$local_movie_path|$remote_movie_path|") fi

if [ "$radarr_eventtype" == "Rename" ]; then echo "${radarr_movie_title} (${radarr_movie_year})" >> ${REN_FILE} UpdateType="Modified" Path=$(echo "$radarr_movie_path" | sed "s|$local_movie_path|$remote_movie_path|") fi

curl -X POST "${EMBY_URL}/emby/Library/Media/Updated?api_key=${EMBY_RADARR_APIKEY}" -H "accept: */*" -H "Content-Type: application/json" -d "{\"Updates\":[{\"Path\":\"${Path}\",\"UpdateType\":\"${UpdateType}\"}]}"

else (echo "${NOW} - [Emby Library Scan] Radarr Event Type is empty."; cat ${LOG_FILE}) > ${TMP_FILE}; mv ${TMP_FILE} ${LOG_FILE}

fi

write a status file with date of last run. Helps troubleshoot that cron task is running.

echo "$(basename $0) last run was at $(date)" > /config/logging/$(basename $0)_lastrun.txt

abescalamis avatar Jun 02 '24 19:06 abescalamis

I have tried to implement it here, it seems to do the work for me :) https://github.com/RandomNinjaAtk/arr-scripts/pull/306

Allram avatar Sep 14 '24 19:09 Allram