-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added the necesseray file to fetch "now on the radio" datas
- Loading branch information
Nico
committed
Nov 5, 2022
1 parent
ae0966f
commit ebfe958
Showing
1 changed file
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
error_reporting(0); | ||
header( 'Content-Type: text/plain; charset=utf-8'); | ||
|
||
//returns a series of useful data about radio current playing track | ||
//first line is for the expire timestamp | ||
//second line is for the startime of the currenly playing track | ||
//third line if the duration of it | ||
//fourth line is the entitified arist name | ||
//fifth line is the entitified track tile | ||
|
||
//let's setup some default value | ||
$expire=microtime(true); | ||
$starttime=0; | ||
$nowplayingduration=0; | ||
//the following will be used only if the preceding show an expired track | ||
$nowplayingartist=''; | ||
$nowplayingtitle=''; | ||
|
||
function fillme ($target_file){ | ||
if (file_exists($target_file)&&file_get_contents($target_file)!==false){ | ||
return file_get_contents($target_file); | ||
} | ||
else { | ||
return false; | ||
} | ||
} | ||
|
||
if (fillme ('./radio/d/expire.txt')!==false){ | ||
$expire=fillme('./radio/d/expire.txt'); | ||
} | ||
if (fillme ('./radio/d/starttime.txt')!==false){ | ||
$starttime=fillme('./radio/d/starttime.txt'); | ||
} | ||
if (fillme ('./radio/d/nowplayingduration.txt')!==false){ | ||
$nowplayingduration=fillme('./radio/d/nowplayingduration.txt'); | ||
} | ||
if (fillme ('./radio/d/nowplayingartist.txt')!==false){ | ||
$nowplayingartist=fillme('./radio/d/nowplayingartist.txt'); | ||
} | ||
if (fillme ('./radio/d/nowplayingtitle.txt')!==false){ | ||
$nowplayingtitle=fillme('./radio/d/nowplayingtitle.txt'); | ||
} | ||
echo $expire; | ||
echo "\n"; | ||
echo $starttime; | ||
echo "\n"; | ||
echo $nowplayingduration; | ||
echo "\n"; | ||
echo $nowplayingartist; | ||
echo "\n"; | ||
echo $nowplayingtitle; | ||
echo "\n"; | ||
echo microtime(true);//server time | ||
?> |