How to transfer trailers.cer using plexconnect (no usb)

Even if the party for plexconnect app without using trailers has (temporarily) ended I think there is something we should implement in the main plexconnect code.

 

This is how we can instruct plexconnect to transfer the trailers.cer file to our appletv without the need for AppleConfigurator or USB cable.

 

1) modify your Webserver.py and before the line 

"# get everything else from XMLConverter - formerly limited to trailing "/" and &PlexConnect Cmds"

 

insert this code:

 

# serve "*.cer" - thumbnails for old-style mainpage
                if self.path.endswith(".cer"):
                    dprint(__name__, 1, "serving *.cer: "+self.path)
                    f = open(sys.path[0] + sep + "assets" + sep + "certificates" + self.path, "rb")
                    self.send_response(200)
                    self.send_header('Content-type', 'application/xml')
                    self.end_headers()
                    self.wfile.write(f.read())
                    f.close()
                    return 
 
2) create the trailers.cer as per instruction in http://langui.sh/2013/08/27/appletv-ssl-plexconnect/
You just need to perform the first step: "Create the Cert"
 
3) copy the three files created in the assets/certificates folder (also as per original instructions)
 
4) Go to the AppleTV Settings app
 
5) Select “General” then scroll the cursor down to highlight “Send Data To Apple”
 
4) Set "send data to apple" to NO
 
5) This time press “Play” (not the normal “Select” button) and you will be prompted to add a profile
 
6) Enter the URL for the .cer file: http://yourIPaddress/trailers.cer (don’t forget to add http://)
 
DONE!
 
If you have already a profile installed you fins a menu entry at the very bottom of the general settings called "profiles"
 
yourIPaddress is where plexconnect is running.
 
Credits to dschuetz ( https://intrepidusgroup.com/insight/2013/09/rpi-atv/ )

This code has now been added to github, so step 1 is no longer required :slight_smile:

I'll update the Wiki soon with this additional method. Thanks nicochi!

hi


Can you please advise whether this is supposed to work with iOS 5.3 ?


I get an error message every time I enter the address (http://my-plex-server-ip/trailers.cer):


An error occurred while adding the profile [109]. Check the URL and try again.

Just a few things to check:-

1. PlexConnect needs to be running.
2. Are you sure you’re entering the right IP address eg. http://192.168.0.9/trailers.cer
3. Is your Plex Server on a different machine to PlexConnect, as it’s the PlexConnect IP you need not the PMS one.
4. Do you have the trailers.cer file in the assets/certificates directory.

This code has now been added to github, so step 1 is no longer required :)

The code does not work when certificates are not in that location. They don't have to be since there is a  'certfile' setting in the settings file...

it would be better to use that 'certfile' setting and change the extension to 'cer' in python

 if param['CSettings'].getSetting('certfile').startswith('.'):
    # relative to current path
    cfg_certfile = sys.path[0] + sep + param['CSettings'].getSetting('certfile')
 else:
    # absolute path
    cfg_certfile = param['CSettings'].getSetting('certfile')

cfg_certfile = (os.path.splitext(cfg_certfile)[0] + ‘.cer’)

or something like that...

another note for the instructions, if plexConnect runs on a vhost the port should be added to the URL as well

nice work! 

I managed to get it working.

The 2nd step in the OP creates a file called trailers.der, not trailers.cer

I converted it to trailers.cer and everything worked fine.

It's official: it is possible for a newbie to transfer the cert file onto ATV3 without usb and it works on iOS 5.3.

Thanks everyone.

Yep, not sure why the langui.sh instructions have you generate a .cer file on Mac and a .der file on Windows :frowning: Anyway glad you got it working.

please integrate https://github.com/iBaa/PlexConnect/pull/167

I managed to get it working.

The 2nd step in the OP creates a file called trailers.der, not trailers.cer

I converted it to trailers.cer and everything worked fine.

It's official: it is possible for a newbie to transfer the cert file onto ATV3 without usb and it works on iOS 5.3.

Thanks everyone.

You mind explaining how you converted it from der to cer? Was it just a file extension change or did you have to do something more involved?

if you are on windows you can import the .der file into Internet Explorer then export it as .cer.

:slight_smile:

I have Win7 and I’m getting the error:


An error occurred while adding the profile [109]. Check the URL and try again.


I’ve made sure that my .cer file is in the assets/certificates folder.

I’ve checked the things that Roidy suggested. Plex is running and shows DNS request was intercepted. I’ve tried using http://trailers.apple.com/trailers.cer & I’ve tried http://10.0.0.20/trailers.cer (my plex/plexconnect machine is 10.0.0.20)


I’ve disabled my AVG anti-virus since it has a firewall, and the windows firewall.

Restart your Apple TV, restart plexconnect, entire network and PC. You only need to enter yourplexconnnecthostip/trailers.cer (e.g. 192.168.1.101/trailers.cer) with no http prefix. Worst case you can upload your trailers.cer to GitHub and click raw then use that huge URL address to upload your cert. It’s more then likely a issue with your network or PC. Can you try a different pc/plexconnect host?

I've restarted my PC, router, and unplugged the Atv for 30 seconds. Still the same issue, so I broke down and transferred the .cer via USB, things still aren't working though. I'm getting "trailers is unavailable. try again later" when I try 'Trailers', on plexconnect it shows:

17:18:05 DNSServer: Source: ('10.0.0.16', 58813)
17:18:05 DNSServer: Domain: trailers.apple.com
17:18:05 DNSServer: ***intercept request
17:18:05 DNSServer: -> DNS response: 10.0.0.20
17:18:05 DNSServer: DNS request received!
17:18:05 DNSServer: Source: ('10.0.0.16', 62956)
17:18:05 DNSServer: Domain: trailers.apple.com
17:18:05 DNSServer: ***intercept request
17:18:05 DNSServer: -> DNS response: 10.0.0.20
17:18:06 WebServer: serving /js/application.js

Interesting that you need TWO DNS requests to resolve trailers.apple.com. I have never seen something like this... as the final result seems to work: PlexConnect is serving the request for application.js.

Anyways, the "serving" followed by nothing really looks like a cert issue...

Did you clear out all the old certs before installing the newer one? Are you sure the PlexConnect used certs are the same as uploaded via the configurator app?

Thanks for the help everyone. I've figured out the issue. Apparently a windows service was using port 80. On startup plexconnect showed this:

21:39:00 WebServer: Failed to connect to HTTP on 10.0.0.20 port 80: [Errno 10013] An attempt was made to access a socket in a

way forbidden by its access permissions

I used the command 'netstat -ano' to find out that it was Windows 7  (the PID came up as 'system'). After some research I found this page that shows how to handle this kind of problem: http://www.sitepoint.com/unblock-port-80-on-windows-run-apache/, I was able to free up port 80 using 'net stop was /y' but there are other causes for this type of issue including Skype settings.

Glad you got it sorted, if a next time arises give us a complete log first so we can assist you faster.

i have been trying to add a profile for 1 week now, and was reading the above post from Gods_forgivn@hotmail.com and now it is sorted, thanks, it was a windows service hogging the port. just open command prompt and typed this line in
net stop was /y

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.