PlexConnect on aTV2/jailbroken -> launchctl

plexconnect

#1

In reference to... https://forums.plexapp.com/index.php/topic/72129-new-hack-running-the-plexconnect-python-script-on-your-jailbroken-atv2/?hl=%2Bnew+%2Bhack

 

Here is the thing:

With the support for the native client seemingly ceased and our improvements in running PlexConnect all over the world (OSX, Win, Linux,... directly or as daemon...) I took another look into "installing" PlexConnect on my aTV2.

Reusing most of the OSX launchctl stuff I was finally able to make it - it stays there, even after a reboot. No ssh and stuff required. :-D

 

There still are some rough edges that need work...

a.) Still hijacking Trailers. Though we should be able to add a nice new icon.

     -> ExtraInternetCategories.plist, bag.plist,... wahlman, jdilinger?

 

b.) With the OSX plist, launchctl dies at startup, when spawning the WebServer secondary processes

     -> sys.stdout.flush() doesn't work as stdout is - aeh - nothing?

Is this a limitation of iOS (5.2.x)? Or python 2.7.3 - nothing newer available?

Any iOS developers around with background information?

 

Currently I got it fixed with adding

 

StandardOutPath
./PlexConnect_stdout.log
StandardErrorPath
./PlexConnect_stderr.log
to the plist... but then it creates those two files... :-(
 
c.) there must have been a third issue, but I forgot...
 
Installation...
source files attached, unzip and add to latest PlexConnect/support/iOS (aTV jailbreak)
 
- install python on aTV: eg https://forums.plexapp.com/index.php/topic/72129-new-hack-running-the-plexconnect-python-script-on-your-jailbroken-atv2/?p=416888
- SFTP into aTV and copy the complete directory to /Application/PlexConnect. Or somewhere else, whatever you prefer
- SFTP PlexConnect/support/iOS*/Settings.cfg to PlexConnect/Settings.cfg, overwriting the later if already there. We need some settings changed, like disabling the DNSServer.
- add PlexConnect/support/iOS*/hosts_addon_PlexConnect to /etc/hosts
- option: add PlexConnect/support/iOS*/hosts_addon_preventATVUpdate as well
- SSH into aTV, "cd /Application/PlexConnect", run "./support/iOS*/install.bash"
- check with "ps -ef". You should find 3 Phyton/PlexConnect related processes
- check with "launchctl list | grep .plexconnect.". You should get "  -  com.plex.plexconnect.bach.plist"
 
Usage...
Just hit the Trailers app!

#2

If we could host a bag.plist pointed at our pms on the atv2 that would be ideal. Then we could host the images as well and have a seperate app for plexconnect :). Fire up addsite point it at http://127.0.0.1/bag.plist or whatever. Let me try this and see what I can come up with. Then we could close ports 80 & 53 & our webserver port since its all on the atv :) only the pms port would need to be open with allow with auth wanip(s) if you take your atv from place to place since the atv hosts plexconnect.


#3

If we could host a bag.plist pointed at our pms on the atv2 that would be ideal. Then we could host the images as well and have a seperate app for plexconnect :). Fire up addsite point it at http://127.0.0.1/bag.plist or whatever. Let me try this and see what I can come up with. Then we could close ports 80 & 53 & our webserver port since its all on the atv :) only the pms port would need to be open with allow with auth wanip(s) if you take your atv from place to place since the atv hosts plexconnect.

Why do you need the PMS to allow the WAN IP, MYPlex takes care of this automatically.


#4

Only if you want configured channels, otherwise myplex would work as well minus configured channels. This is just my preference as the images show on this post:

https://forums.plexapp.com/index.php/topic/86031-plexconnect-on-the-go-atv23-no-jailbreak/


#5

Only if you want configured channels, otherwise myplex would work as well minus configured channels. This is just my preference as the images show on this post:

https://forums.plexapp.com/index.php/topic/86031-plexconnect-on-the-go-atv23-no-jailbreak/

No channel access for owned servers is not a limitation of MyPlex, it is merely because it has not been implemented.


