15__title__ =
"chrisPirillo_api - XPath and XSLT functions for the chris.pirillo.com RSS/HTML"
16__author__=
"R.D. Vaughan"
18This python script is intended to perform a variety of utility functions
19for the conversion of data to the MNV standard RSS output format.
20See this link for the specifications:
21http://www.mythtv.org/wiki/MythNetvision_Grabber_Script_Format
28__xpathClassList__ = [
'xpathFunctions', ]
32__xsltExtentionList__ = []
34import os, sys, re, time, datetime, shutil,
urllib.request, urllib.parse, urllib.error, string
35from copy
import deepcopy
39 """Wraps a stream with an encoder"""
48 """Wraps the output stream, encoding Unicode strings with the specified encoding"""
49 if isinstance(obj, str):
52 self.
out.buffer.write(obj)
57 """Delegate everything but write to the stream"""
58 return getattr(self.
out, attr)
60if isinstance(sys.stdout, io.TextIOWrapper):
65 from io
import StringIO
66 from lxml
import etree
68 sys.stderr.write(
'\n! Error - Importing the "lxml" and "StringIO" python libraries failed on error(%s)\n' % e)
73 """Functions specific extending XPath
79 'content':
"http://purl.org/rss/1.0/modules/content/",
80 'wfw':
"http://wellformedweb.org/CommentAPI/",
81 'dc':
"http://purl.org/dc/elements/1.1/",
82 'atom':
"http://www.w3.org/2005/Atom",
83 'sy':
"http://purl.org/rss/1.0/modules/syndication/",
84 'slash':
"http://purl.org/rss/1.0/modules/slash/",
85 'itunes':
"http://www.itunes.com/dtds/podcast-1.0.dtd",
86 'media':
"http://search.yahoo.com/mrss/",
87 'feedburner':
"http://rssnamespace.org/feedburner/ext/1.0",
88 'atom10':
"http://www.w3.org/2005/Atom",
100 '''Generate a link for the video.
102 'mnvXpath:chrisPirilloLinkGeneration(normalize-space(link), normalize-space(description))'
105 tmpHtml = common.getHtmlData(*arg)
107 if len(fullScreenLink):
108 link =
'%s%s' % (fullScreenLink[0],
'&autoplay=1')
def __init__(self, outstream, encoding=None)
def __getattr__(self, attr)
def chrisPirilloLinkGeneration(self, context, *arg)
Start of XPath extension functions.