Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dbl-a committed Jan 17, 2011
0 parents commit 4f01559
Show file tree
Hide file tree
Showing 7 changed files with 132 additions and 0 deletions.
Empty file added .gitignore
Empty file.
100 changes: 100 additions & 0 deletions Contents/Code/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@

# PMS plugin framework v2

####################################################################################################

VIDEO_PREFIX = "/video/pbskids"
PBSKIDS_URL = "http://www.pbskids.org/video/"
PBSKIDS_SHOWS = "http://pbskids.org/everything.html"
PBS_JSON = "http://pbs.feeds.theplatform.com/ps/JSON/PortalService/2.2/getReleaseList?PID=6HSLquMebdOkNaEygDWyPOIbkPAnQ0_C&startIndex=1&endIndex=500&sortField=airdate&sortDescending=true&query=contentCustomBoolean|isClip|%s&field=airdate&field=author&field=bitrate&field=description&field=format&field=length&field=PID&field=thumbnailURL&field=title&field=URL&contentCustomField=isClip&param=affiliate|prekPlayer&field=categories&field=expirationDate&query=categories|%s"

CATEGORY_LIST = "http://pbs.feeds.theplatform.com/ps/JSON/PortalService/2.2/getCategoryList?PID=6HSLquMebdOkNaEygDWyPOIbkPAnQ0_C&query=CustomText|CategoryType|%s&query=HasReleases&field=title&field=thumbnailURL"
NAME = L('Title')


# make sure to replace artwork with what you want
# these filenames reference the example files in
# the Contents/Resources/ folder in the bundle
ART = 'art-default.jpg'
ICON = 'icon-default.gif'

####################################################################################################

def Start():
Plugin.AddPrefixHandler(VIDEO_PREFIX, MainMenu, NAME, ICON, ART)
Plugin.AddViewGroup("InfoList", viewMode="InfoList", mediaType="items")
Plugin.AddViewGroup("List", viewMode="List", mediaType="items")
MediaContainer.art = R(ART)
MediaContainer.title1 = NAME
DirectoryItem.thumb=R(ICON)

####################################################################################################
def MainMenu():
dir = MediaContainer(mediaType='video', viewGroup='List')
dir.Append(Function(DirectoryItem(ShowsList, "Shows"), categoryType = "Show"))
dir.Append(Function(DirectoryItem(ShowsList, "Topics"), categoryType = "Channel"))
return dir

####################################################################################################
def ShowPage(sender, title, thumb):
dir = MediaContainer(title2=sender.itemTitle, viewGroup='List')
#title = title.replace(' ', '%20').replace('&', '%26') ### FORMATTING FIX
dir.Append(Function(DirectoryItem(VideoPage, "Full Episodes", thumb=thumb), clip='false', title=title))
dir.Append(Function(DirectoryItem(VideoPage, "Clips", thumb=thumb), clip='true', title=title))
return dir

####################################################################################################
def VideoPage(sender, clip, title):
dir = MediaContainer(title2=sender.itemTitle, viewGroup="InfoList")
title = title.replace(' ', '%20').replace('&', '%26') ### FORMATTING FIX
content = JSON.ObjectFromURL(PBS_JSON % (clip, title), cacheTime=CACHE_1DAY)
Log(content)
for item in content['items']:
thumb = item['thumbnailURL']
Log(thumb)
link = item['URL']
Log(link)
title = item['title']
Log(title)
summary = item['description']
Log(summary)
duration = item['length']
Log(duration)
dir.Append(Function(VideoItem(VideoPlayer, title=title, thumb=thumb, summary=summary, duration=duration), link=link))
return dir

####################################################################################################
def VideoPlayer(sender, link):
dir = MediaContainer(title2=sender.itemTitle)
link = link + '&format=SMIL'
videosmil = HTTP.Request(link).content
clip = videosmil.split("ref src")
player = clip[0]
clip = clip[1].split('"')
player = player.split("meta base")
player = player[1].split('"')
player = player[1]
if ".mp4" in clip[1]:
clip = clip[1].replace(".mp4", "")
clip = "mp4:" + clip
else:
clip = clip[1].replace(".flv", "")
return Redirect(RTMPVideoItem(player, clip))

####################################################################################################
def ShowsList(sender, categoryType):
dir = MediaContainer(title2=sender.itemTitle, viewGroup='List')
content = JSON.ObjectFromURL(CATEGORY_LIST % categoryType)
for item in content['items']:
title = item['title']
Log(title)
thumb = item['thumbnailURL']
Log(thumb)
if thumb != "":
if "Channel Sample" not in title:
if categoryType == "Show":
dir.Append(Function(DirectoryItem(ShowPage, title, thumb=thumb), title=title, thumb=thumb))
else:
dir.Append(Function(DirectoryItem(VideoPage, title, thumb=thumb), clip='true', title=title))
return dir

Binary file added Contents/Code/__init__.pyc
Binary file not shown.
28 changes: 28 additions & 0 deletions Contents/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>Hello</string>
<key>CFBundleIdentifier</key>
<string>com.plexapp.plugins.pbskids</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>PlexFrameworkVersion</key>
<string>2</string>
<key>CFBundlePackageType</key>
<string>AAPL</string>
<key>CFBundleSignature</key>
<string>hook</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>PlexPluginMode</key>
<string>AlwaysOn</string>
<key>PlexPluginConsoleLogging</key>
<string>1</string>
<key>PlexPluginDevMode</key>
<string>1</string>
</dict>
</plist>
Binary file added Contents/Resources/art-default.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Contents/Resources/icon-default.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions Contents/Strings/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
'Title': 'PBS Kids',
'VideoTitle': 'PBS Kids',
}

0 comments on commit 4f01559

Please sign in to comment.