Kodi Community Forum
[RELEASE] Audio and Video Podcast Plugin - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27)
+---- Forum: Music Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=148)
+---- Thread: [RELEASE] Audio and Video Podcast Plugin (/showthread.php?tid=28495)

Pages: 1 2


[RELEASE] Audio and Video Podcast Plugin - Unbehagen - 2007-09-12

Hi there,
here is a new plugin for watching/listening to video/audio Podcasts.
You can put it in the Q:/plugins/video/Podcast or Q:/plugins/music/Podcast directory as default.py.
Before that, you need to edit the script to enter your podcasts in the correct format. This will be put into a seperate file in future versions.
Have Fun!
Code:
#G4.py Version 0.3
#Author Greg Chrystall [email protected]
#Script modded by Brad Quesnell [email protected]
#Note this is the first release, heavily copied from other XBMC Scripts.

import xml.dom.minidom, urllib, os, os.path, xbmc, xbmcgui, string, traceback, time,sys,xbmcplugin

# Setup logging routines
ROOT_DIR = os.getcwd()[:-1]+'\\'
IMAGE_DIR = ROOT_DIR+'images\\'

def LOG(message):
        print message

def LOGCLOSE():
        print "End of log."

itemElements            = ['title','link','pubDate', 'description']
rssFeeds                = {'Kanzlerin' : 'http://www.bundeskanzlerin.de/Webs/BK/DE/Service/RSS/Functions/bundeskanzlerinPodCastRSS20,templateId=renderNewsfeed.xml',
                           'Attack of the Show' : 'http://www.g4tv.com/attackoftheshow/podcasts/5/Attack_of_the_Show_Daily_Video_Podcast.xml',
                           'AOTS: Fresh Ink' : 'http://www.g4tv.com/attackoftheshow/podcasts/21/AOTS_Fresh_Ink.xml',
                           'AOTS: In Your Pants' : 'http://www.g4tv.com/attackoftheshow/podcasts/22/AOTS_In_Your_Pants.xml',
                           'AOTS: Hardware' : 'http://www.g4tv.com/attackoftheshow/podcasts/23/AOTS_Hardware.xml',
                           'AOTS: Game Break' : 'http://www.g4tv.com/attackoftheshow/podcasts/24/AOTS_Game_Break.xml',
                           'G4tv.com Originals' : 'http://www.g4tv.com/g4originals/podcasts/25/G4tvcom_Originals.xml',
                           'Tagesschau':'http://www.tagesschau.de/export/video-podcast/tagesschau',
                           'Cinematech':'http://www.g4tv.com/cinematech/podcasts/8/Cinematech_Video_Podcast.xml',
                           'Cinematech : Nocturnal Emissions':'http://www.g4tv.com/cinematechnocturnalemissions/podcasts/9/Cinematech_Nocturnal_Emissions_Video_Podcast.xml',
                           'Happy Tree Friends':'http://podcast.happytreefriends.com/htfrss.xml',
                           'ICONS':'http://www.g4tv.com/icons/podcasts/17/ICONS_Video_Podcast.xml',
                           'Street Fury':'http://www.g4tv.com/streetfury/podcasts/11/Street_Fury_Video_Podcast.xml',
                           'The Daily Feed':'http://www.g4tv.com/thefeed/podcasts/19/The_Daily_Feed_Video_Podcast.xml',
                           'The Man Show':'http://www.g4tv.com/themanshow/podcasts/14/The_Man_Show_Video_Podcast.xml',
                           'X-Play':'http://www.g4tv.com/xplay/podcasts/6/XPlay_Daily_Video_Podcast.xml',
                           'Ninja Warrior':'http://www.g4tv.com/ninjawarrior/podcasts/27/Ninja_Warrior_Video_Podcast.xml',
                           'Freestyle 101':'http://www.g4tv.com/g4originals/podcasts/26/Freestyle_101_Video_Podcast.xml'
                           }
                            
class G4Viewer:
        def __init__(self,show=None):
                self.feeds = {}
                self.urlsInOrder = []
                if (len(show)<1):
                        self.displayOverview()
                else:
                        print urllib.unquote_plus(sys.argv[2][1:-1])
                        self.displayPodcast(urllib.unquote_plus(show))

        def displayOverview(self):
                for name, url in sorted(rssFeeds.iteritems()):
                        liz=xbmcgui.ListItem(name)
                        ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=sys.argv[0]+"?"+urllib.quote(name),listitem=liz,isFolder=True)

        def displayPodcast(self, show):
                try:
                        self.feeds[show] = FeedItems(rssFeeds[show]).getData()
                except:
                        traceback.print_exc(file=sys.stdout)
                        print "Error! Could not get rss feed: '" + show + "'"
                        return
                for item in self.feeds[show]:
                        name=item.getElement("title")
                        url=item.getElement("mediaUrl")
                        liz=xbmcgui.ListItem(name)
                        ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url,listitem=liz)

