[19. June 2013] Soundcloud® available now | [7. June 2013] Youporn available now | [11 Jan. 2013] Customize your A-400 Home Screen

Firmware: A-400 [13 May 2013] | C-300 [30 Nov. 2012] | A-300 [30 Nov. 2012] | C-200 RC1 [13 June 2013] | A-200/A-210 RC1 [13 June 2013]

Just got your NMT | WIKI has the answers | Search the forum | Forum Rules/Policy | Firmware & Official NMT News | Popcornhour manuals



User(s) browsing this thread:
Thread Closed 
controlling popcorn from windows
11-30-2008, 11:51 AM (This post was last modified: 12-03-2008 01:00 AM by Frater.)
Post: #1
controlling popcorn from windows
Yay, I finally made my popcorn do what I want: play movies when i point at them on my windows box. Angle

Thanks to all of you who have helped out with pointers, you make my day. Smile

My setup:
Hardware
PCH A-100 with laptop drive and a silent fan mod.
Server 2003 box hosting all my files and also doing work as media center for playing low def stuff with VLC & MPC.
Projector (panasonic PT-AE3000)
Receiever (Marantz SR7500)
ATI Remote Wonder wireless remote control

Software
Working telnet on the popcorn. (http://www.sendspace.com/file/oj3yb5 works fine if you have an internal harddrive)
EventGhost free event triggered automation software.
Lundmands excellent llink
Netcat
batch files...

The proj is connected to both media server and popcorn, switching source is done via remote commands over the handy serial port, same goes for the reciever.
All control events goes through EventGhost.

Llink is using my video library as source (big fat DFS directory structure with loads of subcategories sitting on various disk sets)
Using plain old windows explorer I right klick on any given movie and select play with either VLC, MPC or Popcorn.
Play with popcorn launches a batch file witch rudely telnets the popcorn, kills gaya and starts mono with the llink web server and media path as target. At the end of the batch file Eventghost is signalled to switch A/V sources in my home theater whereupon HD cinema ensues.
Pressing stop on the wireless remote terminates mono and switches me back to the server desktop where I can pick a new movie, surf the web (or in this case post happy messages on this forum Wink ).

Below you can see the two bat files who do the dirty deeds to the pch:
(Hehe... No I'm not running for the gold medal in sleek batch programming.)

pchplay.bat
Code:
echo off
set gaga=%1
set gaga=/opt/sybhttpd/localhost.drives/HARD_DISK/bin/nohup mono -single "http://192.168.0.50:8001/%gaga:~15% -dram 1
echo killall gaya > D:\llink\control.txt
echo %gaga:\=/% ^& >> D:\llink\control.txt
echo exit >> D:\llink\control.txt
D:\llink\nc 192.168.0.15 23 < D:\llink\control.txt >nul
"C:\Program Files\EventGhost\eventghost" -e pchplay

pchstop.bat
Code:
echo off
echo echo 212 ^> /tmp/irkey > D:\llink\control.txt
echo exit >> D:\llink\control.txt
D:\llink\nc 192.168.0.15 23 < D:\llink\control.txt >nul
"C:\Program Files\EventGhost\eventghost" -e pchstop

I use NetCat as telnet client since the crappy one coming with windows does not support scripting, be aware that netcat is a monstrous security hole if left accessible for remote excution.

Before running the batchfile we need to create a symlink connecting nohup to busybox26. This will enable us to run mono as a background process, otherwise it would die as soon as the telnet session exits...

(Telnet the popcorn)
cd /opt/sybhttpd/localhost.drives/HARD_DISK/bin/
ln -s busybox26 nohup
ls -l (should show nohup as a link now)

Thats it, no more trudging around in gaya.

Replace paths and IP numbers as needed if you want to give it a spin, I put the batch files in the llink folder for nothing but lazy reasons.
Edit: Oh and the ~15 number in line 3 needs to be changed to whatever is the character count in your llink ROOT path +2 Wink
Find all posts by this user
12-02-2008, 04:46 PM (This post was last modified: 12-02-2008 05:26 PM by wsoderberg.)
Post: #2
RE: controlling popcorn from windows
Nice little guide. I've done everything except installing netcat. Can't find a client to install for Windows Vista. Instead I changed the command to telnet (instead of nc). I've enabled the Vista telnet too. However nothing happens when I play the audio file. I've changed the string to -audio instead of -single like you said.

output in control.txt file:

killall gaya
/opt/sybhttpd/localhost.drives/HARD_DISK/bin/nohup mono -audio "http://192.168.1.65:8001/am/Music/Techno/Top 100 Trance and Techno Party Songs of All Time.2008.www.lokotorrents.com/Banana Inc. - Club Kink.www.lokotorrents.com.mp3" -dram 1 &
exit

Edit: Also, I totally fail to see where the pchstop.bat script jumps in. 0.o
Edit2: I'm trying to launch the audio files with Rightclicking and choosing "Open with: pchplay.bat".
Edit3: I downloaded nc.exe (google) and put it in system32 dir. Now NetCat works. The script still doesn't work though.
Find all posts by this user
12-03-2008, 12:46 AM (This post was last modified: 12-03-2008 01:05 AM by Frater.)
Post: #3
RE: controlling popcorn from windows
Ok, I have found two problems that need to be adressed with my guide in order to enable audio playback.
First: I'm a lazy programmer so I have put static string replacements in the batch file. Wink
Second: Apparently audio playback of single files won't work without the -bgimg tag. (we learn something new every day)

To fix the first problem (string replacement):
In the third line you can see the %gaga:~15% part, the number 15 is the number of characters cut from the beginning of the file path that is sent as a parameter to the batch file when using the Open With function in windows, this number needs to match whatever is your ROOT path in llink +2. Look closely at your own control.txt file and you will see [8001/am/Music] indicating that your file path has been wrongly truncated, that folder is not named "am" is it? Twiddle that ~number until you have the correct path in the control file.

(to fully understand what is going on in the character replacement parts of the batch file i suggest a trip To Rob Van Der Woude's absolutely essential online docs on batch scripting, it's a goldmine)

The second problem is easier:
The correct mono launch parameters for single audio files are "mono -audio -bgimg -single"

To accomodate both video and audio playback i suggest putting these changes into a new batch file with a different name.

I included the pchstop batch file in order to show a complete solution, I run this script from eventghost triggered with a buttonpress on my remote. It can certainly be triggered in any number of ways of your choosing.


Ps
A nice way of checking how the popcorn launches media is to start the playback, telnet into popcorn and tell it "ps -w".
This will give you a full process listing including how every process was called. Great for debugging!
Find all posts by this user
12-03-2008, 11:38 PM
Post: #4
RE: controlling popcorn from windows
Thanks for the reply! I'll try it as soon as I reinstalled Windows. I failed completely yesterday and chrashed it for good. Will give you feedback asap. I'm running Linux atm.
Find all posts by this user
12-03-2008, 11:43 PM
Post: #5
RE: controlling popcorn from windows
Have you already tried the UPnP AV approach? It requires no hacking of the PCH.
Find all posts by this user
12-05-2008, 08:46 PM
Post: #6
RE: controlling popcorn from windows
(12-03-2008 11:43 PM)nprnncbl Wrote:  Have you already tried the UPnP AV approach? It requires no hacking of the PCH.

I tried Kinsky with twonky but it would not find the twonky at all, never tried all that hard since kinsky kept crashing for me and the interface was pretty klunky.

The only problem I have now is that my damn PCH keeps stopping in mid movie. sound dies then it refuses to restart movies. This problem crops up even when running vanilla with the gaya interface, so either my pch is packing up or there is a power issue with the added drive and fans...
Find all posts by this user
12-06-2008, 04:12 PM (This post was last modified: 12-06-2008 04:13 PM by lordy.)
Post: #7
RE: controlling popcorn from windows
Hi, just in case you're interested you may be able to replace

$ /opt/sybhttpd/localhost.drives/HARD_DISK/bin/nohup "some command"

with

$ ( cd / ; "some command" < /dev/null > /dev/null 2>&1 & )

Removing dependency on external program.

Oversight: Jukebox | FeedTime: Automatic nzbs
Find all posts by this user
12-09-2008, 10:41 PM (This post was last modified: 12-09-2008 10:42 PM by wsoderberg.)
Post: #8
RE: controlling popcorn from windows
(12-06-2008 04:12 PM)ydrol Wrote:  Hi, just in case you're interested you may be able to replace

$ /opt/sybhttpd/localhost.drives/HARD_DISK/bin/nohup "some command"

with

$ ( cd / ; "some command" < /dev/null > /dev/null 2>&1 & )

Removing dependency on external program.

Phew. This is starting to get troublesome even for me. Can't you just develop a well running software for this? Start an open source project with java or something maybe. Multiplatform. I can imagine normal users having a pain of diving in among this bunch of usermade scripts just to be able to remote control their PCH. Sad

I've reformated now so I'll try to get this running.

I'll get back to you with more questions, I'm sure.

(12-05-2008 08:46 PM)Frater Wrote:  I tried Kinsky with twonky but it would not find the twonky at all, never tried all that hard since kinsky kept crashing for me and the interface was pretty klunky.

The only problem I have now is that my damn PCH keeps stopping in mid movie. sound dies then it refuses to restart movies. This problem crops up even when running vanilla with the gaya interface, so either my pch is packing up or there is a power issue with the added drive and fans...

And Frater. Kinsky, twonky and klunky. Are you making these words up as you write or is the actual applications named like this? Tongue
Find all posts by this user
12-10-2008, 12:54 AM (This post was last modified: 12-10-2008 01:00 AM by Frater.)
Post: #9
RE: controlling popcorn from windows
(12-09-2008 10:41 PM)wsoderberg Wrote:  Phew. This is starting to get troublesome even for me. Can't you just develop a well running software for this? Start an open source project with java or something maybe. Multiplatform. I can imagine normal users having a pain of diving in among this bunch of usermade scripts just to be able to remote control their PCH. Sad

I've reformated now so I'll try to get this running.

Well, if syabas supplied us with a device we could talk with out of the box we wouldnt have this problem to begin with. Still, it is fairly straightforward to get the telnet stuff up and running with the nice installer that the russian guy made (thanks).

What happened with your box, did my instruction mess it up so badly that you had to reinstall?! confused

(12-09-2008 10:41 PM)wsoderberg Wrote:  And Frater. Kinsky, twonky and klunky. Are you making these words up as you write or is the actual applications named like this? Tongue

Heh, I do make up words now and then, but in this case they are real McCoys. Wink
Meet Kinsky, Twonky and klunky[sic]
Find all posts by this user
12-10-2008, 01:07 PM
Post: #10
RE: controlling popcorn from windows
(12-05-2008 08:46 PM)Frater Wrote:  I tried Kinsky with twonky but it would not find the twonky at all, never tried all that hard since kinsky kept crashing for me and the interface was pretty klunky.

I tried Kinsky, too, but also found it clunky, and didn't quite get it working-- Cidero works better for me. I haven't tried Twonky, but between ushare, gmediaserver, fuppes, and mediatomb, ushare is the one I managed to get working, with some modifications to support flac.

But it seems that ultimately UPnP isn't all that it could be on the PCH.
Find all posts by this user
12-10-2008, 08:55 PM (This post was last modified: 12-10-2008 10:42 PM by wsoderberg.)
Post: #11
RE: controlling popcorn from windows
Naaah. It wasen't your fault I had to reformat. It wasen't even my PCH that needed reformating. I was playing around with newSID on my Vista installation and I completely messed up my one and only admin account.

Anywho, I actually managed to start playback from my computer to the PCH with your help! Heart
Thing is, it failed the second time. The second time was from a subdirectory.
Do you want me to run ps -w and give you the output?

Also, the PCH stops responding to any commands issued by the remote control when the chosen file doesn't launch. Not good that I have to pull the power cord everytime it fails. pchstop.bat doesn't work to set it right.

Edit: Yeah, it works like a charm when I'm launching the file from the root llink category! However if we start venturing into subfolders the script fails and I have to pull the pwr cord in order to start using the PCH again.

This is how my file looks like:

echo off
set gaga=%1
set gaga=/opt/sybhttpd/localhost.drives/HARD_DISK/bin/nohup mono -audio -bgimg -single "http://192.168.1.65:8001/%gaga:~23% -dram 1
echo killall gaya > C:\llink\control.txt
echo %gaga:\=/% ^& >> C:\llink\control.txt
echo exit >> C:\llink\control.txt
C:\llink\nc 192.168.1.69 23 < C:\llink\control.txt >nul
"C:\Program Files\EventGhost\eventghost" -e pchplay

Edit 2: Ok. Now I've used the script for some 30min and the problems I'm having is that at some point the playback fails and the PCH locks up. Forcing me to pull the power cord in order to get it working again. I would also think that a script that successfully plays a playlist (a playlist with the files on your computer) would be awesome. I hope we can further develop this to get it running smoothly. =)
Thank you for the help so far Frater!

Edit 3: When the script finally fails; I started a ftp transfer between the computer and the PCH. The transfer was much slower than usual. I was experiencing 2mb/s. It's usually atleast 6.5mb/s over ftp. I've tried using the script and ftp at the same time and it's working as usual then. The speed only drops significantly when the script fails.
Find all posts by this user
12-11-2008, 12:31 AM
Post: #12
RE: controlling popcorn from windows
(12-10-2008 08:55 PM)wsoderberg Wrote:  Naaah. It wasen't your fault I had to reformat. It wasen't even my PCH that needed reformating. I was playing around with newSID on my Vista installation and I completely messed up my one and only admin account.
Epic fail. Wink

(12-10-2008 08:55 PM)wsoderberg Wrote:  Thing is, it failed the second time. The second time was from a subdirectory.
Do you want me to run ps -w and give you the output?

Yes please do. both a copy of the control.txt and the relevant (last)part of ps -w.
check for differences in the mono line between the two outputs.
Be aware that paths or file names with extended characters like "&" will break the script.

One thing to note is that the output on ps -w only shows the first 106 characters of the calling string if it is too long. The player still runs fine, just that the process manager runs out of space in the name field or whatnot.
Any linux junkie feels up to explaining that?

(12-10-2008 08:55 PM)wsoderberg Wrote:  Also, the PCH stops responding to any commands issued by the remote control when the chosen file doesn't launch. Not good that I have to pull the power cord everytime it fails. pchstop.bat doesn't work to set it right.

Well gaya is allready killed and mono probably never started properly, so noone is listening to the remote.
Telnetting the following message to the PCH should start gaya again, thanks Ydrol Wink
( cd / ; gaya < /dev/null > /dev/null 2>&1 & )

Your batch file looks fine from what I can see...
The last line with eventghost is not needed, unless you run eventghost for controlling audio source on your receiver Wink

(12-10-2008 08:55 PM)wsoderberg Wrote:  Edit 2: Ok. Now I've used the script for some 30min and the problems I'm having is that at some point the playback fails and the PCH locks up. Forcing me to pull the power cord in order to get it working again. I would also think that a script that successfully plays a playlist (a playlist with the files on your computer) would be awesome. I hope we can further develop this to get it running smoothly. =)
Thank you for the help so far Frater!.

