PlexConnect spk for Synology released


I thought I'd post this here - for anyone else who is a bit lost in terminal using unix commands (so I got stuck in VI and couldn't get out, asked friends for help)

  • ssh to the Diskstation as root  - you need to enable this via the diskstation GUI first (in network settings)
    ssh root@serverIP
  • vi /usr/syno/apache/conf/httpd.conf-user (vi is a text editor)
  • Find the line containing "Listen 80" and change it to some other number (e.g., Listen 81) - press i to insert, then when done esc, then :wq to get back out of VI
  • From the DSM, restart the web server (turning Web Station on & off, or vice-versa, will do this) If you know how to do this from a shell, let me know.
    /etc/init.d/httpd {stop|start|restart} (are your usual options) 
  • Check the default webserver is no longer running on the old port - telnet [disk.stat.tion.ip] 80
    ps -ef |grep httpd or
    telnet 80
  • Start up the PlexConnect app with the correct settings
  • Profit!

note: still couldn't get plex-connect started. 

We both have the same Synology box and are having the same probs. Did you get yours working?

The latest code on Github has had changes made to the code to remove some of the errors that Atom based Synology NAS's/WRT/Tomato devices had been experiencing.

Please test but there should no longer be any need to change any files apart from settings.cfg, where necessary. 

THX ! Works perfekt !

Now I just need someone to create a working package so my lazy ■■■■ can use it on my Synology. =P

I have a problem.
Connect Plex works, but I have constantly buffering.
No matter what setting I choose. 480p or 1080p.
The film has the following data. 1920x1080 and 25fps. Whether 23, 24 or 25 does not matter. Always the same. When I use DS video I have no problems at all. But I must still send via WiFi at DS video. Connect with Plex, everything is connected with cable. That's why I do not understand even more.
Sorry for my english, google translator.
 
Here, the protocol engine
 