class FeedItems:
        def __init__(self, url):
                self.dom = None
                f = urllib.urlopen(url)
                xmlDocument = f.read()
                f.close()
                self.dom = xml.dom.minidom.parseString(xmlDocument)
                self.data = []
                self.extractURLNameDictionary()
                
        
        def extractURLNameDictionary(self):
                items = self.dom.getElementsByTagName("item")
                for item in items:
                        elements = {}
                        for itemElement in itemElements:
                                try:
                                        elements[itemElement] = item.getElementsByTagName(itemElement)[0].childNodes[0].data.strip()
                                        #print itemElement, " = ", item.getElementsByTagName(itemElement)[0].childNodes[0].data
                                except:
                                        pass
                        try:
                                elements["mediaUrl"] = item.getElementsByTagName("enclosure")[0].getAttribute("url").strip()
                        except:
                                try:
                                        elements["mediaUrl"] = item.getElementsByTagName("link")[0].childNodes[0].data.strip()
                                except:
                                        traceback.print_exc(file=sys.stdout)
                                        print "Error - Problem building feed."
                        self.data.append(RSSItem(elements))
                
        def getData(self):
                return self.data
class RSSItem:
        def __init__(self, elements):
                # list that includes required item elements
                self.elements = elements
                
        def getElement(self, element):
                return self.elements[element]
                
        def getElementNames(self):
                return self.elements.keys()
                
        def hasElement(self, element):
                return self.elements.has_key(element)
        
w = G4Viewer(sys.argv[2][1:len(sys.argv[2])])
xbmcplugin.endOfDirectory(int(sys.argv[1]))



- Unbehagen - 2007-09-12

I should probably menton that I borrowed the code from all kinds of other scripts (as mentioned in the header for example)


- Nuka1195 - 2007-09-13

hehe, ninja warrior, that's a good show.


- Unbehagen - 2007-09-13

Hey,
here is the new version of my plugin:
http://rapidshare.com/files/55443817/Podcast2.zip
It now has the ability to parse OPML files with all your favourite podcasts in it. Just put the files in the feeds/ directory.
I already included some huge opml files for you to test this.
Have fun!


- Unbehagen - 2007-09-13

I forgot to mention that you can also put the podcast xml (not the OPML files) into the feeds directory. The format (OPML or podcast) ist autodetected.


- Nuka1195 - 2007-09-13

Do you have a gmail account, if so i can set up a plugins svn on google code


- Unbehagen - 2007-09-13

Nuka, I already have access to the scripts SVN, my account is gerkensm. You can set it up, if you like. Thanks a lot!


- weateallthepies - 2007-09-14

Unbehagen Wrote:Hey,
here is the new version of my plugin:
http://rapidshare.com/files/55443817/Podcast2.zip
It now has the ability to parse OPML files with all your favourite podcasts in it. Just put the files in the feeds/ directory.
I already included some huge opml files for you to test this.
Have fun!

Thanks, thats just what I wanted. Big Grin

Was going to try and write it myself but I'll have to find something else to do now.


- pike - 2007-09-14

sorry to hijack the thread like this but is there a plugin for stage6? (divx videos)


- Unbehagen - 2007-09-14

weateallthepies Wrote:Was going to try and write it myself but I'll have to find something else to do now.

if you really desperately search for something to do, I have an idea: the Uitzendinggemist script has some kind of plugin architecture for the channels. It would awesome to see this as a plugin architecture! Then we would have one single structure for html parsing stuff.


- weateallthepies - 2007-09-14

Unbehagen Wrote:if you really desperately search for something to do, I have an idea: the Uitzendinggemist script has some kind of plugin architecture for the channels. It would awesome to see this as a plugin architecture! Then we would have one single structure for html parsing stuff.

I'm still brushing up my python knowledge, I may have a look at that but it probably won't be very soon I'm afraid.

Was going to grab dynamic opml direct from podnova too so I my add that to podcast plugin. Can then add podcasts to my opml without having to ftp across each time.


- Unbehagen - 2007-09-14

weateallthepies Wrote:I'm still brushing up my python knowledge, I may have a look at that but it probably won't be very soon I'm afraid.

Was going to grab dynamic opml direct from podnova too so I my add that to podcast plugin. Can then add podcasts to my opml without having to ftp across each time.

You can simply put an opml that links to the desired opml address. Have fun!


- weateallthepies - 2007-09-14

Unbehagen Wrote:You can simply put an opml that links to the desired opml address. Have fun!

Ah now that would be easier. Thanks I'll test it tonight.


- watty - 2007-12-18

is anyone else having problems with rss feeds not updating? I keep on having to re-add rss .xml files to get the latest feeds.


- Unbehagen - 2007-12-18

Create an OPML file linking TO the RSS feed. Google for OPML.