I’m trying to build a plug in that will allow me to use the same db for XBMC and Plex and Media Portal TV Server
XBMC hold the Movie and the Series
TV Server hold the TV Recordings.
A simple xmlrpc server interface to communicate with the Plex Plug in.
I have
A window Box (Main server) running Plex Server, Media Portal TV Server and XBMC has the Client.
An ATV2 running Plex Client
An LG Smart TV running Plex Client
Couple of Window workstation running XBMC
soon an android tablet…
so i’m builder a simple server that will be use to agregate the database.
The plug in is running in elevated security code policy.
Base on the Log output I would guess i need to create a URL services? I did read the documentation on the URL service but I don’t understand how it does apply here.
Thank’s
2012-01-06 05:01:27,311 (8824) : CRITICAL (core:315) - Function named ‘NormalizeURL’ couldn’t be found in the current environment
2012-01-06 05:01:27,311 (8824) : WARNING (core:315) - Unable to normalize URL ‘E:\Film\Tous\Dessin Anime\A Bug’s Life (1998).mkv’
2012-01-06 05:01:27,341 (8824) : DEBUG (core:315) - No service found for URL ‘E:\Film\Tous\Dessin Anime\A Bug’s Life (1998).mkv’
2012-01-06 05:01:27,351 (8824) : CRITICAL (core:315) - Exception when constructing response (most recent call last):
File “C:\Users\PVR\AppData\Local\Plex Media Server\Plug-ins\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\components\runtime.py”, line 818, in construct_response
resultStr = self._core.data.xml.to_string(result._to_xml(context=context))
File “C:\Users\PVR\AppData\Local\Plex Media Server\Plug-ins\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\api\objectkit.py”, line 370, in _to_xml
el = Framework.modelling.objects.ModelInterfaceObjectContainer._to_xml(self, context)
File “C:\Users\PVR\AppData\Local\Plex Media Server\Plug-ins\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\modelling\objects.py”, line 351, in _to_xml
root = Container._to_xml(self, context)
File “C:\Users\PVR\AppData\Local\Plex Media Server\Plug-ins\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\modelling\objects.py”, line 124, in _to_xml
self._append_children(root, self._objects, context)
File “C:\Users\PVR\AppData\Local\Plex Media Server\Plug-ins\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\modelling\objects.py”, line 130, in _append_children
el = obj._to_xml(context)
File “C:\Users\PVR\AppData\Local\Plex Media Server\Plug-ins\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\api\objectkit.py”, line 306, in _to_xml
if urlservice._media_objects_function_for_url_is_deferred(url):
File “C:\Users\PVR\AppData\Local\Plex Media Server\Plug-ins\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\api\servicekit.py”, line 87, in _media_objects_function_for_url_is_deferred
return self._media_objects_function_for_service_is_deferred(service)
File “C:\Users\PVR\AppData\Local\Plex Media Server\Plug-ins\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\api\servicekit.py”, line 90, in _media_objects_function_for_service_is_deferred
return self._function_for_service_is_deferred(service, ‘MediaObjectsForURL’)
File “C:\Users\PVR\AppData\Local\Plex Media Server\Plug-ins\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\api\servicekit.py”, line 93, in _function_for_service_is_deferred
ret = self._core.services._function_in_service_is_deferred(f_name, service, context=self._context)
File “C:\Users\PVR\AppData\Local\Plex Media Server\Plug-ins\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\core.py”, line 829, in _function_in_service_is_deferred
return service.host.function_is_deferred(fname, self._create_service_context(service.host, context))
AttributeError: ‘NoneType’ object has no attribute ‘host’
################
import xmlrpclib
import re
TITLE = ‘Film’
ART = ‘art-default.jpg’
ICON = ‘icon-default.png’
ICON_SEARCH = ‘icon-search.png’
def Start():
Plugin.AddViewGroup(“Details”, viewMode=“InfoList”, mediaType=“items”)
Plugin.AddViewGroup(“List”, viewMode=“List”, mediaType=“items”)
ObjectContainer.title1 = TITLE
ObjectContainer.view_group = ‘List’
##############################
@handler(’/video/Film’, TITLE)
def MainMenu():
oc = ObjectContainer()
server = xmlrpclib.ServerProxy(“http://localhost:8888”)
tabl = server.GetXBMCMovie(“All”)
for row in tabl:
title=row[0]
genre=row[1]
thumbRAW=row[2]
url=row[3]
summary=row[4]
linksList = re.findall(’.*?’,thumbRAW)
if len(linksList)>0:
thumbImg=linksList[0]
#Url is a local path i.e. ‘E:\Film\Tous\Dessin Anime\A Bug’s Life (1998).mkv’
oc.add(MovieObject(
url = url,
title = title,
summary = summary,
thumb=Callback(Thumb, url=thumbImg)))
return oc
#####################################################################
def Thumb(url):
try:
data = HTTP.Request(url, cacheTime = CACHE_1MONTH).content
return DataObject(data, ‘image/jpeg’)
except:
return Redirect(R(ICON))
Adding a MovieObject with a URL set will attempt to invoke a URL service, but this isn’t required if all you want to do is play content. To play local files, you need to change your plug-in’s security policy by setting PlexPluginCodePolicy to Elevated in the plist file, then return a MovieObject with a full item/part hierarchy. The media part should point to a function in your code that returns Stream.LocalFile(path). For example:
<br />
...<br />
oc.add(MovieObject(<br />
title = title,<br />
summary = summary,<br />
thumb = Callback(Thumb, url=thumbImg),<br />
items = [<br />
MediaObject(<br />
parts = [PartObject(key = Callback(PlayVideo, path=path)]<br />
)<br />
]<br />
<br />
...<br />
<br />
<br />
def PlayVideo(path):<br />
return Stream.LocalFile(path)<br />
That *should* work (untested/coding from memory :P). You can also set codec & quality information on the MediaObject to help clients determine when transcoding is required.
Out of interest, why not just use the Plex server's database and Plex clients (or XBMC with PleXBMC) to access it? :)
Thank's.
1-XBMC Eden have the full support for Media Portal TV Server. (PVR support)
2-PleXBMC does not have all the bell-and-whistle XBMC Movies and Series has.
3-My wife prefer XBMC.
4-My DB is completed in XBMC(poster every thing.)
5-I would have to create a Plex plug-in anyway for media portal tv server (TV's recording).
6-I have to choose one XBMC db was choosen because of #4.
In the end I like XBMC and Plex equally.
The only thing I will be missing is the synch of the bookmark. I wan't to avoid has much has possible to go directly to the databases.
here's how I did it.
<br />
oc.add(MovieObject(<br />
key = Callback(PlayVideo, path=path),<br />
rating_key="/video/Film/"+path,<br />
title=title,<br />
summary=summary,<br />
thumb=Callback(Thumb, url=thumbImg),<br />
art=Callback(Thumb, url=fanart)<br />
))<br />
<br />
return oc<br />
<br />
<br />
def PlayVideo(path):<br />
return Redirect(Stream.LocalFile(path)) <br />
The documentation does not seam to be right for the **key** member of MovieObject, or I just don't understand it.
here's what the doc say
The docs are correct. Your code has invoked some backwards-compatibility code in the client. Older object classes didn’t support a hierarchy of media items and parts - they just had a single “key” attribute defining the location of the media. Your code will work for now, but might break a few months/years down the line
This probably isn’t of immediate concern, but should help you understand exactly what’s going on (sorry it can be a little confusing at times!)
I know this thread is a bit old. But was there any success in getting a PMS channel plug-in to access local filesystem video files?
I've tried all above posted code fragments, then with every variation that I could figure out "might" be an additional necessity, from my PMS plug-in. That included adding the originally suggested form using a MediaObject and adding a single video part with the correct video parameters for a test video (which is an mkv containerized video file). My Plug-in is set for elevated privilege. PMS seems to find the video file, but somehow either client or PMS server cause some transcoding session to occur that ultimately fails. What's not clear to me, is whether transcoding sessions, with network clients, can even work this way or not (given the video file is not accessible via a web server, but only locally by the PMS server.
(probably not so important, but I have been able to make another version of my test plug-in to work by, also, running an Apache Web Server on the same machine which runs the PMS server...but that seems a very inefficient and obtuse way to have to make things work...I'd rather not have to run the Apache Web Server on my PMS server just for getting my Plug-In to access video content stored on the same machine...but that's just Monkey see, Monkey doo...plenty of example Plug-Ins to make that occur).
I'd really be very grateful to anyone that could clue me in on the information I might be missing to make direct file-system access of content working in a Plug-in.
Thanks, in advance, for attempting such help.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.