DiskStation> ./PlexConnect.py
16:44:25 PlexConnect: started: 16:44:25
16:44:25 PlexConnect: ***
16:44:25 PlexConnect: PlexConnect
16:44:25 PlexConnect: Press ENTER to shut down.
16:44:25 PlexConnect: ***
16:44:25 PlexConnect: started: 16:44:25
16:44:25 PlexConnect: IP_self: 10.0.1.3
16:44:25 PlexGDM: ***
16:44:25 PlexGDM: looking up Plex Media Server
16:44:25 PlexGDM: ***
16:44:26 PlexGDM: servers discovered: 1
16:44:26 PlexConnect: PMS: 10.0.1.3:32400
16:44:26 DNSServer: started: 16:44:26
16:44:26 DNSServer: ***
16:44:26 DNSServer: Starting up.
16:44:26 DNSServer: intercept trailers.apple.com: 10.0.1.3
16:44:26 DNSServer: forward other to higher level DNS: 8.8.8.8
16:44:26 DNSServer: ***
16:44:27 WebServer: started: 16:44:27
16:44:27 WebServer: ***
16:44:27 WebServer: WebServer: Serving HTTP on 0.0.0.0 port 80.
16:44:27 WebServer: ***
16:44:30 DNSServer: DNS request received!
16:44:30 DNSServer: Source: ('10.0.1.2', 59548)
16:44:30 DNSServer: Domain: s.mzstatic.com
16:44:30 DNSServer: ***forward request
16:44:30 DNSServer: -> DNS response from higher level
16:44:34 WebServer: serving application.js
16:44:34 WebServer: serving /volume1/Plexc/assets/plexconnect.xml
16:44:34 WebServer: serving  /volume1/Plexc/assets/utils.js
16:44:34 ATVLogger: loadItem: Library
16:44:34 WebServer: serving .xml: /library/sections
16:44:34 WebServer: serving  /volume1/Plexc/assets/utils.js
16:44:36 ATVLogger: loadItem: Channels
16:44:36 WebServer: serving .xml: /channels/all
16:44:36 WebServer: serving  /volume1/Plexc/assets/utils.js
16:44:37 ATVLogger: loadItem: Library
16:44:37 WebServer: serving .xml: /library/sections
16:44:37 WebServer: serving  /volume1/Plexc/assets/utils.js
16:44:40 ATVLogger: loadURL (override): http://trailers.apple.com/library/sections/7
16:44:40 WebServer: serving .xml: /library/sections/7
16:44:40 WebServer: serving  /volume1/Plexc/assets/utils.js
16:44:42 ATVLogger: loadURL (override): http://trailers.apple.com/library/sections/7/all
16:44:42 WebServer: serving .xml: /library/sections/7/all
16:44:43 WebServer: serving  /volume1/Plexc/assets/utils.js
16:44:43 WebServer: serving  /volume1/Plexc/assets/scrobble.js
16:44:47 ATVLogger: loadURL (override): http://trailers.apple.com/library/metadata/926
16:44:47 WebServer: serving .xml: /library/metadata/926
16:44:48 WebServer: serving  /volume1/Plexc/assets/utils.js
16:44:48 WebServer: serving  /volume1/Plexc/assets/selectAudioAndSubs.js
16:44:50 ATVLogger: loadURL (override): http://trailers.apple.com/library/metadata/926
16:44:50 WebServer: serving .xml: /library/metadata/926
16:44:51 ATVLogger: Player state: Loading at this time: 0
16:45:41 DNSServer: DNS request received!
16:45:41 DNSServer: Source: ('10.0.1.2', 52806)
16:45:41 DNSServer: Domain: trailers.apple.com
16:45:41 DNSServer: ***intercept request
16:45:41 DNSServer: -> DNS response: 10.0.1.3
16:45:41 ATVLogger: Player state: Playing at this time: 0
16:45:57 ATVLogger: Player state: Loading at this time: 15.699389663
16:46:21 ATVLogger: Player state: Playing at this time: 15.686217783
16:46:37 ATVLogger: Player state: Loading at this time: 31.8914935
16:47:10 DNSServer: DNS request received!
16:47:10 DNSServer: Source: ('10.0.1.2', 58985)
16:47:10 DNSServer: Domain: trailers.apple.com
16:47:10 DNSServer: ***intercept request
16:47:10 DNSServer: -> DNS response: 10.0.1.3
16:47:10 ATVLogger: Player state: Playing at this time: 31.878024135
16:47:26 ATVLogger: Player state: Loading at this time: 47.592779553
16:47:41 ATVLogger: Player state: Playing at this time: 47.577383677
16:47:50 ATVLogger: Player state: Loading at this time: 55.934101435
16:48:39 DNSServer: DNS request received!
16:48:39 DNSServer: Source: ('10.0.1.2', 57884)
16:48:39 DNSServer: Domain: trailers.apple.com
16:48:39 DNSServer: ***intercept request
16:48:39 DNSServer: -> DNS response: 10.0.1.3
16:48:39 ATVLogger: Player state: Playing at this time: 55.920346906
16:48:55 ATVLogger: Player state: Loading at this time: 71.635578821
16:49:01 ATVLogger: Player state: Playing at this time: 71.618350205
16:49:09 ATVLogger: Player state: Loading at this time: 79.934179548
16:49:40 DNSServer: DNS request received!
16:49:40 DNSServer: Source: ('10.0.1.2', 51085)
16:49:40 DNSServer: Domain: trailers.apple.com
16:49:40 DNSServer: ***intercept request
16:49:40 DNSServer: -> DNS response: 10.0.1.3
16:49:40 ATVLogger: Player state: Playing at this time: 79.920311118
16:49:56 ATVLogger: Player state: Loading at this time: 95.678120118
16:50:04 ATVLogger: Player state: Playing at this time: 95.661135059
16:50:12 ATVLogger: Player state: Loading at this time: 103.934164893
16:50:42 DNSServer: DNS request received!
16:50:42 DNSServer: Source: ('10.0.1.2', 55262)
16:50:42 DNSServer: Domain: trailers.apple.com
16:50:42 DNSServer: ***intercept request
16:50:42 DNSServer: -> DNS response: 10.0.1.3
16:50:42 ATVLogger: Player state: Playing at this time: 103.920823575
16:50:57 ATVLogger: Player state: Loading at this time: 119.720742074
16:51:29 ATVLogger: Player state: Playing at this time: 119.707322667
16:51:45 DNSServer: DNS request received!
16:51:45 DNSServer: Source: ('10.0.1.2', 58087)
16:51:45 DNSServer: Domain: trailers.apple.com
16:51:45 DNSServer: ***intercept request
16:51:45 DNSServer: -> DNS response: 10.0.1.3
16:51:45 ATVLogger: Player state: Loading at this time: 135.912857001
16:52:04 ATVLogger: Player state: Playing at this time: 135.896012456
16:52:19 ATVLogger: Player state: Loading at this time: 151.614097823
16:52:26 ATVLogger: Player state: Playing at this time: 151.599317812
16:52:34 ATVLogger: Player state: Loading at this time: 159.934178243
16:53:09 DNSServer: DNS request received!
16:53:09 DNSServer: Source: ('10.0.1.2', 57480)
16:53:09 DNSServer: Domain: trailers.apple.com
16:53:09 DNSServer: ***intercept request
16:53:09 DNSServer: -> DNS response: 10.0.1.3
16:53:09 ATVLogger: Player state: Playing at this time: 159.916693219
16:53:25 ATVLogger: Player state: Loading at this time: 175.657629505
16:53:30 ATVLogger: Player state: Playing at this time: 175.641741519
16:53:38 ATVLogger: Player state: Loading at this time: 183.955521817
16:54:29 DNSServer: DNS request received!
16:54:29 DNSServer: Source: ('10.0.1.2', 65448)
16:54:29 DNSServer: Domain: trailers.apple.com
16:54:29 DNSServer: ***intercept request
16:54:29 DNSServer: -> DNS response: 10.0.1.3
16:54:29 ATVLogger: Player state: Playing at this time: 183.938061161
16:54:45 ATVLogger: Player state: Loading at this time: 199.699400909
16:55:21 ATVLogger: Player state: Playing at this time: 199.683756911
 

