Plex @ aTV - think different...

Talking about XML...

I don't see big issues parsing the Plex XML. But: Does anyone know of some sort of specification for the aTV Trailer XMLs? From what I have played with, aTV is rather picky. Is there a description of the supported "tags" available?

Talking about XML...

I don't see big issues parsing the Plex XML. But: Does anyone know of some sort of specification for the aTV Trailer XMLs? From what I have played with, aTV is rather picky. Is there a description of the supported "tags" available?

There's not a lot of information about Apple's XML that I could find.  There's some info here, but it seems older (http://wiki.awkwardtv.org/wiki/XML_Downloaded_By_ATV) and a Google Repo from the appletv script (in Chinese: https://code.google.com/p/appletv/)

I think it'll be a case of reverse engineering and hoping for the best.. unless someone finds something else.

Argh... my worst fear.

On PMS side at least we get the XML files and can "think about", what it could mean.

On aTV side, we know pretty much nothing - I started harvesting a couple of original files, but they don't come as plain XML. There is a lot of .js in there as well.

Sunday evening progress report:

A new version is ready... be invited to check it out: https://github.com/iBaa/PlexConnect

Features:

- browsing PMS library? check.

- playing locally stored video? check.

- source files published on GitHub? check.

Missing:

- transcoding

- support for channels, music, photos

- full aTV GUI support (menu tree, media information, thumbnails...)

In my opinion, the idea looks promising. Feedback is welcome.

EDIT: Tested on 5.2 - according to one comment, 5.0.2 does not support one used XML feature.

Hello,

it seems to me like an interesting approach.

Is there any way to try this with a windows maschine/server,
since as far as i can tell I need a Mac to try this ?

If there is an tutorial and I just haven´t found it (or wasn´t able
to recognize it) I really would appreciate if someone would be
willing to help me out here.

thanks in regards freude

It will work on windows but you may need to install python.

There is a read me on the GitHub along with updated code.

Hi, got the latest git source serving from a Windows 8 PC to an ATV3. The films section works fine but keep encountering the following problem when browsing TV shows...

WebServer : serving .xml: /library/sections/1/all/
----------------------------------------
Exception happened during processing of request from ('192.168.0.7', 49338)
Traceback (most recent call last):
  File "d:\msys\Python27\lib\SocketServer.py", line 295, in _handle_request_nobl
ock
    self.process_request(request, client_address)
  File "d:\msys\Python27\lib\SocketServer.py", line 321, in process_request
    self.finish_request(request, client_address)
  File "d:\msys\Python27\lib\SocketServer.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "d:\msys\Python27\lib\SocketServer.py", line 649, in __init__
    self.handle()
  File "d:\msys\Python27\lib\BaseHTTPServer.py", line 340, in handle
    self.handle_one_request()
  File "d:\msys\Python27\lib\BaseHTTPServer.py", line 328, in handle_one_request

    method()
  File "C:\PlexConnect-master\WebServer.py", line 78, in do_GET
    XML = XMLConverter.XML_PMS2aTV(self.client_address, self.path)
  File "C:\PlexConnect-master\XMLConverter.py", line 413, in XML_PMS2aTV
    XML_TVShow_ListView(el_aTV, PMS, path)
  File "C:\PlexConnect-master\XMLConverter.py", line 346, in XML_TVShow_ListView

    img.text = 'http://' + Addr_PMS + i.get('thumb')  # direct connect to Plex M
edia Server
TypeError: cannot concatenate 'str' and 'NoneType' objects

 Any ideas?

Does your section have a "thumb"?

Could you please provide the latest XML just before the crash? It should still print those, right?

