PlexConnect spk for Synology released

Thanks for everyones suggestions. Looks like more of us are getting this to work!

Not me unfortunately.

I have followed this including changing the listen port to 81 but I get the following:
PlexConnect : ***

PlexConnect : PlexConnect

PlexConnect : Press ENTER to shut down.

PlexConnect : ***

PlexConnect : IP_self: 192.168.1.85

PlexGDM : ***

PlexGDM : looking up Plex Media Server

PlexGDM : ***

PlexGDM : No servers discovered

WebServer : Failed to connect to port 80 (http): [Errno 98] Address already in use

DNSServer : ***

DNSServer : Starting up.

DNSServer : intercept trailers.apple.com: 192.168.1.85

DNSServer : forward other to higher level DNS: 8.8.8.8

DNSServer : ***

DNSServer : Shutting down.

PlexConnect : WebServer not alive. Shutting down.



I do have multiple version of Python Installed so not sure if that's causing the problem.
I have synocommunity 2.7.5-6 (used by Couchpotato server, sickbeard etc.) and
the synology 2.7.3-011

Any suggestions gratefully received!

Are you sure you did step 5 properly as you still have a web sever hogging port 80?
EDIT check to see if you need to change couchpotato/sickbeard off port 80 as well.

Are you sure you did step 5 properly as you still have a web sever hogging port 80?
EDIT check to see if you need to change couchpotato/sickbeard off port 80 as well.

I think I did step 5 correctly.

Here's the lines in my conf file from step 5:

#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 81
#orig 80 - changed for plex connect 120613
#Listen 80
 
 
Can you see anything wrong with this?

I think I did step 5 correctly.

Here's the lines in my conf file from step 5:

#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 81
#orig 80 - changed for plex connect 120613
#Listen 80
 
 
Can you see anything wrong with this?
And here's the bit from step 6 i.e. S97apache-user.sh
 
GenerateConf()
{
cp ${HttpdConf}-user ${HttpdConf}
cp ${HttpdSSLConf}-user ${HttpdSSLConf}
#Orig 80. Changed to 81 for Plex Connect Server - 120613
#if [ "$HttpPort" != "80" ]; then
if [ "$HttpPort" != "81" ]; then
echo "Listen $HttpPort" >> ${HttpdConf}

Are you sure you did step 5 properly as you still have a web sever hogging port 80?
EDIT check to see if you need to change couchpotato/sickbeard off port 80 as well

maybe you have running webstation, photostation, mailstation or dsphoto. This programs use port 80.

If you're using WebStation and not want to change the port this is a worakround:

Set up a interface alias with a new ip:
ifconfig eth0:1  netmask  up

Edit /usr/syno/apache/conf/httpd.conf-user
Listen :80

Restart apache:
/usr/syno/etc/rc.d/S97apache-user.sh

edit /volume1/@appstore/PlexConnect/WebServer.py:
line 146:
        server = HTTPServer(("", 80), MyHandler)

edit /volume1/@appstore/PlexConnect/PlexConnect.py:
    param['IP_self'] = ""


And if you're using dns on your synology, edit DNSServer.py:
line 91:
DNS.bind(('',53))

replace appropriate values within <>.

Thanks for all your suggestions.

Won't get to revisit this until Monday now but yes I think some of my other packages like photostation will be on port 80.  Will have a look on Monday and update with my results. Thanks again...

Hey guys,


I’ve gotten this working for anyone running Atom based Synology NAS’s.


I’ve very quickly stripped the multiprocessor lib usage from PlexConnect.py replacing it with the threading lib alternatives, and bingo, works perfectly on my DS412+


EDIT: this has been implemented in the plexConnect pipe-instead-queue branch found here: https://github.com/iBaa/PlexConnect/tree/Pipe-instead-Queue which should be used instead of the fix I previously posted

Hey guys,
 
I've gotten this working for anyone running Atom based Synology NAS's.
 
I've very quickly stripped the multiprocessor lib usage from PlexConnect.py replacing it with the threading lib alternatives, and bingo, works perfectly on my DS412+
 
Just replace PlexConnect.py with the following file: https://gist.github.com/AnthonyMann/5776560
 
@f00bAr: I don't this think is pull request worthy, as this is not really a decent fix, and i'm no Python developer.


Nice you got it to work.
I have asked Baa and Roidy about it as a fix would be better to be integrated, due to the fact that the PlexConnect.py is being updated fairly regularly.


I can finally say it works for me .
I have Synology 213 with DSM 4.2

1.- I installed the "Python" of synology packages.
2.- I installed the "Python" of synology community too.
3.- I created the directory PlexConnect in "/volume1/".
4.- I unzipped the zip "PlexConnect-XML_templates.zip" in "PlexConnect"
5.- I edited /usr/syno/apache/conf/httpd.conf-user and changed the number of Listen 80 to Listen 81
6.- I edited /usr/syno/etc/rc.d/S97apache-user.sh and chnged "if [ "$HttpPort" != "80" ]; then" by "if [ "$HttpPort" != "81" ]; then"
7.- ran the PlexConnect.py with the command. / PlexConnect in the directory "PlexConnect". The result was ok.
8.- I did the startup script with the command "vi / usr/syno/etc/rc.d/S99plexconnect.sh" and put
#! /bin/sh

LOGFILE="/volume1/PlexConnect/plex.log"
PLEXCONNECT="/volume1/PlexConnect/PlexConnect.py"

case "$1" in
start)
echo "Starting PlexConnect..."
nohup python $PLEXCONNECT 2>&1 > $LOGFILE &
;;
stop)
echo "Stopping PlexConnect..."
killall python
;;
*)
echo "Usage: plexconnect {start|stop}"
exit 1
;;
esac
exit 0
9.- i changed thea attributes of the file created with this command : chmod +x /usr/syno/etc/rc.d/S99plexconnect.sh
10. reboot the synology

