Skip to content

Commit

Permalink
allow aTV to request from multiple PMSs: /PMS(//<type>) - recombine M…
Browse files Browse the repository at this point in the history
…yPlex into Library.xml - enable search on shared servers
  • Loading branch information
iBaa committed Nov 8, 2013
1 parent a2aa155 commit c813dd4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 80 deletions.
15 changes: 8 additions & 7 deletions XMLConverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,18 +322,13 @@ def XML_PMS2aTV(PMS_baseURL, path, options):
elif path.startswith('/search?'):
XMLtemplate = 'Search_Results.xml'

elif path=='/library/sections':
elif path=='/library/sections': # from PlexConnect.xml -> for //local, //myplex
XMLtemplate = 'Library.xml'
path = ''

elif path=='/channels/all':
XMLtemplate = 'Channels.xml'
path = ''

elif path=='/myplex':
XMLtemplate = 'MyPlex.xml'
path = ''

# request PMS XML
if not path=='':
if 'PlexConnectUDID' in options:
Expand All @@ -343,7 +338,13 @@ def XML_PMS2aTV(PMS_baseURL, path, options):
else:
auth_token = ''

PMS = PlexAPI.getXMLFromPMS(PMS_baseURL, path, options, authtoken=auth_token)
if PMS_baseURL.startswith('//'): # //local, //myplex
UDID = options['PlexConnectUDID']
type = PMS_baseURL[2:]
PMS = PlexAPI.getXMLFromMultiplePMS(UDID, path, type, options)
else:
PMS = PlexAPI.getXMLFromPMS(PMS_baseURL, path, options, authtoken=auth_token)

if PMS==False:
return XML_Error('PlexConnect', 'No Response from Plex Media Server')

Expand Down
6 changes: 2 additions & 4 deletions assets/templates/Library.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
</head>

<body>
{{ADDXML(LocalSections:://local/library/sections)}}

{{VAR(sections:NoKey:FALSE)}} <!--this sets the var to FALSE-->

<listWithPreview id="com.sample.menu-items-with-sections">
Expand All @@ -19,13 +17,13 @@

<!-- local servers -->
<menuSection>
{{COPY(@LocalSections/Server:size::0=|1=COPY)}}
{{COPY(Server:size::0=|1=COPY)}}

<header>
<horizontalDivider alignment="left">
<title>{{VAL(name)}}</title>
</horizontalDivider>
</header>{{CUT(@LocalSections/size:CUT:0=CUT|1=CUT|2=)}}
</header>{{CUT(size:CUT:0=CUT|1=CUT|2=)}}

<items>
<!-- /library/sections -->
Expand Down
67 changes: 0 additions & 67 deletions assets/templates/MyPlex.xml

This file was deleted.

4 changes: 2 additions & 2 deletions assets/templates/PlexConnect.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
<navigation>
<navigationItem id="Library">
<title>{{TEXT(Library)}}</title>
<url>{{URL(:/library/sections)}}</url>
<url>{{URL(:/PMS(//local)/library/sections)}}</url>
</navigationItem>
<navigationItem id="Channels">
<title>{{TEXT(Channels)}}</title>
<url>{{URL(:/channels/all)}}</url>
</navigationItem>
<navigationItem id="MyPlex">
<title>{{TEXT(MyPlex)}}</title>
<url>{{URL(:/myplex)}}</url>
<url>{{URL(:/PMS(//myplex)/library/sections)}}</url>
</navigationItem>
<navigationItem id="Settings">
<title>{{TEXT(Settings)}}</title>
Expand Down

0 comments on commit c813dd4

Please sign in to comment.