Revision: 3185
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 13, 2007 21:33 by Adek336
Initial Code
//Removes the path $t from the nth playlist.
function _remove($n,$t)
{
$nazw="/bm".$n.".m3u";
$a=file_get_contents($nazw);
$b=strpos($a,$t);
if ($b === false) {;} else
{
$c=strpos($a,"\n",$b);
$ha=fopen($nazw,"w+");
if ($b>0)
fwrite($ha,substr($a,0,$b));
fwrite($ha, substr($a,$c+1));
fclose($ha);
}
}
if ($argc!=2) die ("usage: ".$argv[0]." [0,1,2]\n");
if (!in_array($argv[1], array('0','1','2') ))
die ("usage: ".$argv[0]." [0,1,2]\n");
$n=(integer)$argv[1];
$blokada=fopen("/.bm.lock",'w');
if ($blokada == false)
die("error fopen\n");
if (!flock($blokada,LOCK_EX))
die ("error flock\n");
//get path to currently played track
$a=file_get_contents('/tmp/xmms-info');
$b=substr($a, 6+strpos($a,"File: "));
$b=substr($b,0,strlen($b)-1);
_remove(0,$b);
_remove(1,$b);
_remove(2,$b);
//add path to a file
$nazw="/bm".$n.".m3u";
$plik=fopen($nazw,'a');
fwrite($plik, $b."\n");
fclose($plik);
fclose($blokada);
Initial URL
Initial Description
Gets currently playing song path and saves it to one of 3 playlists. Comes very handy when it's made a shortcut in the wm's panel. Requires infopipe. Reentrant. Usage: /bm [0|1|2]. Creates files /bm.lock, /bm0.m3u, /bm1.m3u, /bm2.m3u. Playlists must end with newline. Does not correctly handle diactritic letters.
Initial Title
Bookmark file playing in xmms
Initial Tags
Initial Language
PHP