Edit 3: When the script finally fails; I started a ftp transfer between the computer and the PCH. The transfer was much slower than usual. I was experiencing 2mb/s. It's usually atleast 6.5mb/s over ftp. I've tried using the script and ftp at the same time and it's working as usual then. The speed only drops significantly when the script fails.

This sounds like the random lockups I have been experiencing when playing movies this way, interesting with the FTP bit...
Could it be that the PCH runs into a memory leak issue causing it to run out of available resources? Any clever developers out there who have seen this or know where we should start looking?

Mono supports playlists but I have not tried it out yet.
This thread has some juicy stuff going about creating playlists.
Find all posts by this user
12-11-2008, 02:34 PM (This post was last modified: 12-11-2008 03:10 PM by wsoderberg.)
Post: #13
RE: controlling popcorn from windows
Thanks for the wonderful feedback!

I've no longer got a problem with subdirectories, it's running smoothly now. Don't really know what solved it. All I did was remove the eventghost line as you said. Don't think eventghost was the thief though. The lockup is the only issue I'm experiencing now. I'll look into the playlist feature later on. Big Grin

Edit: Sometimes when I play a file it doesn't work. The thing is, nothing seems to be happening in the PCH when I play it. It just stops responding to the commands??

Control.txt output:

killall gaya
/opt/sybhttpd/localhost.drives/HARD_DISK/bin/nohup mono -audio -bgimg -single "http://192.168.1.65:8001//House of Pain - Jump Around [Cypress Hill remix].mp3" -dram 1 &
exit

