Missing keys for toplist podcast
Hi All,
I'm running gPodder v3.10.17 on FreeBSD (TrueNAS), and when I try to search for a podcast, I get the following error.
It also occur when I just run the toplist command.
Unfortunately the Ports version of gPodder for FreeBSD is about two years old, so I'm not sure if this issue has been fixed within the last two years, in more recent releases.
Until Ports gets updated, is there anything I can do to get this working?
gpo> search "Anjunabeats"
1664265273.646899 [gpodder.log] ERROR: Uncaught exception: Traceback (most recent call last):
File "/usr/local/bin/gpo", line 1258, in <module>
main()
File "/usr/local/bin/gpo", line 1252, in main
cli._shell()
File "/usr/local/bin/gpo", line 1111, in _shell
self._parse(args)
File "/usr/local/bin/gpo", line 1221, in _parse
return self._checkargs(func, command_line)
File "/usr/local/bin/gpo", line 1141, in _checkargs
return func(*command_line)
File "/usr/local/bin/gpo", line 738, in search
results = directory.search(query)
File "/usr/local/lib/python3.9/site-packages/gpodder/my.py", line 665, in search
for p in self.client.search_podcasts(query)
File "/usr/local/lib/python3.9/site-packages/mygpoclient/public.py", line 161, in search_podcasts
return [simple.Podcast.from_dict(x) for x in self._client.GET(uri)]
File "/usr/local/lib/python3.9/site-packages/mygpoclient/public.py", line 161, in <listcomp>
return [simple.Podcast.from_dict(x) for x in self._client.GET(uri)]
File "/usr/local/lib/python3.9/site-packages/mygpoclient/simple.py", line 71, in from_dict
raise ValueError('Missing keys for toplist podcast')
ValueError: Missing keys for toplist podcast
Traceback (most recent call last):
File "/usr/local/bin/gpo", line 1258, in <module>
main()
File "/usr/local/bin/gpo", line 1252, in main
cli._shell()
File "/usr/local/bin/gpo", line 1111, in _shell
self._parse(args)
File "/usr/local/bin/gpo", line 1221, in _parse
return self._checkargs(func, command_line)
File "/usr/local/bin/gpo", line 1141, in _checkargs
return func(*command_line)
File "/usr/local/bin/gpo", line 738, in search
results = directory.search(query)
File "/usr/local/lib/python3.9/site-packages/gpodder/my.py", line 665, in search
for p in self.client.search_podcasts(query)
File "/usr/local/lib/python3.9/site-packages/mygpoclient/public.py", line 161, in search_podcasts
return [simple.Podcast.from_dict(x) for x in self._client.GET(uri)]
File "/usr/local/lib/python3.9/site-packages/mygpoclient/public.py", line 161, in <listcomp>
return [simple.Podcast.from_dict(x) for x in self._client.GET(uri)]
File "/usr/local/lib/python3.9/site-packages/mygpoclient/simple.py", line 71, in from_dict
raise ValueError('Missing keys for toplist podcast')
ValueError: Missing keys for toplist podcast
This is a bug in mygpoclient or gpodder.net. The following is returned from gpodder.net:
{
'url': 'https://static.anjunabeats.com/anjunabeats-worldwide/podcast.xml',
'title': 'Anjunabeats Worldwide',
'author': 'Anjunabeats',
'description': 'Anjunabeats Worldwide is a weekly one hour podcast showcasing the latest from\nAnjunabeats artists',
'subscribers': 0,
'logo_url': 'https://static.anjunabeats.com/promos649/Anjunabeats-Worldwide-Avatar2017.png',
'scaled_logo_url': 'http://gpodder.net/logo/64/52c/52c540c58e231d399ab8ea213e3ac6b5c2955c8f',
'website': 'http://static.anjunabeats.com/worldwide/podcast.xml',
'mygpo_link': 'http://gpodder.net/podcast/anjunabeats-worldwide-1'
}
But mygpoclient requires it to contain the following fields:
REQUIRED_FIELDS = ('url', 'title', 'description', 'website', 'subscribers',
'subscribers_last_week', 'mygpo_link', 'logo_url')
And subscribers_last_week is missing.
The same issue with gpodder 3.11 and mygpoclient 1.9. Both gpodder.net search and top50 work fine in GUI tho.
Removing subscribers_last_week from REQUIRED_FIELDS triggers another one:
File "/usr/local/lib/python3.9/site-packages/mygpoclient/simple.py", line 73, in from_dict
return cls(*(d.get(k) for k in cls.REQUIRED_FIELDS))
TypeError: __init__() missing 1 required positional argument: 'logo_url'
That would be caused by not passing subscribers_last_week to __init__, which then causes the last two arguments to shift, leaving nothing in the last position.
def __init__(self, url, title, description, website, subscribers, subscribers_last_week, mygpo_link, logo_url):
Fast fingers, sorry. Works fine with this patch for simple.py
--- simple.py 2022-09-29 11:53:04.102564000 +0300
+++ simple.py.new 2022-09-29 11:52:21.278499000 +0300
@@ -51,16 +51,15 @@
description - The description of the podcast
"""
REQUIRED_FIELDS = ('url', 'title', 'description', 'website', 'subscribers',
- 'subscribers_last_week', 'mygpo_link', 'logo_url')
+ 'mygpo_link', 'logo_url')
def __init__(self, url, title, description, website,
- subscribers_last_week, subscribers, mygpo_link, logo_url):
+ subscribers, mygpo_link, logo_url):
self.url = url
self.title = title
self.description = description
self.website = website
self.subscribers = subscribers
- self.subscribers_last_week = subscribers_last_week
self.mygpo_link = mygpo_link
self.logo_url = logo_url