I hope you work

oppps i forget it . Of course i changed the dns ip of appletv to the synology ip.


Hi I followed your instructions above everything works fine manually, but when I do the auto start script I get the following error everytime I run the S99 script, I copied it exactly as you have??, once again thanks

WebServer : Shutting down.
PlexConnect : Shutting down.
Traceback (most recent call last):
File "/volume1/PlexConnect/PlexConnect.py", line 83, in
key = raw_input()
EOFError: EOF when reading a line

Nice you got it to work.
I have asked Baa and Roidy about it as a fix would be better to be integrated, due to the fact that the PlexConnect.py is being updated fairly regularly.

Sure, consider this a proof of concept ;)

Edit: added an issue - https://github.com/iBaa/PlexConnect/issues/54

Hey guys,

I've gotten this working for anyone running Atom based Synology NAS's.

I've very quickly stripped the multiprocessor lib usage from PlexConnect.py replacing it with the threading lib alternatives, and bingo, works perfectly on my DS412+

Just replace PlexConnect.py with the following file: https://gist.github.com/AnthonyMann/5776560

@f00bAr: I don't this think is pull request worthy, as this is not really a decent fix, and i'm no Python developer.

i tried your fix for my Synology DS 1512+ (intel), but i get this error now, instead of the multiprocessing thread:

/volume1/@appstore/PlexConnect/PlexConnect.py 
Traceback (most recent call last):
  File "/volume1/@appstore/PlexConnect/PlexConnect.py", line 36, in
    dinit('PlexConnect', param, True)  # init logging, new file, main process
NameError: name 'dinit' is not defined

Hey guys,

I've gotten this working for anyone running Atom based Synology NAS's.

I've very quickly stripped the multiprocessor lib usage from PlexConnect.py replacing it with the threading lib alternatives, and bingo, works perfectly on my DS412+

Just replace PlexConnect.py with the following file: https://gist.github.com/AnthonyMann/5776560

@f00bAr: I don't this think is pull request worthy, as this is not really a decent fix, and i'm no Python developer.

Synology DS1812+


  File "PlexConnect.py", line 13
    from multiback (most recent call last):
                   ^
SyntaxError: invalid syntax
 

Hi

A little question.  when i reboot  the synology,  the script  that run "plexconnect.py fails" because the plex server  is not yet started. Any solution?

Thanks in advance

Hi I followed your instructions above everything works fine manually, but when I do the auto start script I get the following error everytime I run the S99 script, I copied it exactly as you have??, once again thanks