Yep, we really need to do error checking to make sure the i.get('thumb') returns a valid image :(

Does your section have a "thumb"?

Could you please provide the latest XML just before the crash? It should still print those, right?

Sorry not sure where the xml file is located?

Here is the full log though...

C:\PlexConnect-master>python PlexConnect.py
PlexConnect : ***
PlexConnect : PlexConnect
PlexConnect : Press ENTER to shut down.
PlexConnect : ***
DNSServer : ***
DNSServer : Starting up.
DNSServer : intercept: trailers.apple.com
DNSServer : forward other to higher level DNS: 192.168.0.1
DNSServer : ***
WebServer : ***
WebServer : WebServer: Serving HTTP on 0.0.0.0 port 80.
WebServer : ***
DNSServer : DNS request received!
DNSServer : Source: ('192.168.0.7', 60196)
DNSServer : Domain: a5.da1.akamai.net
DNSServer : ***forward request
WebServer : serving application.js
192.168.0.7 - - [21/Apr/2013 16:25:28] "GET /appletv/us/js/application.js HTTP/1
.1" 200 -
WebServer : aTV firmware: 5.2
WebServer : serving plexconnect.xml
192.168.0.7 - - [21/Apr/2013 16:25:28] "GET /plexconnect.xml HTTP/1.1" 200 -
WebServer : serving .xml: /library/sections/
192.168.0.7 - - [21/Apr/2013 16:25:28] "GET /library/sections/ HTTP/1.1" 200 -
WebServer : serving .xml: /channels/all/
192.168.0.7 - - [21/Apr/2013 16:25:28] "GET /channels/all/ HTTP/1.1" 200 -
WebServer : serving .xml: /music/
192.168.0.7 - - [21/Apr/2013 16:25:28] "GET /music/ HTTP/1.1" 200 -
WebServer : serving .xml: /photos/
192.168.0.7 - - [21/Apr/2013 16:25:28] "GET /photos/ HTTP/1.1" 200 -
WebServer : serving .xml: /library/sections/1/
192.168.0.7 - - [21/Apr/2013 16:25:32] "GET /library/sections/1/ HTTP/1.1" 200 -

WebServer : serving .xml: /library/sections/1/all/
----------------------------------------
Exception happened during processing of request from ('192.168.0.7', 49619)
Traceback (most recent call last):
  File "d:\msys\Python27\lib\SocketServer.py", line 295, in _handle_request_nobl
ock
    self.process_request(request, client_address)
  File "d:\msys\Python27\lib\SocketServer.py", line 321, in process_request
    self.finish_request(request, client_address)
  File "d:\msys\Python27\lib\SocketServer.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "d:\msys\Python27\lib\SocketServer.py", line 649, in __init__
    self.handle()
  File "d:\msys\Python27\lib\BaseHTTPServer.py", line 340, in handle
    self.handle_one_request()
  File "d:\msys\Python27\lib\BaseHTTPServer.py", line 328, in handle_one_request

    method()
  File "C:\PlexConnect-master\WebServer.py", line 78, in do_GET
    XML = XMLConverter.XML_PMS2aTV(self.client_address, self.path)
  File "C:\PlexConnect-master\XMLConverter.py", line 466, in XML_PMS2aTV
    XML_TVShow_ListView(el_aTV, PMS, path)
  File "C:\PlexConnect-master\XMLConverter.py", line 391, in XML_TVShow_ListView

    img.text = 'http://' + Addr_PMS + i.get('thumb')  # direct connect to Plex M
edia Server
TypeError: cannot concatenate 'str' and 'NoneType' objects
----------------------------------------

It's never gonna generate the xml because one or more of your thumbs are missing,thus causing the xml generation to fail, I'll add some error checking soon, please stand by :)

Craig, thanks. We check that every now and then. The trouble is, you have to have the luck to find the right people there...

On the other hand, I don't think we struggle to much with the PMS or access to it. The issues are more related to the fact that I just started with python, never before worked on DNS/HTTP/whatever servers, never dealt with code for multithreading/multiprocessing and so forth. But hey, you have to face the challenge and keep on learning - everyday a little more :-)

And for that, this little project is actually coming along quite nicely.

cocker80:

>>  File "C:\PlexConnect-master\XMLConverter.py", line 391, in XML_TVShow_ListView

>>    img.text = 'http://' + Addr_PMS + i.get('thumb')  # direct connect to Plex Media Server

As roidy pointed out, your PMS is missing metadata - here the thumbs. Over the weekend I did some major recoding on the XMLConverter - a side effect could be that it is more tolerant about such issues. Please get the latest sources from github, branch "XML_templates", try again and hopefully have some fun!

I can guarantee you, the error in line 391 is gone - the file has only a mere 338 line now... :-D

 