Is your NAS powerful enough to transcode if they are not natively compatible media files with the ATV?

Hi,

If you as I was on my DS1512+ running DHCP server but not an DNS you would get into problems which I under some days now have been getting a solution.

  1. Get the latest copy from the github, the package will not work.
  2. Change the web config (i.e. port 80 -> 81) if you not running web applications on your DS. If you do, then you need to find out how to configure the web server as of wiki but on a DS
  3. if you have DHCP server you need to look at this post and correct dnsmasq which interfere port 53 http://forum.synology.com/enu/viewtopic.php?f=196&t=48076&p=238469#p238469  
  4. To enable background running, you need to add the script /usr/syno/etc/rc.d/S99plexconnect.sh  as mention in some posts above
  5. You will probably get some problems and to fix this you have to do in the PlexConnect.py file: 
    <blockquote class="ipsBlockquote" data-author="jopacer" data-cid="412140" data-time="1371237485"><p>ok, i substitute "key = raw_input()" by</p>
    
    <p>"while True:</p>
    <p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; time.sleep(10)"</p></blockquote>
    <p>(Note the . between time and sleep, it would not work otherwise and in the script, without the quote signs ")</p>
    </li>
    

Hope this will work for you guys!

Yes, great work, I got it working on the DS713+ too! This is awesome, many thanks!

After I was wondering if my ds 712 + is really fast enough, I have tested it with the plex app for the Ipad 2.
First, I have also since been steadily buffering. So I looked a bit in the settings. Since I noticed that the streaming quality is on 3Mbps 720p, although the video material 1080p. Also, I have looked in my DiskStation Resource Monitor. In the above settings at 720p, 6 and more Plex transcoder  opened each with 1-14% cpu load and 85mb ram. I change the settings to 20mbps and 1080p, then there is only one Plex transcoder process with about 25% cpu and just 20mb ram used. And with these settings everything runs perfectly. No stuttering, no buffering. So I wanted to use these settings on the app trailer. Unfortunately it does not work there. Even at 20mbps and 1080p setting, will re-started several Plex transcoder processes and stuttering the whole time.
 
Sorry for my google English ;-)