WebServer : Shutting down.
PlexConnect : Shutting down.
Traceback (most recent call last):
File "/volume1/PlexConnect/PlexConnect.py", line 83, in
key = raw_input()
EOFError: EOF when reading a line

PlexConnect is trying to find a return or other entry to a terminal window to shutdown the servers.

When it's running from a startup script, this just doesn't exist.

 

 

I finally commented out as such below from PlexConnect.py and this seemed to take care of it:

 

#     try:
#         key = raw_input()
#     except KeyboardInterrupt:
#         dprint('PlexConnect', 0, "^C received.")

finally:

dprint(‘PlexConnect’, 0, “Shutting down.”)

if cfg.getSetting(‘enable_dnsserver’)==‘True’:

cmd_DNSServer.put(‘shutdown’)

p_DNSServer.join()

cmd_WebServer.put(‘shutdown’)

p_WebServer.join()

 
Hope that helps.

i tried your fix for my Synology DS 1512+ (intel), but i get this error now, instead of the multiprocessing thread:

/volume1/@appstore/PlexConnect/PlexConnect.py 
Traceback (most recent call last):
  File "/volume1/@appstore/PlexConnect/PlexConnect.py", line 36, in
    dinit('PlexConnect', param, True)  # init logging, new file, main process
NameError: name 'dinit' is not defined

Did you get the latest code from the Git repo?

Synology DS1812+


  File "PlexConnect.py", line 13
    from multiback (most recent call last):
                   ^
SyntaxError: invalid syntax
 

Probably a copy/paste error. Use the raw file: https://gist.github.com/AnthonyMann/5776560/raw/69aed0f0ca243301d4f754495dff8c4bc5cbad03/gistfile1.py

Also ensure the rest of your code is from the latest head in the github repo rather than the SPK

It´s working now on my Syno 412+!  :D
Many thanks to Syntax Terror for solving the multiprocessing issue and to wlaursen for helping with the startscript.

does anybody know which files have to be edited  to make the photo flow working mentioned here?

http://elan.plexapp.com/2013/06/04/introducing-plexconnect-an-appletv-client-which-thinks-different/

https://github.com/plexinc/PlexConnect/tree/new-movie-sections

Probably a copy/paste error. Use the raw file: https://gist.github.com/AnthonyMann/5776560/raw/69aed0f0ca243301d4f754495dff8c4bc5cbad03/gistfile1.py

Also ensure the rest of your code is from the latest head in the github repo rather than the SPK

Still same error :(

Still doesn’t work, but…


PlexConnect: started: 14:39:54

PlexConnect: ***

PlexConnect: PlexConnect

PlexConnect: Press ENTER to shut down.

PlexConnect: ***

PlexConnect: started: 14:39:54

PlexConnect: IP_self: 192.168.2.9

PlexGDM: ***

PlexGDM: looking up Plex Media Server

PlexGDM: ***
PlexGDM: No servers discovered

PlexConnect: PMS: 192.168.178.10:32400

DNSServer: started: 14:39:55

DNSServer: ***

DNSServer: Starting up.

DNSServer: intercept trailers.apple.com: 192.168.2.9

DNSServer: forward other to higher level DNS: 192.168.2.254

DNSServer: ***

WebServer: started: 14:39:55

WebServer: ***

WebServer: WebServer: Serving HTTP on 0.0.0.0 port 80.

WebServer: ***


Old DNS Apple TV: 192.168.2.254

Changed to ip Synology: 192.168.2.9




Anybody?

PlexConnect is trying to find a return or other entry to a terminal window to shutdown the servers.

When it's running from a startup script, this just doesn't exist.

I finally commented out as such below from PlexConnect.py and this seemed to take care of it:

#     try:
#         key = raw_input()
#     except KeyboardInterrupt:
#         dprint('PlexConnect', 0, "^C received.")
    
#     finally:
#         dprint('PlexConnect', 0,  "Shutting down.")
#         if cfg.getSetting('enable_dnsserver')=='True':
#             cmd_DNSServer.put('shutdown')
#             p_DNSServer.join()
        
#         cmd_WebServer.put('shutdown')
#         p_WebServer.join()
 
 
Hope that helps.

ok, i substitute "key = raw_input()" by

"while True:

          time sleep(10)"