ps -w output:
[Image: UraeNAuDH.jpg]

After I've run the:
cd / ; gaya < /dev/null > /dev/null 2>&1 &
command the issue is the same. Although I can control the PCH with the remote now when it locks up, that's good. Tongue

When the PCH didn't listen to the script anymore, I tried to start playback with the remote on the PCH. Got the message: Could not play.
Find all posts by this user
12-11-2008, 04:15 PM
Post: #14
RE: controlling popcorn from windows
(12-11-2008 02:34 PM)wsoderberg Wrote:  After I've run the:
cd / ; gaya < /dev/null > /dev/null 2>&1 &
command the issue is the same. Although I can control the PCH with the remote now when it locks up, that's good. Tongue

When the PCH didn't listen to the script anymore, I tried to start playback with the remote on the PCH. Got the message: Could not play.

Sending the reboot command in a telnet session will restart the PCH by the way, then you wont have to reach for the power cable. Wink

Before I found out about faking the remote with the "echo 212 > /tmp/irkey" command i used the kill command, this always made the next mono player unhappy since there was old crud left over from the earlier player. Could be that once mono has choked on a media file and exited it leaves messy droppings in a similar manner.

Could be that some buffering helps with the music playback, You can try dropping in "-audio -prebuf 100 -bgimg -single" as parameters for Mono.
Find all posts by this user
12-11-2008, 06:45 PM
Post: #15
RE: controlling popcorn from windows
Buffering did not help. Sad