instead of moving the default synology port to 81 I moved plexconnect to port 81...

in WebServer.py I changed the port to 81

I enabled vhosts in /usr/syno/apache/conf/httpd.conf-user

created /usr/syno/apache/conf/extra/httpd-vhosts.conf with content:

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
 
 
    ServerName trailers.apple.com
    ProxyPreserveHost On
    ProxyPass / http://192.168.0.9:81/
    ProxyPassReverse / http://192.168.0.9:81/
 
restart apache
 
/usr/syno/etc.defaults/rc.d/S97apache-user.sh restart
 
start plexconnect....

Really like this one!

For those also running their own DNS on the Synology, use these steps to let the Synology do the DNS redirect:

1) Open the DNS server package

2) Go to Zones

3) Click Create -> Master zone

Type: Forward
Domain name: trailers.apple.com
Master dns: *IP if synology with dns server*
4) Click OK
5) Double click the new trailers.apple.com zone to open Edit Resource Record
6) Create -> A record
Name: *leave empty*
IP: *IP of plexconnect webserver, probably the same as your synology box*
7) Click OK
8) Disable the dns redirect in PlexConnect running on your synology (Settings.cfg): enable_dnsserver = False
9) Try the trailers app on you apple tv (which should be using your synology dns server)
 
Pros: all apple tv's, pc's, mac's, ipad's, iphone's, other devices, etc. using this dns server will work;
Cons: all apple tv's, pc's, mac's, ipad's, iphone's, other devices, etc. using this dns server can't access the original trailers.apple.com any longer. 

instead of moving the default synology port to 81 I moved plexconnect to port 81...

in WebServer.py I changed the port to 81

I enabled vhosts in /usr/syno/apache/conf/httpd.conf-user

created /usr/syno/apache/conf/extra/httpd-vhosts.conf with content:

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
 
 
    ServerName trailers.apple.com
    ProxyPreserveHost On
    ProxyPass / http://192.168.0.9:81/
    ProxyPassReverse / http://192.168.0.9:81/
 
restart apache
 
/usr/syno/etc.defaults/rc.d/S97apache-user.sh restart
 
start plexconnect....
A little improvement of the vhosts config:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

NameVirtualHost *:80

<VirtualHost *:80>
        ProxyPreserveHost On
        ProxyPass / http://192.168.1.100:5000/
        ProxyPassReverse / http://192.168.1.100:5000/

                  
<VirtualHost *:80>
        ServerName trailers.apple.com
        ProxyPreserveHost On
        ProxyPass / http://192.168.1.100:81/
        ProxyPassReverse / http://192.168.1.100:81/

This proxies all traffic without the explicit trailers.apple.com host header to the Synology DSM (much like the original behavior).
 
Important: the order of the virtual hosts in this file is relevant, the first virtual host is used if none of the other server names match.

