Sign up here and you can log into the forum!

web remote

Feature requests / enhancements discussion regarding the web interface

web remote   

Postby besir660 » Sat Apr 27, 2013 3:34 am

Hi All,
First time I am posting here, I know there has been discussions on this subject, but I was trying to browse&play my music without the need to have the TV switched on. Finally I decided to make sth on my own, using parts of WebEndJukeBox but much more basic. I made this rough interface, nothing fancy. I have a few questions if anyone can help, and I am including my files if anyone wants to use it. I don't really know how to make an app.bin or make it persistent through boots. So what i do is, I mount my Music (shared wiht samba from an ubuntu computer), and also another folder which contains the remote files using net.mounts. so each time i reboot, i create a directory under /var/www/tmp named remote, and copy files under this from the mounted folder. Not superefficient. Questions if anybody can help:

1) most important: how should i go about selecting a folder and playing all the media in it. currently i am stuck with playing songs one by one
2) is there an easy way to make this interface persistent through boot without too much hassle?

any response appreciated.

i am copying what i did (you can put your own icon files as i cant attach them here), you can use it directly as suggested above, and make sure you call the index.php with proper arg, e.g. index.php?dir=/path/to/your/mount. There are 3 files: index.php, play.php, and button.php

index.php:
Code: Select all
<?php
$path = $_GET["dir"];
if ($handle = opendir($path)) {
   while (false !== ($file = readdir($handle)))
   {
    $filepath = $path == '.' ? $file : $path . '/' . $file;
    if (is_dir($filepath))
     echo "<a href=./index.php?dir=".rawurlencode($filepath).">".$file."</a><br>";
    if (is_file($filepath))
     echo "<a href=./play.php?action=1&uri=".rawurlencode($filepath).">".$file."</a><br>";
   }
  closedir($handle);
  }
?>


play.php:
Code: Select all
<?php

    $playMedia = $_GET["uri"];
    $action = $_GET["action"];
    if ($action == 1)
    {
     error_log($playMedia);
     $metadata = shell_exec("upnp-meta '" . $playMedia . "'");
     $out = shell_exec("sudo upnp-cmd SetAVTransportURI 'file://" . $playMedia . "' '" . $metadata . "'");
     shell_exec("sudo upnp-cmd Play");
    }
    echo "<a href='./index.php?dir=/tmp/media/usb/Music'>"."<img src='./home.png'>". "</a>";
    echo "<a href='javascript:history.go(-1)'>"."<img src='./back.jpg'>". "</a><br>";
    echo "NOW PLAYING:" .$playMedia ."<br>";
    $vol = explode("=>",shell_exec("sudo upnp-cmd GetVolume"));
    echo "VOLUME:".$vol[1]."<br>";
    echo "<a href='./button.php?type=volume&cmd=down&uri=".rawurlencode($playMedia)."'>".'<img src="./minus.jpg">'. "</a>";
    echo "<a href='./button.php?type=volume&cmd=up&uri=".rawurlencode($playMedia)."'>".'<img src="./plus.jpg">'. "</a>";
?>


button.php:
Code: Select all
<?php
$type = $_GET["type"];
$cmd = $_GET["cmd"];
$uri = $_GET["uri"];
$url = "./play.php?action=0&uri=".rawurlencode($uri);
header("Location: " . $url);

if ($type == "volume")
{
  $volume = shell_exec("sudo upnp-cmd GetVolume");
  $vol = explode( "=>",$volume);
  if ($cmd == "up")
  {
   $str = "sudo upnp-cmd SetVolume ".($vol[1]+10);
   shell_exec($str);
  }
  else if ($cmd == "down")
  {
   $str = "sudo upnp-cmd SetVolume ".($vol[1]-10);
   shell_exec($str);
  }
}
?>
besir660
n00b
 
Posts: 2
Joined: Sat Apr 27, 2013 3:09 am

Re: web remote   

Postby mad_ady » Mon Apr 29, 2013 10:18 pm

Some basic answers:
1. You will need to add the necessary code to scan a specific folder (maybe recursivelly) and generate a list of files to play. This can be done with find or maybe with php built-in functions. The you loop over that list (you can randomize it if you want) and call the play code for each file.
2. You can easily create an app-bin by following the instructions here: http://wiki.wdlxtv.com/Creating_an_app_bin but you should do it when the app is finished.
User avatar
mad_ady
Developer
 
Posts: 4522
Joined: Fri Nov 05, 2010 9:08 am
Location: Bucharest, Romania

Re: web remote   

Postby besir660 » Tue Apr 30, 2013 11:34 am

thanks mad_ady, yes i realize that. i should be able to generate a list like you suggested and store it in an array, but my main question is how to i make the wdtv play it as a list using upnp commands (or any other way?)
besir660
n00b
 
Posts: 2
Joined: Sat Apr 27, 2013 3:09 am

Re: web remote   

Postby recliq » Tue Apr 30, 2013 1:40 pm

I think it's not that easy... you can only play single files via uPnP AIAK, so you have to "monitor" the playback status (you can get this info via upnp as well) and start a new file when the preceding finishes.
­WDLXTV Project Maintainer
-:] If you like my contributions feel free to donate for a beer or a new flash drive. ...and always remember: RTFM! (README, FAQ, WIKI) [:-
User avatar
recliq
WDLXTV Team
 
Posts: 5513
Joined: Thu Apr 15, 2010 8:09 am
Location: Kiel, Germany

Re: web remote   

Postby KAD » Fri May 31, 2013 7:55 am

what you want is basically all ready done

FileLoop.app.bin
http://forum.wdlxtv.com/viewtopic.php?f=40&t=6942

it's extremely basic
but completely controlled from webend and WEC
play back a directory of files
randomize playback if needed

done in bash using find cmd
If you like my work please consider a Donation. Donate
Please read the appropriate documentation before posting questions! READ ME FAQ WIKI
PM's are for private matters. Post support questions to the appropriate forum, or they will be ignored.
User avatar
KAD
Global Moderator
 
Posts: 5103
Joined: Mon Apr 12, 2010 4:59 pm
Location: Seattle, WA USA

Re: web remote   

Postby Perez Turner » Wed Jul 10, 2013 8:26 pm

I am also getting good response from WebEndJukeBox. Till now, I have no complaint from WebEndJukeBox. I am satisfied and enjoying the service a lot.
Perez Turner
n00b
 
Posts: 8
Joined: Mon Jul 08, 2013 10:17 pm


Return to Webend Web Interface

Who is online

Users browsing this forum: No registered users and 2 guests