Reboot command via telnet helps alot tho. Feels alot safer then plugging the power cable...
Find all posts by this user
Thread Closed 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  HOWTO: Windows 7 ext2/3 support - update? Minok 6 9,998 12-25-2011 09:37 PM
Last Post: newmediawhisperer
Wink Windows 7 fixes for SMB network problems Casuall 25 42,139 08-03-2011 03:24 AM
Last Post: fuhoser
  [HOW TO] Rip a Blu-ray to MKV for PopCorn Hour NMT 200 Series Everbefore 4 5,860 07-15-2011 12:06 PM
Last Post: chris57
  How to have "Search in IMDB" in your right click context menu in Windows CyberClaw 7 7,876 05-25-2011 05:30 PM
Last Post: iGimp
  How To: NFS using Microsoft Windows Services for UNIX chris57 113 174,404 02-19-2011 09:00 PM
Last Post: dbone1026
  HOWTO: Mount NMT share on Windows Mobile mkkm 0 2,768 12-25-2010 02:53 PM
Last Post: mkkm
  HOWTO: Windows 7 ext2/3 support [USB-Slave] DeliriumNL 35 198,908 02-21-2010 12:57 AM
Last Post: maxyvan98
  [Video Tutorial] How to map network drive in Windows Vista AlexNC 30 34,386 02-06-2010 06:41 AM
Last Post: jamesroy
  Setup Windows 2008 NFS for Streaming with A-100 - Guide nkarnold 16 30,712 12-21-2009 09:02 AM
Last Post: chris57

Forum Jump: