ZeroQI / YouTube-Agent.bundle

Plex Metadata Agent for Movies and TV Series libraries
452 stars 43 forks source link

[Rating] ZeroDivisionError: integer division or modulo by zero #23

Closed florianbussmann closed 5 years ago

florianbussmann commented 5 years ago

Description

If a video has not been rated yet, the agent runs in a ZeroDivisionError.

i. e. as of now the following video has no likes/dislikes: https://www.youtube.com/watch?v=4VAgWv2xy_g local file V:\YouTube.com\IPD_FH_Munster [UC5NpHVsqNcs4nnVXnhD2cig]\20181127 - NewWork-_Mitarbeiter_im_Digitalen_Unternehmen [4VAgWv2xy_g].mp4

com.plexapp.agents.youtube.log

2019-01-10 17:14:31,464 (7f68a3d11700) :  INFO (__init__:352) - Season: 2018
2019-01-10 17:14:31,465 (7f68a3d11700) :  INFO (__init__:360) - metadata.seasons[2018].episodes[  1] "20181127 - New_Work_-_Mitarbeiter_im_Digitalen_Unternehmen [4VAgWv2xy_g].mp4"
2019-01-10 17:14:31,465 (7f68a3d11700) :  INFO (__init__:383) - # videoId [4VAgWv2xy_g] not in Playlist/channel item list so loading video_details
2019-01-10 17:14:31,483 (7f68a3d11700) :  DEBUG (networking:166) - Requesting 'https://www.googleapis.com/youtube/v3/videos?part=snippet,contentDetails,statistics&id=4VAgWv2xy_g&key=AIzaSyBufx_Ed1j9LGZi9P4BelUALnz_JzQFaGM'
2019-01-10 17:14:31,675 (7f68a3d11700) :  DEBUG (networking:166) - Requesting 'https://i.ytimg.com/vi/4VAgWv2xy_g/sddefault.jpg'
2019-01-10 17:14:31,838 (7f68a3d11700) :  DEBUG (networking:198) - Not caching 'https://i.ytimg.com/vi/4VAgWv2xy_g/sddefault.jpg' (content type 'image/jpeg' not cacheable in Agent plug-ins)
2019-01-10 17:14:31,839 (7f68a3d11700) :  CRITICAL (agentkit:1078) - Exception in the update function of agent named 'YouTube', called with guid 'com.plexapp.agents.youtube://youtube|UC5NpHVsqNcs4nnVXnhD2cig|IPD_FH_Munster [UC5NpHVsqNcs4nnVXnhD2cig]?lang=xn' (most recent call last):
  File "/volume1/@appstore/Plex Media Server/Resources/Plug-ins-cc260c476/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/agentkit.py", line 1076, in _update
    agent.update(obj, media, lang, **kwargs)
  File "/volume1/Plex/Library/Application Support/Plex Media Server/Plug-ins/YouTube-Agent.bundle/Contents/Code/__init__.py", line 427, in update
    def update (self, metadata, media, lang, force ):  Update (metadata, media, lang, force,  False)
  File "/volume1/Plex/Library/Application Support/Plex Media Server/Plug-ins/YouTube-Agent.bundle/Contents/Code/__init__.py", line 395, in Update
    rating                          = float(10*int(video_details['statistics']['likeCount'])/(int(video_details['statistics']['dislikeCount'])+int(video_details['statistics']['likeCount'])))
ZeroDivisionError: integer division or modulo by zero