Permalink
Browse files

Use the JSON feed Drew kindly set up. Calling this 1.0.0

  • Loading branch information...
1 parent a514b23 commit 960dc94bc673848e8a710254009fb8afdad08b9a @ches committed Jan 9, 2011
Showing with 19 additions and 24 deletions.
  1. +2 −6 README.rst
  2. +16 −17 bundle/Contents/Code/__init__.py
  3. +1 −1 bundle/Contents/config.yml
View
@@ -40,11 +40,6 @@ two additional build dependencies:
Then, just run ``rake package`` and check the ``dist`` directory.
-To Do
-=====
-
-- More reliable method of finding episode thumbnails
-
License
=======
@@ -53,7 +48,8 @@ Under the same terms as Plex, GPLv2.
Thanks
======
-This, my first Plex plugin, is essentially a bunch of copy and paste!
+This, my first Plex plugin, began as a bunch of copy and paste! (Please Plex,
+update the documentation for plugin developers one of these days...).
- Basically a clone of David Leatherman's `Railscasts plugin`_.
- Rake build script cribbed from Rick Fletcher's `MLB plugin`_. Probably
@@ -1,9 +1,9 @@
import htmlentitydefs
import re
-from urlparse import urlparse
+from datetime import datetime
+from email.utils import parsedate
-VIMCASTS_FEED_URL = 'http://vimcasts.org/feeds/quicktime'
-VIMCASTS_EP_THUMB = 'http://vimcasts.org/images/posters/%s.png'
+VIMCASTS_FEED_URL = 'http://vimcasts.org/episodes.json'
VIMCASTS_ICON = 'icon-default.png'
VIMCASTS_ART = 'art-default.png'
@@ -17,22 +17,21 @@ def Start():
@handler('/video/vimcasts', L('vimcasts'))
def VideoMenu():
dir = MediaContainer(mediaType='video', viewGroup='Details')
- feed_items = XML.ElementFromURL(VIMCASTS_FEED_URL).xpath('//item')
- for item in feed_items:
+ episodes = JSON.ObjectFromURL(VIMCASTS_FEED_URL)['episodes']
+ episodes.reverse() # Newest first
+ for episode in episodes:
try:
- url = item.find('enclosure').get('url')
+ url = episode['quicktime']['url']
+ title = F('episode', episode['episode_number'], episode['title'])
+ date = parsedate(episode['published_at'])
+ date = datetime(*date[:6])
+ summary = dehtmlize(episode['abstract'].strip())
+ thumb = episode['poster']
+ dir.Append(VideoItem(url, title=title, summary=summary, thumb=thumb,
+ subtitle=date.strftime('%A, %B %e %Y')))
except AttributeError:
- # Probably the feed has an entry without an enclosure
- pass
- else:
- # Example path: /videos/24/vimrc_on_the_fly.m4v
- path_parts = urlparse(url).path.split('/')[1:]
- title = F('episode', path_parts[1], item.find('title').text)
- date = item.find('pubDate').text
- description = dehtmlize(item.find('description').text.strip())
- thumb = VIMCASTS_EP_THUMB % path_parts[-1].split('.')[0]
- dir.Append(VideoItem(url, title=title, summary=description,
- subtitle=date[0:-15], thumb=thumb))
+ Log("Something odd with episode, skipping: %s" %
+ episode, debugOnly=False)
return dir
##
@@ -10,7 +10,7 @@ default: &default
PLUGIN_ID: com.plexapp.plugins.vimcasts
PLUGIN_NAME: Vimcasts
PLUGIN_PREFIX: /video/vimcasts
- PLUGIN_VERSION: 0.9.1
+ PLUGIN_VERSION: 1.0.0
PLUGIN_AUTHOR: Ches Martin <ches@whiskeyandgrits.net>
PLUGIN_DESCRIPTION: |
Vimcasts publishes regular screencasts about the Vim text editor. Episodes

0 comments on commit 960dc94

Please sign in to comment.