#6

Heck if that was implemented on myplex that would be great :) No more needing to allow without auth on pms sounds good to me, is it also possible to put our library in the library tab when running myplex? You can call it myplexgo lol, just kidding obviously.

Ok back to trying to get this to work with addsite. Also if we could get a a web server running on the atv, that would be great.


#7

- SSH into aTV, "cd /Application/PlexConnect", run "./support/iOS*/install.bash"

I got stuck there permission denied. Then I edited the com.plex.plexconnect.bash.plist to match the ATV directory structure then copied the file over via sftp then changed directory and fixed it up like this:

cd /Library/LaunchDaemons

chown root:wheel com.plex.plexconnect.bash.plist

chmod 644 com.plex.plexconnect.bash.plist

launchctl load com.plex.plexconnect.bash.plist

When I ran the command:

launchctl list | grep.plexconnect

it says command not found any ideas?

When I try to re-run lauchctl load com.plex.plexconnect.bash.plist it says already loaded. Here are some other errors that I can't figure out as well.

atv-:/Applications/PlexConnect root# ./PlexConnect.py

-sh: ./PlexConnect.py: Permission denied

atv-:/Applications/PlexConnect root# ./PlexConnect_daemon.bash start

-sh: ./PlexConnect_daemon.bash: Permission denied

 

Do I need to change the password from alpine first? Didn't help using passwd to try to change it.


#8

trying ur thing here Baa.. but am having trouble with the python thing.. i did get it to start and show up once.. but after reebot its gone again when i type the ssh commands to look for it.. any ideas? when i try to do the bash install again it says its already installed so..

wahlman.. i had no problem installing it with the standard alpine psw


#9

nevermind, I read your post incorrectly.


#10

Ok back to trying to get this to work with addsite. Also if we could get a a web server running on the atv, that would be great.



Um one of the main components of PlexConnect is a webserver, this is how you can load the cert profile just using PlexConnect and the ATV remote and how PlexConnect serves up the code to the ATV.


#11

I guess what I'm trying to say there is can I add a bag.plist like I do via addsite like this 127.0.0.1/bag.plist. On my mac I host 192.168.1.101:1234/bag.plist using a webserver when I add the bag.plist via addsite on the ATV2. Can plexconnect's webserver do that on the ATV2?


#12

Maybe........


#13

wohaa got it working.. the problem was the certs (rookie mistake)


#14

That would be great, then we could move away from this and just use addsite since this is a atv2 only solution anyways. Maybe it will make things a little easier, I don't know for sure. Im sure we can make a stupid easy bash script to automate the process.

@stoffez can you pm me your plexconnect folder in a zip so I can look at it as well as any other edited files you used? :) I don't know where I'm dropping the ball here.


#15

muhhaaa got the addsite working aswell... now when it points to 127.0.0.1 you can juts put this in your hosted bag file

http://127.0.0.1/Applications/PlexConnect/assets/js/application.js

then u get away from that thing where u havto change the ip everytime the ATV ip changes.. now if i could just free up the trailers app then we are good to go

dont solve the (must have a webbserver issue to use addsite) but its a step in the right direction :D


#16

It should be easy to implement a different app using addsite with a custom bag.plist. So I'm confused you can point at a bag.plist on the ATV2 or no? What iOS are you running by the way.


#17

i just did.. i have the plex connect app right now.. just trying to fix so i can use trailers app as usuall to :D


#18

Just set dns to auto, you must send me your folder in a zip, please o please, or host it on your web server so I can look at it. ;)

How the heck did you get past that step I'm stuck on. If you can get me to where your at I can write up a easy how to and add addsite bash scripts to automate this. More progress on the ATV2 side, to bad for atv3 owners, I'm trying to fix adsite but I cannot host a bag.plist via https:

https://forums.plexapp.com/index.php/topic/81972-installing-a-new-app-on-appletv-without-hijacking-trailers/page-21


#19

i have it on auto.. in digging into the host file..think thats where the prob is :)


#20

yup that was it :D the on the go now works :DDD