Edit: ...and yes, please respond back with your findings!

cocker80:

>>  File "C:\PlexConnect-master\XMLConverter.py", line 391, in XML_TVShow_ListView

>>    img.text = 'http://' + Addr_PMS + i.get('thumb')  # direct connect to Plex Media Server

As roidy pointed out, your PMS is missing metadata - here the thumbs. Over the weekend I did some major recoding on the XMLConverter - a side effect could be that it is more tolerant about such issues. Please get the latest sources from github, branch "XML_templates", try again and hopefully have some fun!

I can guarantee you, the error in line 391 is gone - the file has only a mere 338 line now... :-D

 

Edit: ...and yes, please respond back with your findings!

Hi, I have downloaded the latest version from git (f8e4aa385844a636c425a8fb931c36524a0cb6df) but still getting the same error message. By "Thumb" are you referring to the art work in the library? My library have several missing, will try a force refresh to see if that will resolve it.

cocker80:

github: as noted, get the other branch - XML_templates (7be4b38166448a39532b08f9cee364f48c085122)

Thumbs: yes, Thumbnails, Artwork and other metadata in your lib. I know, the software should handle missing pieces, but this one is not stable, more like "still a couple steps to Alpha".

cocker80:

github: as noted, get the other branch - XML_templates (7be4b38166448a39532b08f9cee364f48c085122)

Thumbs: yes, Thumbnails, Artwork and other metadata in your lib. I know, the software should handle missing pieces, but this one is not stable, more like "still a couple steps to Alpha".

Missed that branch, ok downloaded that branch and it worked correctly. I have yet to update my library but so far so good. Will do some more testing an let you know

[...] and it worked correctly. [...]

Good to hear that!

New to this topic. Tried setting it up. On my ATV when I go to Trailers, I get Trailers us unavailable.

Log file on Mac:

DNSServer : Starting up.
DNSServer : intercept: trailers.apple.com
DNSServer : forward other to higher level DNS: 10.0.1.1
DNSServer : ***
WebServer : ***
WebServer : WebServer: Serving HTTP on 0.0.0.0 port 80.
WebServer : ***
DNSServer : DNS request received!
DNSServer : Source: ('10.0.1.4', 50911)
DNSServer : Domain: a1.mzstatic.com
DNSServer : ***forward request
DNSServer : -> DNS response from higher level
DNSServer : DNS request received!
DNSServer : Source: ('10.0.1.4', 62875)
DNSServer : Domain: a2.mzstatic.com
DNSServer : ***forward request
DNSServer : -> DNS response from higher level
DNSServer : DNS request received!
DNSServer : Source: ('10.0.1.4', 61301)
DNSServer : Domain: a4.mzstatic.com
DNSServer : ***forward request
DNSServer : -> DNS response from higher level
DNSServer : DNS request received!
DNSServer : Source: ('10.0.1.4', 49852)
DNSServer : Domain: init-p01st.push.apple.com
DNSServer : ***forward request
DNSServer : -> DNS response from higher level
DNSServer : DNS request received!
DNSServer : Source: ('10.0.1.4', 64272)
DNSServer : Domain: 17-courier.push.apple.com
DNSServer : ***forward request
DNSServer : -> DNS response from higher level
DNSServer : DNS request received!
DNSServer : Source: ('10.0.1.4', 64335)
DNSServer : Domain: trailers.apple.com
DNSServer : ***intercept request
DNSServer : -> DNS response: IP_PMS
DNSServer : DNS request received!
DNSServer : Source: ('10.0.1.4', 54241)
DNSServer : Domain: mesu.apple.com
DNSServer : ***forward request
DNSServer : -> DNS response from higher level
DNSServer : DNS request received!
DNSServer : Source: ('10.0.1.4', 51339)
DNSServer : Domain: appldnld.apple.com
DNSServer : ***forward request
DNSServer : -> DNS response from higher level

Try setting the DNS server setting to your ISP DNS server rather than your router.

Wow this is a nice little project. Great work so far guys.

Yesterday I managed to get Plex Media Server transcoding to work with PlexConnect, so now I'm able to stream all my movies.

I will clean up my code and send a pull request on GitHub when I'm ready (If you want it).