Hallo Forum
ich benutze dieses script zum abspielen meiner mp3.
<?
/*
IP-SYMCON Event Scripting
File : MusicJukebox.ips.php
Trigger : FileStatus
Interval : -
*/
//-- Configuration
$path=„C:/Musik/“; //Keine Backslashes! Slash am Ende!
$instanceid=65238;
$extensions=„mp3“;
//-- Main Code
if($IPS_SENDER==„Variable“ && $IPS_VARIABLE==„FileStatus“) {
if(GetValueString(„FileStatus“)==„COMPLETE“) {
RunNext();
}
} else {
if(GetValueString(„FileStatus“) == „PLAY“) {
DXMedia_Stop($instanceid);
} else {
RunNext();
}
}
//-- Functions
function RunNext() {
global $instanceid;
$oldfile=strrchr(GetValueString(„FileName“), „/“);
echo $oldfile;
if($oldfile=="") {
$newfile=GetFirst();
} else {
$newfile=GetNext($oldfile);
}
echo $newfile;
DXMedia_Open($instanceid, $newfile);
DXMedia_Play($instanceid);
}
function GetFirst() {
global $path, $extensions;
if ($handle = opendir($path)) {
while (false !== ($file = readdir($handle))) {
if ($file != „.“ && $file != „…“) {
$ext = strrchr($file, ‚.‘);
if(!$extensions || strtolower(".".$extensions) == strtolower($ext)) {
return $path.$file;
}
}
}
closedir($handle);
}
}
function GetNext($oldfile) {
global $path, $extensions;
$found=false;
if ($handle = opendir($path)) {
while (false !== ($file = readdir($handle))) {
if ($file != „.“ && $file != „…“) {
$ext = strrchr($file, ‚.‘);
if(!$extensions || strtolower(".".$extensions) == strtolower($ext)) {
if($found) {
return $path.$file;
}
if("/".$file==$oldfile) {
$found=true;
}
}
}
}
closedir($handle);
}
}
?>
es klappt soweit auch alles, nur wenn im ordner alle mp3 abgespielt sind. geht danach nichts mehr. ich kann nicht noch mal den gleichen oder einen neuen ordner abspielen. es kommt folgende fehlermeldung.
<b>Notice</b>: Error opening File: in <b>C:\Programme\IP-SYMCON\scripts.currentscript</b> on line <b>43</b><br />
wenn ich dann manuel den variablen eintrag unter Filename lösche geht alles wieder.
#kann mir da jemand helfen, wäre mir schon wichtig und von php habe nicht viel ahnung.
cu uwe