Jump to content

Refresh Episode metadata after added to library


Jdiesel

Recommended Posts

ginjaninja
2 hours ago, diogee said:

+1 to this
I'd rather not use the "refresh every 30/60/90 days" library options as that's overkill in my opinion, I don't need every added item refreshed repeatedly.
Instead I currently use a Scripter-X plugin to trigger a script I threw together which refreshes an added episode a few days after it is initially scanned into emby.
Doesn't always work but seems to do the trick at least 90% of the time.
I originally did this to fetch thumbnail images for anime/tv shows as I dont like how emby uses embeded art for episode thumbs (if its available) and extracting thumbs from video usually gives a poor quality thumbnail as well so I prefer fetching from a metadata provider but as it takes a few days for thumbnails/ episode information to pop up in providers, had to throw something together myself

Something native to Emby would definitely be very beneficial and much appreciated

you beat me to it, i was going to write the same, if you are happy to share your script i be interested.

i cant find the api endpoint / /items field , which provides the last fetch date/time of an id any ideas?

 

 

 

Link to comment
Share on other sites

diogee

I stripped out the parts that aren't relevant to how I have it handling things currently but I'm pretty sure I got everything
Just make sure you change the emby host/api details and adapt variables as necessary for your own config
I should probably also add that I run my emby server on a linux host so it uses sh scripts, should be easy enough to convert to windows though 

ScripterX > onMediaItemAdded

Run /var/lib/emby/scripts/MediaItemAdded.sh using /bin/bash
"%item.isvirtual%" "%item.id%" "%item.path%"

%item.isvirtual% (to make sure it only handles episodes that actually exist on disk)
%item.id% (tells emby exactly what item to refresh)
and, for me at least, %item.path% (only used because of a sonarr change file date configuration)

#!/bin/bash

virtualitem="${1}"    # %item.isvirtual%
itemid="${2}"         # %item.id%
itempath="${3}"       # %item.path%

if [ "$virtualitem" == "False" ]; then
  if [[ "$itemtype" == "Episode" ]]; then
    touch -r "${itempath}" "/var/lib/emby/scripts/addeditems/${itemid}" # I use this because sonarr changes file date to air date and this copies that information to the temp file
    # touch "/var/lib/emby/scripts/addeditems/${itemid}" # Use this one instead if the above doesn't work for you
  fi
fi

 

 

 

ScripterX > onScheduledTask

Run /var/lib/emby/scripts/AutoRescanItems.sh using /bin/bash
No variables needed for this one
 

#!/bin/bash

embyip="127.0.0.1"
embyport="8096"
apikey="123"

# Change +5 to amount of days to wait before refreshing the item
for filename in $(find /var/lib/emby/scripts/addeditems -type f -mtime +5)
do
  #===============================================================================
  itemid=$(basename $filename)
  # Tell Emby to refresh items metadata
  curl --data '' \
      "http://${embyip}:${embyport}/emby/Items/$itemid/Refresh?Recursive=true&ImageRefreshMode=FullRefresh&MetadataRefreshMode=FullRefresh&ReplaceAllImages=true&ReplaceAllMetadata=true&api_key=${apikey}"
  # Remove itemid
  rm /var/lib/emby/scripts/addeditems/$itemid
done

 

 

And lastly
Emby Scheduled Tasks > Emby ScripterX Scheduled Task
Triggers: Every hour
 

It's nothing fancy by any means and can probably be handled in better ways but for me it works until a similar feature can be implemented

Edited by diogee
Simplified / Added note about linux
  • Thanks 2
Link to comment
Share on other sites

  • 2 months later...
SuperMinecraftKid

I see that I'm quite late to the party but I've had this project out for several months. However, I didnt put too much effort in spreading the word. This collection of scripts was made for the same reasons that @diogee mentioned.

 

My solution to this problem is complete with a few features.

  • Checks for placeholder titles such as "Episode XX" or "TBA"
  • Checks for placeholder thumbnails
  • Ability to refresh episodes multiple times until a certain amount of days pass
  • View all the episodes being tracked in the database
  • Bulk check library. All of the library or by year.

I call it noTBA for ScripterX. Check it out and let me know what you think! seansusmilch/noTBA-scripterx

Edited by SuperMinecraftKid
Link to comment
Share on other sites

  • 3 months later...
nuentes

+1

This feature is needed more and more these days. Much of the content from streaming services do not have metadata available immediately. I get a lot of episodes named TBA.

I also want this for movies - refresh after a couple days to get a more accurate star rating.

Only new content needs to be refreshed. I don't want the 30/60/90 refresh, as I only want to refresh tv shows that were released in the last x days and movies released in the last y days. It might even make more sense to perform this via a plugin.

Link to comment
Share on other sites

  • 4 months later...
Magenof

+1 would love a scheduled task that would scan for missing metadata in tv shows for the whole library instead of having to do it manually.

  • Like 1
  • Agree 1
Link to comment
Share on other sites

  • 1 month later...
K22R8CT

+2

I explored the API, EmbyPy, Scripter X (which appears to have been removed from the catalog.)

Best I can tell an add-on fix would be a lot more complex than an internal fix:

  • Schedule Task for Refresh (missing) metadata

Is the concern that some items might have perpetually-missing metadata, which would cause an unreasonable number of queries?

If so, could avoid that with Refresh (missing) metadata for recently-added items where Recent is a week.

Link to comment
Share on other sites

ginjaninja
50 minutes ago, Anon28109 said:

Scripter X (which appears to have been removed from the catalog.)

 

image.png.1c77f6eca4e66040468e8154b4ce0665.png

 

 

showing for me (am on beta)

  • Thanks 1
Link to comment
Share on other sites

  • 4 months later...
  • 5 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...