ZeroQI / Lambda.bundle

Local Media Export, a reverse Plex 'Local Media Assets' agent to export metadata locally
GNU General Public License v3.0
134 stars 18 forks source link

Poster.jpg not created/updated after metadata refresh #11

Closed hergonoway closed 4 years ago

hergonoway commented 4 years ago

Hello,

I've got an issue when sometimes during metadata refresh, poster.jpg is not created/updated. Basically I use Lambda on Server 1 to backup nfo and poster in local, so Server 2 will pick up the poster choosen by Server 1 through a master/slave logic. My problem is on Server 1

Server 1 image

Prefs in /Plug-in Support/Preferences/com.plexapp.agents.lambda.xml

<?xml version='1.0' encoding='utf-8'?>
<PluginPreferences>
  <collection_nfo>0</collection_nfo>
  <collection_poster/>
  <metadata_source>2</metadata_source>
  <artist_fanart/>
  <series_themes/>
  <album_fanart/>
  <collection_fanart/>
  <artist_poster/>
  <movies_poster>1</movies_poster>
  <season_banner>0</season_banner>
  <season_fanart/>
  <collection_resume>0</collection_resume>
  <series_poster>2</series_poster>
  <reset_to_defaults>false</reset_to_defaults>
  <series_nfo>1</series_nfo>
  <movies_fanart/>
  <movies_nfo>1</movies_nfo>
  <artist_nfo/>
  <series_banner>1</series_banner>
  <episode_nfo>0</episode_nfo>
  <series_fanart/>
  <collection_folder>0</collection_folder>
  <episode_thumbs/>
  <album_nfo/>
  <album_poster/>
  <season_poster>0</season_poster>
</PluginPreferences>

Server 2 image

Today I had this issue again, while passing by my library to update low res posters, I've changed the poster in Plex (through the UI), hit metadata refresh on the show, waited, but nothing :

Here's the target folder : image

Here's the content of the nfo file generated by lambda when I've added the show in the above picture few weeks ago (just in case) :

<?xml version='1.0' encoding='utf-8'?>
<tvshow xsi="http://www.w3.org/2001/XMLSchema-instance" xsd="http://www.w3.org/2001/XMLSchema">
  <uniqueid default="true" type="anidb">7113</uniqueid>
  <title>Hyakko Extra [OVA] [anidb-7113]</title>
  <runtime>0</runtime>
  <dateadded>2020-03-12 23:36:26</dateadded>
  <path>/data/Anime/Librairie/[All]/Hyakko Extra [OVA][anidb-7113]</path>
  <basepath>/data/Anime/Librairie/[All]/Hyakko Extra [OVA][anidb-7113]</basepath>
  <playcount>0</playcount>
</tvshow>

I've tried the Plex Dance, redo the association, reboot the server, nothing. The plugin is up to date and installed with UAS.

Here is the log file : com.plexapp.agents.lambda.log

Brandonb2014 commented 4 years ago

I have two guesses of what is causing this.

1) If it's not creating/saving your jpg file for ANY of your movies then you need to set the Agent to Plex Movie in the Advanced settings of the library image

2) If it's not creating/saving your jpg file for this specific movie then you may have used the "Fix Match" option and chose a different Agent. I've done this before if the Plex Movie Agent can't find a specific movie, but "The Movie Database" can, then to discover that the movie poster/background won't save now. image

Is it either of those two scenarios? I understand these scenarios are for movies, but I believe the same rule applies to TV Shows

hergonoway commented 4 years ago

Hello, no I've checked that the good agent is selected for the library (as I said the problem is not always, it's sometimes) and double check the agent selected when I've remade the association to try to fix the issue. :/

ZeroQI commented 4 years ago

Answer is in the log file

2020-04-01 02:46:58,819 (7f57f8ff9700) :  INFO (__init__:87) - nfo_load("{}...", "/data/Anime/Librairie/[All]/Hyakko Extra [OVA][anidb-7113]", "series_nfo") - nfo_file: "/data/Anime/Librairie/[All]/Hyakko Extra [OVA][anidb-7113]/tvshow.nfo"
2020-04-01 02:46:58,821 (7f57f8ff9700) :  INFO (__init__:634) - PLEX_URL_TVSHOWS - Exception: 'float() argument must be a string or a number'

nfo_load is located line 73-90 but doesn't have float

[068] xml = XML.ElementFromURL(URL.format(key, count, window), timeout=float(TIMEOUT)) [307] PLEX_LIBRARY_XML = XML.ElementFromURL(PMSSEC, timeout=float(TIMEOUT)) [450] xml = XML.ElementFromURL(PMSMETA.format(ratingKey), timeout=float(TIMEOUT))

[368] date_added = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(float(video.get('addedAt')))) [420] date_added = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(float(show.get('addedAt'))))

try replacing in line 368 and 420: if show.get('addedAt'): date_added = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(float(show.get('addedAt'))))

hergonoway commented 4 years ago

Stop plex, made the changes, start plex, it metadata refresh on 2 problematic shows (Stein Gates and Hyakko Extra ) but still no poster or banner :/

nfo of these 2 shows has been updated tho

here are the cahnges I've made : image image

here's new log : com.plexapp.agents.lambda.log

hergonoway commented 4 years ago

tried to reinstall and reset prefs for lambda, still the issue. Is there something specific to search in the log about where the choice of replacing the local poster.jpg or not is done ?

ZeroQI commented 4 years ago

The logs are incomplete so cannot say... Please refresh metadata for one series, then check the logs contain the update call and all logs afterwards and can sort it

hergonoway commented 4 years ago

So,

I've copied the log at 22h34 : com.plexapp.agents.lambda-2020-04-01-2234.log

I press refresh metadata of "Ookami to Koushinryou II" at 22h35:00 and wait 30sec.

I've copied the log at 22h35:30 : com.plexapp.agents.lambda-2020-04-01-2235-30.log

There's this line, is the update call your looking for ? :

2020-04-01 22:35:04,860 (7fc0c77fe700) :  INFO (__init__:288) - Update(metadata, media="Ookami to Koushinryou II", lang="en", force=True, agent_type=show)

EDIT : I've checked 20 min later, there's no new log after 2020-04-01 22:35:12,962

ZeroQI commented 4 years ago

2020-04-01 22:25:08,537 (7fc0c77fe700) : INFO (__init__:685) - PLEX_URL_TVSHOWS - Exception: 'local variable 'date_added' referenced before assignment' It is a by-product of the change i recommended...

try replacing in line 368 and 420: date_added = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(float(show.get('addedAt')))) if show.get('addedAt') else None

hergonoway commented 4 years ago

well your by-product seems to have done the trick. It's working as expected now \o/

I've just tried to update 30 random show, all local poster.jpg has been updated

ZeroQI commented 4 years ago

both lines weren't identical, so movies fixed too now Was an important bug, thanks for reporting and logs