Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

show a notification when a feed has no (implemented) media enclosures

  • Loading branch information...
commit 34aa6290c7c1af519c7e52035b9ea837ad1386c2 1 parent bb2d6a9
@dersphere authored
View
16 addon.py
@@ -18,7 +18,8 @@
#
from xbmcswift2 import Plugin, xbmc
-from resources.lib.api import ItunesPodcastApi, NetworkError
+from resources.lib.api import \
+ ItunesPodcastApi, NetworkError, NoEnclosureException
plugin = Plugin()
api = ItunesPodcastApi()
@@ -33,7 +34,8 @@
'audio': 30006,
'add_to_my_podcasts': 30010,
'remove_from_my_podcasts': 30011,
- 'network_error': 30200
+ 'network_error': 30200,
+ 'no_media_found': 30007,
}
@@ -101,9 +103,13 @@ def show_podcasts(content_type, genre_id):
@plugin.route('/<content_type>/podcast/items/<podcast_id>/')
def show_items(content_type, podcast_id):
- podcast_items = api.get_podcast_items(
- podcast_id=podcast_id
- )
+ try:
+ podcast_items = api.get_podcast_items(
+ podcast_id=podcast_id
+ )
+ except NoEnclosureException:
+ plugin.notify(msg=_('no_media_found'))
+ return plugin.finish(succeeded=False)
return __add_podcast_items(content_type, podcast_id, podcast_items)
View
1  resources/language/English/strings.xml
@@ -7,6 +7,7 @@
<string id="30004">Search</string>
<string id="30005">Video Podcasts</string>
<string id="30006">Audio Podcasts</string>
+ <string id="30007">No Video/Music found!</string>
<!-- Context Menu -->
<string id="30010">Add to "My Podcasts"</string>
<string id="30011">Remove from "My Podcasts"</string>
View
1  resources/language/German/strings.xml
@@ -7,6 +7,7 @@
<string id="30004">Suche</string>
<string id="30005">Video Podcasts</string>
<string id="30006">Audio Podcasts</string>
+ <string id="30007">Kein Video/Musik gefunden!</string>
<!-- Context Menu -->
<string id="30010">Zu "Meine Podcasts" hinzufügen</string>
<string id="30011">Von "Meine Podcasts" entfernen</string>
View
2  resources/lib/api.py
@@ -204,7 +204,7 @@ def __get_enclosure_link(node):
'rights': content['feed'].get('copyright')
})
if not items:
- raise NotImplementedError
+ raise NoEnclosureException
return items
def search_podcast(self, search_term, limit=50):
Please sign in to comment.
Something went wrong with that request. Please try again.