Hi, i try to build a small agent to write FSK (German Age Rating) to my TV Shows. For Movies it runs fine, but for TV Shows i have problems saving the data.
I get my fsk Data and jumping to the update function, all fine.
i tried like on movies
metadata.content_Rating = 'my value'
but every time there is still the old value inside. I moved my agent to the second place in order and the last one, no changes. I have no idea what it could be, any ideas? Do you need more info then please tell me.
i see in the logs that the update function runs, for example i set metadata..content_rating = 'de/12' and after that i read it with Log(metadata.content_rating) it shows me the 'de/12'. But the tv show is not updated with that info.
metadata.content_rating = 'de/12' is correct. Is your agent on top of all the other agents? That way your agent should contribute the content_rating to final metadata. If there are other agents on top of yours it could be that they provide and (empty?) content_rating.
metadata.content_rating = 'de/12' is correct. Is your agent on top of all the other agents? That way your agent should contribute the content_rating to final metadata. If there are other agents on top of yours it could be that they provide and (empty?) content_rating.
Can we maybe see your code somewhere?
Here it is, still work in progress and it is my first try so please be friendly with my ugly code :rolleyes:
# No need for urllib imports as we can use Plex Framework functions for what we want to do.
def Start():
HTTP.CacheTime = CACHE_1WEEK
# There's no need for saving stuff in Dicts, we can just use the title as an id to find
# the movie and pass that from the search to the update function.
class germanFskAgentTvShows(Agent.TV_Shows):
name = 'German Fsk TV Shows'
primary_provider = False
languages = [Locale.Language.English, 'de']
contributes_to = [
'com.plexapp.agents.thetvdb',
'com.plexapp.agents.themoviedb'
]
def search(self, results, media, lang, manual):
movie_title = media.primary_metadata.title
results.Append(MetadataSearchResult(
id = String.Quote(movie_title), # Use Plex Framework function String.Quote() to URL encode the title value, instead of urllib
score = 100,
lang = lang
))
def update(self, metadata, media, lang):
# Use Plex Framework HTTP.Request(...).content instead of urllib.
content_rating = HTTP.Request('http://192.168.1.53/fskApi.php?title=%s&type=tv' % (metadata.id)).content # We fill in the URL encoded title to look up the content rating
if content_rating == '100': # FSK o.A. == 0 (there's only an image for 0)
content_rating = '0'
metadata.content_rating = 'de/%s' % (content_rating)