YES! I can confirm it works now on my DS713+! Such a great job, threefold hurray for the PlexConnect devs. I wasn't expecting the experience to be so good. I was using the iPhone plex app to airplay to my aTV but this is much, much better. Anyway, here are my steps (you need to have some experience using a terminal window, but nothing mind boggling):

  1. Change the DNS server on your apple TV to the ip-address of your NAS. Make sure that ip does not change, you might want to fix the ip address in your router. If it does change, you need to change it on your aTV as well.
  2. Leave the spk package for Synology that somebody released alone. It does not work! Take the latest files from here (they have been updated to work on Synology, mostly): https://github.com/iBaa/PlexConnect
  3. Put the zip file you got on step 1, unzip it, and put the resulting files on your Synology in a folder of your liking (I put mine on volume1 in a folder that I named plexconnect).
  4. Edit /usr/syno/apache/conf/httpd.conf-user (in order to do this, you have to ssh to your synology from a terminal window on your mac or pc: ssh root@ipOfYourSynology, enter your password, then use a text editor such as vi: vi /usr/syno/apache/conf/httpd.conf-user
    If you haven't used vi before, look up a manual on Google (e.g. here: http://www.cs.fsu.edu/general/vimanual.html). Upon first use vi can be a bit counter intuitive.
  5. Find the line containing "Listen 80" and change it to some other number (e.g., Listen 81). Save the file.
  6. Go to the control panel of the DSM web interface and restart the web server (turning Web Station on & off, or vice-versa, will do this).
  7. Download/activate the python package in the Packages app of DSM.
  8. Go back to the terminal window you used in step 4. Change to the directory in which you put the PlexConnect files. Edit PlexConnect.py, e.g. using vi again as you did on step 4. On line 60 of PlexConnect.py there is something like this: key = raw_input(); change it to this:
    while True:
        time.sleep(10)
  9. Save the file.
  10. After that create the startup script using: vi /usr/syno/etc/rc.d/S99plexconnect.sh and paste the following code:

    #! /bin/sh
    

    LOGFILE="/volume1/plexconnect/PlexConnect-XML_templates/plex.log"
    PLEXCONNECT="/volume1/plexconnect/PlexConnect-XML_templates/PlexConnect.py"

    case “$1” in
    start)
    echo “Starting PlexConnect…”
    python $PLEXCONNECT 2>&1 > $LOGFILE &
    ;;
    stop)
    echo “Stopping PlexConnect…”
    killall python
    ;;
    *)
    echo “Usage: plexconnect {start|stop}”
    exit 1
    ;;
    esac
    exit 0



  11. Make sure you put the correct folder path for LOGFILE and PLEXCONNECT in the above script! Save the file.


  12. Put the right permissions on this file, using: chmod +x /usr/syno/etc/rc.d/S99plexconnect.sh





  13. Start the script by typing /usr/syno/etc/rc.d/S99plexconnect.sh start (alternatively, restart your Synology, the script should now start automatically)

    </div>
    </li>
    

    Voila, plexconnect should now be running, happy streaming.
    PS: I borrowed some of these steps from this tutorial, which should also work: http://bytetrag.de/2013/06/10/PlexConnect-on-Synology/

    PPS: If you want to enable subtitles for mp4 files you need to enable 'force transcoding'. This can simply be done within the trailers (PlexConnect) app, on the last tab.

After a test, it looks like the m4v files much better than running mkv files. There is not even a start Plex transcoder process. But MUST be on True Force Direct Play (and this setting can not play mkv files at all). Sorry if there was confusion by the mkv/m4v history. I actually only use mkv files. But no problem now convert to m4v.

After a test, it looks like the m4v files much better than running mkv files. There is not even a start Plex transcoder process. But MUST be on True Force Direct Play (and this setting can not play mkv files at all). Sorry if there was confusion by the mkv/m4v history. I actually only use mkv files. But no problem now convert to m4v.

Sure m4v files are running better on the ATV, because they can be played directly and there is no need for transcoding. Like you said direct play can not be used for mkv.

