Hey All,
I’m brand spanking new to Plugin Development and Im trying my hand on some sample code. I am trying to get a web hosted mp4 file to play via Plex Media Center and I’m at a point where I have no idea whats going on.
Here is my code:
import re, datetime<br />
<br />
###################################################################################################<br />
<br />
###################################################################################################<br />
def Start():<br />
Plugin.AddPrefixHandler("/video/test-plugin", MainMenu, "Test")<br />
Plugin.AddViewGroup("InfoList", viewMode="InfoList", mediaType="items")<br />
Plugin.AddViewGroup("List", viewMode="List", mediaType="items")<br />
<br />
ObjectContainer.title1 = "Test"<br />
ObjectContainer.view_group = "InfoList"<br />
<br />
<br />
####################################################################################################<br />
def MainMenu():<br />
oc = ObjectContainer(view_group="List")<br />
<br />
oc.add(DirectoryObject(key=Callback(MoviesList), title="Movies Level 1"))<br />
<br />
return oc<br />
<br />
####################################################################################################<br />
def MoviesList():<br />
oc = ObjectContainer()<br />
<br />
oc.add(MovieObject(<br />
url="http://cdnapac.videodetective.net/svideo-mp4-750/mp4/750/7583/318505.mp4?c=300120&r=750&s=318505&d=152&sub=MOBILE-IPAD&ref=na&fmt=4&e=20121012032210&h=060daef9262fdc6039535", <br />
title="Sinister", <br />
originally_available_at=Datetime.ParseDate("01/01/2012").date(), <br />
duration=(152*1000), <br />
summary="summary")<br />
)<br />
Here's what my Info.plist file looks like:
[xml]<?xml version="1.0" encoding="UTF-8"?>
CFBundleIdentifier
com.plexapp.plugins.test
PlexAudioCodec
AAC
PlexClientPlatformExclusions
Roku
PlexClientPlatforms
*
PlexFrameworkVersion
2
PlexMediaContainer
MP4
PlexVideoCodec
H.264
[/xml]
When I try to run the plugin, I can see the first item "Movies Level 1". But as soon as I click on that in the Plex Client, nothing happens.
Here's the plex plugin log:
2012-10-11 23:48:25,395 (-4faed000) : DEBUG (runtime:654) - Handling request GET /video/test-plugin/:/function/MoviesList?function_args=Y2VyZWFsMQoxCmRpY3QKMApyMAo_<br />
2012-10-11 23:48:25,396 (-4faed000) : DEBUG (runtime:750) - Found route matching /video/test-plugin/:/function/MoviesList<br />
2012-10-11 23:48:25,397 (-4faed000) : DEBUG (runtime:143) - Calling function 'MoviesList'<br />
2012-10-11 23:48:25,399 (-4faed000) : DEBUG (services:598) - No service found for URL 'http://cdnapac.videodetective.net/svideo-mp4-750/mp4/750/7583/318505.mp4?c=300120&r=750&s=318505&d=152&sub=MOBILE-IPAD&ref=na&fmt=4&e=20121012032210&h=060daef9262fdc6039535'<br />
2012-10-11 23:48:25,400 (-4faed000) : DEBUG (services:613) - No matching services found for 'http://cdnapac.videodetective.net/svideo-mp4-750/mp4/750/7583/318505.mp4?c=300120&r=750&s=318505&d=152&sub=MOBILE-IPAD&ref=na&fmt=4&e=20121012032210&h=060daef9262fdc6039535'<br />
2012-10-11 23:48:25,401 (-4faed000) : INFO (services:691) - No normalization function found for URL 'http://cdnapac.videodetective.net/svideo-mp4-750/mp4/750/7583/318505.mp4?c=300120&r=750&s=318505&d=152&sub=MOBILE-IPAD&ref=na&fmt=4&e=20121012032210&h=060daef9262fdc6039535'<br />
2012-10-11 23:48:25,402 (-4faed000) : DEBUG (services:598) - No service found for URL 'http://cdnapac.videodetective.net/svideo-mp4-750/mp4/750/7583/318505.mp4?c=300120&r=750&s=318505&d=152&sub=MOBILE-IPAD&ref=na&fmt=4&e=20121012032210&h=060daef9262fdc6039535'<br />
2012-10-11 23:48:25,402 (-4faed000) : CRITICAL (runtime:889) - Exception when constructing response (most recent call last):<br />
File "/Users/johne/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/components/runtime.py", line 870, in construct_response<br />
el = result._to_xml()<br />
File "/Users/johne/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/objectkit.py", line 497, in _to_xml<br />
el = Framework.modelling.objects.ModelInterfaceObjectContainer._to_xml(self)<br />
File "/Users/johne/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/modelling/objects.py", line 375, in _to_xml<br />
root = Container._to_xml(self)<br />
File "/Users/johne/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/modelling/objects.py", line 139, in _to_xml<br />
self._append_children(root, self._objects)<br />
File "/Users/johne/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/modelling/objects.py", line 145, in _append_children<br />
el = obj._to_xml()<br />
File "/Users/johne/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/objectkit.py", line 434, in _to_xml<br />
if self._core.services.function_in_service_is_deferred(Framework.components.services.MEDIA_OBJECTS_FUNCTION_NAME, service):<br />
File "/Users/johne/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/components/services.py", line 552, in function_in_service_is_deferred<br />
service.sandbox.context.import_values(values)<br />
AttributeError: 'NoneType' object has no attribute 'sandbox'<br />
<br />
2012-10-11 23:48:25,403 (-4faed000) : DEBUG (runtime:946) - Unable to handle response type: <class 'Framework.modelling.objects.MediaContainer'><br />
2012-10-11 23:48:25,404 (-4faed000) : DEBUG (runtime:843) - Response: [500] MediaContainer, 0 bytes<br />
<br />
After some googling I'm at a point where I have no idea what Im doing anymore. I'd appreciate any help!
Oh! I should mention that the Plex Client I am using is the Plex Media Center for Mac OSX
Thanks!!