JiK
October 31, 2012, 6:32am
101
(tel:1351646862)’ post=‘307071’]
Hi All!
I can help on the sound issue at least. I’m using hdmi and with omxplayer you have to define ‘-o hdmi’ to output sound over hdmi.
Also spot on guess with 3000 for the port. All my mac plex clients broadcast on tcp-3000 and udp-9777 (xbmc events).
I’m glad to see motion on this. When I first looked it was somewhat stagnant. I ended up trying to make a client with ruby (I’ve wanted to learn ruby anyway, so it proved fun). Unfortunately, I can’t find a good ruby Avahi/dnssd/mdns library for ruby that I can get to run on my raspi.
The code is here if anyone wants to look through it for ideas: https://github.com/p…sky/plexpi-lite
The eventual idea was to have a non-lite version that would have a super simple interface. I’m willing to help with the python version since I’ve hit a wall in ruby.
I'm glad there are more and more people helping out on this one, we might get somewhere! I gave listening on port 80 a try but it can't connect to the socket, even when I'm starting the client as sudo.
Last week I gave multithreading a try, the idea behind it was to create two web.py servers whereof 1 listens to the incoming requests on port 3000 an one on port 80. But I didn't get the second web.py server running. Also tried to manually create sockets, this also returns in an error. This code is in my development branch that's isnt pushed to github atm, if someone is interested in this idea let me know then I I'll push it to github.
I'm glad there are more and more people helping out on this one, we might get somewhere! I gave listening on port 80 a try but it can't connect to the socket, even when I'm starting the client as sudo.
Last week I gave multithreading a try, the idea behind it was to create two web.py servers whereof 1 listens to the incoming requests on port 3000 an one on port 80. But I didn't get the second web.py server running. Also tried to manually create sockets, this also returns in an error. This code is in my development branch that's isnt pushed to github atm, if someone is interested in this idea let me know then I I'll push it to github.
I have attached some code that listens on two ports and gets the command and arguments from the request which I hope you find useful. I am hoping that just adding your zeroconf and xbmcCommands class will work, I'll try this evening.
(warning I have not used python before so the code may not be ideal :) )
JiK
October 31, 2012, 12:34pm
103
I have attached some code that listens on two ports and gets the command and arguments from the request which I hope you find useful. I am hoping that just adding your zeroconf and xbmcCommands class will work, I'll try this evening.
(warning I have not used python before so the code may not be ideal :) )
That looks great! Will take a better look at the code tonight and try to implement this into the script.
Looks like the second port is actually 9777 UDP, using the XBMC Events protocol for most buttons (including play, pause, etc). I’m working on some code now that spawns a second thread that listens on the UDP port and calls functions accordingly. It’ll be available soon at:
JiK
October 31, 2012, 6:23pm
105
Looks like the second port is actually 9777 UDP, using the XBMC Events protocol for most buttons (including play, pause, etc). I'm working on some code now that spawns a second thread that listens on the UDP port and calls functions accordingly. It'll be available soon at:
[https://github.com/miriad/pyplex](https://github.com/miriad/pyplex)
keep us posted! I'm too busy with other stuff that has to be done to even think at coding tonight.. :(
emha
October 31, 2012, 8:52pm
106
Looks like the second port is actually 9777 UDP, using the XBMC Events protocol for most buttons (including play, pause, etc). I'm working on some code now that spawns a second thread that listens on the UDP port and calls functions accordingly. It'll be available soon at:
https://github.com/miriad/pyplex
looking forward to get the newest data :)
looking forward to get the newest data :)
Currently have what appears to be a mostly working client, but with some significant changes to the original code:
Using the tornado websever, instead of web.py (install via sudo pip install tornado ). Web client is in a new thread
-- This allows for having a seperate thread managing the web requests
Using a new thread for a UDP listener
Both threads now use a shared queue (Python Queue class) to queue up commands, and the main thread handles the queue entries.
Awaiting some testing (GF is using the TV my pi is attached to), but everything seems to be working running from the command line. Will push to github once it tests OK.
JiK
October 31, 2012, 9:25pm
108
Currently have what appears to be a mostly working client, but with some significant changes to the original code:
Using the tornado websever, instead of web.py (install via sudo pip install tornado ). Web client is in a new thread
-- This allows for having a seperate thread managing the web requests
Using a new thread for a UDP listener
Both threads now use a shared queue (Python Queue class) to queue up commands, and the main thread handles the queue entries.
Awaiting some testing (GF is using the TV my pi is attached to), but everything seems to be working running from the command line. Will push to github once it tests OK.
This sounds awesome! Can't wait to test and look around your code and learn from it :)
Well, the code’s posted, still just as “untested” as before, but you can go ahead and take a look at it.
It’d likely have a large number of problems, but the udplistener class does seem to work correctly.
This sounds awesome! Can't wait to test and look around your code and learn from it :)
JiK
October 31, 2012, 9:46pm
110
Well, the code's posted, still just as "untested" as before, but you can go ahead and take a look at it.
It'd likely have a large number of problems, but the udplistener class does seem to work correctly.
I looked at your github page but the only file changed is the readme file. Did you push all changes to github?
Try that again. havent used git in such a long time, been ruined by cvs/svn at work. Always forget to push now.
I looked at your github page but the only file changed is the readme file. Did you push all changes to github?
JiK
October 31, 2012, 10:21pm
112
Try that again. havent used git in such a long time, been ruined by cvs/svn at work. Always forget to push now.
Thanks, new files are there. I don't see any changes to pyplex.py. Is this correct? I only skimmed the code (It'll take a while before i'll have the time to code after office hours) but am i correct when i think that in order to use your new implementation pyplex.py must be updatet to use them?
thanks for the awesome work!
Thanks, new files are there. I don't see any changes to pyplex.py. Is this correct? I only skimmed the code (It'll take a while before i'll have the time to code after office hours) but am i correct when i think that in order to use your new implementation pyplex.py must be updatet to use them?
thanks for the awesome work!
Ach! forgot git doesnt autocommit files if you dont list any. Just did a commit -a and push.
Also, just did some testing, play/pause and stop are working great. Still putzing around with getting HDMI and audio to work on my test file.
JiK
October 31, 2012, 10:31pm
114
Ach! forgot git doesnt autocommit files if you dont list any. Just did a commit -a and push.
Also, just did some testing, play/pause and stop are working great. Still putzing around with getting HDMI and audio to work on my test file.
This sounds awesome! To bad i really have to go to bed now, otherwise i would have played around with this for the couple hours :P
emha
October 31, 2012, 10:39pm
115
Ach! forgot git doesnt autocommit files if you dont list any. Just did a commit -a and push.
Also, just did some testing, play/pause and stop are working great. Still putzing around with getting HDMI and audio to work on my test file.
Is it a special test file? My sound works great with hdmi.
Its a breaking bad episode. Looks like its probably setup related, not script / player / hardware related. I’ll have to check out the rest of my hardware later to see why my audio is not working.
Anyway, my github repo should have a pretty good working client.
Audio working well for me, tried a couple of files and playback works However the controls don’t seem to be working for me. While trying to figure it out I put the following debug messages in the Pause def.
<br />
def Pause(self, message):<br />
global omx<br />
if(omx):<br />
print "Have omx"<br />
omx.toggle_pause()<br />
else:<br />
print "No omx"<br />
I get the following while trying to pause:
<br />
starting, please wait...<br />
Service published<br />
Started UDP listener<br />
HTTP Init done<br />
Started HTTP listener<br />
PlayMedia(http://192.168.0.5:32400/library/metadata/6914;/library/metadata/6914;+; ; )<br />
Front: 9, End: 85<br />
Got HTTP command PlayMedia, args: [u'http://192.168.0.5:32400/library/metadata/6914', u'/library/metadata/6914', u'+', u' ', u' ']<br />
Got command: PlayMedia, args: [u'http://192.168.0.5:32400/library/metadata/6914', u'/library/metadata/6914', u'+', u' ', u' ']<br />
6914<br />
fullpath http://192.168.0.5:32400/library/metadata/6914<br />
Command PlayMedia not implemented yet<br />
Got UDP Command Pause<br />
Got command: Pause, args: [u'']<br />
No omx<br />
I can see omx is a global variable and it it is set PlayMedia, so don't know why it is failing for the commands. Any ideas?
Audio working well for me, tried a couple of files and playback works :) However the controls don't seem to be working for me. While trying to figure it out I put the following debug messages in the Pause def.
<br />
def Pause(self, message):<br />
global omx<br />
if(omx):<br />
print "Have omx"<br />
omx.toggle_pause()<br />
else:<br />
print "No omx"<br />
I get the following while trying to pause:
<br />
starting, please wait...<br />
Service published<br />
Started UDP listener<br />
HTTP Init done<br />
Started HTTP listener<br />
PlayMedia(http://192.168.0.5:32400/library/metadata/6914;/library/metadata/6914;+; ; )<br />
Front: 9, End: 85<br />
Got HTTP command PlayMedia, args: [u'http://192.168.0.5:32400/library/metadata/6914', u'/library/metadata/6914', u'+', u' ', u' ']<br />
Got command: PlayMedia, args: [u'http://192.168.0.5:32400/library/metadata/6914', u'/library/metadata/6914', u'+', u' ', u' ']<br />
6914<br />
fullpath http://192.168.0.5:32400/library/metadata/6914<br />
Command PlayMedia not implemented yet<br />
Got UDP Command Pause<br />
Got command: Pause, args: [u'']<br />
No omx<br />
I can see omx is a global variable and it it is set PlayMedia, so don't know why it is failing for the commands. Any ideas?
The line "Command PlayMedia not implemented yet" means there was an exception while calling the command, so omx probably did not get set (if the exception was above that line).
I'm going to do a few mods to make exceptions more visible in a few minutes, I'll post back when I can.
The line "Command PlayMedia not implemented yet" means there was an exception while calling the command, so omx probably did not get set (if the exception was above that line).
I'm going to do a few mods to make exceptions more visible in a few minutes, I'll post back when I can.
There's a new version on github, the only change should be it'll make exceptions within the command handler much more visible. I havent tested it, but its a pretty minor change, I wouldnt expect any more breakage.
emha
November 1, 2012, 2:10pm
120
There's a new version on github, the only change should be it'll make exceptions within the command handler much more visible. I havent tested it, but its a pretty minor change, I wouldnt expect any more breakage.
When I start a movie, i get the following exception: (with the new pushed data - before it was perfect)
Traceback (most recent call last):<br />
File "apps/pyplex/pyplex.py", line 209, in <module><br />
func(*args)<br />
File "apps/pyplex/pyplex.py", line 90, in PlayMedia<br />
omx = OMXPlayer(mediapath, args="-o hdmi")<br />
File "/home/pi/apps/pyplex/pyomxplayer.py", line 42, in __init__<br />
video_props = self._VIDEOPROP_REXP.match(self._process.readline()).groups()<br />
AttributeError: 'NoneType' object has no attribute 'groups'
The film runs but the sound freezes. It starts, stops, starts, stops. I think you know what I mean :)