Hi. I have the DS 712 +
If I follow your steps, I get the following error message:
DiskStation>. / PlexConnect.py
12:28:20 PlexConnect: started: 12:28:20
12:28:20 PlexConnect: ***
12:28:20 PlexConnect: PlexConnect
12:28:20 PlexConnect: Press ENTER to shut down.
12:28:20 PlexConnect: ***
12:28:20 PlexConnect: started: 12:28:20
12:28:20 PlexConnect: IP_self: 10.0.1.3
12:28:20 PlexGDM: ***
12:28:20 PlexGDM: looking up Plex Media Server
12:28:20 PlexGDM: ***
12:28:21 PlexGDM: servers discovered: 1
12:28:21 PlexConnect: PMS: 10.0.1.3:32400
12:28:21 DNSServer: started: 12:28:21
Process 1 Process:
Traceback (most recent call last):
   File "/ usr/local/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
     self.run ()
   File "/ usr/local/lib/python2.7/multiprocessing/process.py", line 114, in run
     self._target (self._args *, ** self._kwargs)
   File "/ volume1/Plexc/DNSServer.py", line 132, in Run
     cfg_IP_DNSMaster = param ['CSettings']. GetSetting ('ip_dnsmaster')
KeyError: 'CSettings'
12:28:21 PlexConnect: DNSServer not alive. Shutting down.
 
I PlexConnect.py again to change the "key = raw_input ();" everything is running again.

  1. #! /bin/sh
    

    LOGFILE=“/volume1/plexconnect/PlexConnect-XML_templates/plex.log”
    PLEXCONNECT=“/volume1/plexconnect/PlexConnect-XML_templates/PlexConnect.py”

    case “$1” in
    start)
    echo “Starting PlexConnect…”
    python $PLEXCONNECT 2>&1 > $LOGFILE &
    ;;
    stop)
    echo “Stopping PlexConnect…”
    killall python
    ;;
    *)
    echo “Usage: plexconnect {start|stop}”
    exit 1
    ;;
    esac
    exit 0


.

this startup script is dangerous. sending the stop signal will kill ALL python tasks!

Hi. I have the DS 712 +
If I follow your steps, I get the following error message:
DiskStation>. / PlexConnect.py
12:28:20 PlexConnect: started: 12:28:20
12:28:20 PlexConnect: ***
12:28:20 PlexConnect: PlexConnect
12:28:20 PlexConnect: Press ENTER to shut down.
12:28:20 PlexConnect: ***
12:28:20 PlexConnect: started: 12:28:20
12:28:20 PlexConnect: IP_self: 10.0.1.3
12:28:20 PlexGDM: ***
12:28:20 PlexGDM: looking up Plex Media Server
12:28:20 PlexGDM: ***
12:28:21 PlexGDM: servers discovered: 1
12:28:21 PlexConnect: PMS: 10.0.1.3:32400
12:28:21 DNSServer: started: 12:28:21
Process 1 Process:
Traceback (most recent call last):
   File "/ usr/local/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
     self.run ()
   File "/ usr/local/lib/python2.7/multiprocessing/process.py", line 114, in run
     self._target (self._args *, ** self._kwargs)
   File "/ volume1/Plexc/DNSServer.py", line 132, in Run
     cfg_IP_DNSMaster = param ['CSettings']. GetSetting ('ip_dnsmaster')
KeyError: 'CSettings'
12:28:21 PlexConnect: DNSServer not alive. Shutting down.
 
I PlexConnect.py again to change the "key = raw_input ();" everything is running again.


OK, that's odd. I've also seen the above fix come up in this thread before but I guess there are differences between models. Anyway, guess it's working for you as well now, so that's good to know :-)

this startup script is dangerous. sending the stop signal will kill ALL python tasks!


Personally I would reserve the word dangerous for scripts that jeopardize the security of a system, but I guess that's indeed good to know for those that rely on other Python scripts as well. But even then, the script would normally only run at startup and for typical use you would keep PlexConnect running all the time, so no need to run that script with a stop command. Thanks for pointing that out though.

please stop posting in this thread, lets continue here http://forums.plexapp.com/index.php/topic/72356-plexconnect-on-synology/

i've posted a link there to a working synology pkg based on the v0.1 release of PlexConnect