Crash when fetching metadata for channel with no banner
bcc32 opened this issue · comments
Aaron Zeng commented
In #83, the resolution of the fetched banner image was improved, but unfortunately there's now a bug for channels with no banner image. Originally, the channel thumbnail was used as the fallback, but now the plugin crashes:
2021-05-19 21:53:05,130 (7f5a737fe700) : INFO (__init__:165) - === update(lang=xn, force=True, movie=False) ===
2021-05-19 21:53:05,130 (7f5a737fe700) : INFO (__init__:40) - /srv/share/plex/YouTube Series/[UC-ioUzg5ILGU8m2zX28qHGQ] Jacob Dykstra/Home Server Rack Basic Explanation of Everything [PTBnFjtiCw8].webm
2021-05-19 21:53:05,130 (7f5a737fe700) : INFO (__init__:262) - =============================================================================================================================================================
2021-05-19 21:53:05,130 (7f5a737fe700) : INFO (__init__:252) - [ ] library: "YouTube Series"
2021-05-19 21:53:05,131 (7f5a737fe700) : INFO (__init__:253) - [ ] root: "/srv/share/plex/YouTube Series"
2021-05-19 21:53:05,131 (7f5a737fe700) : INFO (__init__:254) - [ ] path: "[UC-ioUzg5ILGU8m2zX28qHGQ] Jacob Dykstra"
2021-05-19 21:53:05,131 (7f5a737fe700) : INFO (__init__:255) - [ ] dir: "/srv/share/plex/YouTube Series/[UC-ioUzg5ILGU8m2zX28qHGQ] Jacob Dykstra"
2021-05-19 21:53:05,131 (7f5a737fe700) : INFO (__init__:260) - [ ] series_root_folder: "/srv/share/plex/YouTube Series/[UC-ioUzg5ILGU8m2zX28qHGQ] Jacob Dykstra"
2021-05-19 21:53:05,131 (7f5a737fe700) : INFO (__init__:263) - [ ] subfolder_count: "0"
2021-05-19 21:53:05,131 (7f5a737fe700) : INFO (__init__:385) - Grouping folder not found or single folder, root: /srv/share/plex/YouTube Series, path: [UC-ioUzg5ILGU8m2zX28qHGQ] Jacob Dykstra, Grouping folder: [UC-ioUzg5ILGU8m2zX28qHGQ]>
2021-05-19 21:53:05,132 (7f5a737fe700) : DEBUG (networking:138) - Fetching 'https://www.googleapis.com/youtube/v3/channels?part=snippet%2CcontentDetails%2Cstatistics%2CbrandingSettings&id=UC-ioUzg5ILGU8m2zX28qHGQ&key=AIzaSyBRaHK-BS_JN4a>
2021-05-19 21:53:05,133 (7f5a737fe700) : INFO (__init__:385) - [ ] title: " Jacob Dykstra", metadata.title: " Jacob Dykstra"
2021-05-19 21:53:05,133 (7f5a737fe700) : INFO (__init__:385) - [ ] summary: "Channel with 106 videos, 18900 subscribers, 3758875 views"
2021-05-19 21:53:05,134 (7f5a737fe700) : INFO (__init__:377) - [X] art: =s1920
2021-05-19 21:53:05,134 (7f5a737fe700) : DEBUG (networking:143) - Requesting '=s1920'
2021-05-19 21:53:05,134 (7f5a737fe700) : CRITICAL (agentkit:1095) - Exception in the update function of agent named 'YouTubeSeries', called with guid 'com.plexapp.agents.youtube://youtube|UC-ioUzg5ILGU8m2zX28qHGQ|[UC-ioUzg5ILGU8m2zX28qH>
File "/nix/store/3jwfhb5nfgykwmp4ill0jzdhbg4lwkka-plexmediaserver-1.22.3.4523-d0ce30438/lib/plexmediaserver/Resources/Plug-ins-d0ce30438/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/agentkit.py", line 1093, in _u>
agent.update(obj, media, lang, **kwargs)
File "/srv/share/plex/data/Plex Media Server/Plug-ins/YouTube-Agent.bundle/Contents/Code/__init__.py", line 516, in update
def update (self, metadata, media, lang, force ): Update (metadata, media, lang, force, False)
File "/srv/share/plex/data/Plex Media Server/Plug-ins/YouTube-Agent.bundle/Contents/Code/__init__.py", line 377, in Update
if thumb and thumb not in metadata.art: Log(u'[X] art: {}'.format(thumb)); metadata.art [thumb] = Proxy.Media(HTTP.Request(thumb).content, sort_order=1)
File "/nix/store/3jwfhb5nfgykwmp4ill0jzdhbg4lwkka-plexmediaserver-1.22.3.4523-d0ce30438/lib/plexmediaserver/Resources/Plug-ins-d0ce30438/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/components/networking.py", line 24>
return self.__str__()
File "/nix/store/3jwfhb5nfgykwmp4ill0jzdhbg4lwkka-plexmediaserver-1.22.3.4523-d0ce30438/lib/plexmediaserver/Resources/Plug-ins-d0ce30438/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/components/networking.py", line 22>
self.load()
File "/nix/store/3jwfhb5nfgykwmp4ill0jzdhbg4lwkka-plexmediaserver-1.22.3.4523-d0ce30438/lib/plexmediaserver/Resources/Plug-ins-d0ce30438/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/components/networking.py", line 15>
f = self._opener.open(req, timeout=self._timeout)
File "/nix/store/3jwfhb5nfgykwmp4ill0jzdhbg4lwkka-plexmediaserver-1.22.3.4523-d0ce30438/lib/plexmediaserver/Resources/Python/lib/python2.7/urllib2.py", line 421, in open
protocol = req.get_type()
File "/nix/store/3jwfhb5nfgykwmp4ill0jzdhbg4lwkka-plexmediaserver-1.22.3.4523-d0ce30438/lib/plexmediaserver/Resources/Python/lib/python2.7/urllib2.py", line 283, in get_type
raise ValueError, "unknown url type: %s" % self.__original
ValueError: unknown url type: =s1920
I think the fix should be pretty simple, I'll submit a PR soon.
Micah Morrison commented
Apologies for breaking this, and thanks for the fix @bcc32!!