forked from dbl-a/PBSKids.bundle
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4f01559
Showing
7 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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¶m=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 not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
'Title': 'PBS Kids', | ||
'VideoTitle': 'PBS Kids', | ||
} |