\n"; $array_json = json_decode($jsondata,TRUE); //~ $lemouv_title=$array_json["rf_titre_antenne"]["titre"]; //~ $lemouv_artist=$array_json["rf_titre_antenne"]["interprete"]; //~ $lemouv_url=$array_json["rf_titre_antenne"]["image"]; $lemouv_title=$array_json["current"]["emission"]["titre"]; $lemouv_artist=$array_json["current"]["emission"]["lien"]; $lemouv_url=$array_json["current"]["emission"]["visuel"]["small"]; //~ echo "[DEBUG] lemouv_title : [$lemouv_title]
\n"; //~ echo "[DEBUG] lemouv_artist : [$lemouv_artist]
\n"; //~ echo "[DEBUG] lemouv_url : [$lemouv_url]
\n"; if( 0 == strcmp("null",$lemouv_title) ) { $lemouv_title = "An Error Occured"; } if( 0 == strcmp("null",$lemouv_artist) ) { $lemouv_artist = "An Error Occured"; } if( 0 == strcmp("null",$lemouv_url) ) { $lemouv_url = ""; } $metadata[0]=$lemouv_artist; $metadata[1]=$lemouv_title; $metadata[2]=$lemouv_url; return $metadata; } function get_fculture_tags() { $metadata = array(); $epochLocal = time(); $jsondata=file_get_contents("http://www.franceculture.fr/programmes?xmlHttpRequest=1"); $array_json = json_decode($jsondata,TRUE); $i = 0; $fculture_artist="An Error Occured"; $fculture_title="An Error Occured"; $metadata[0]=$fculture_artist; $metadata[1]=$fculture_title; while( isset($array_json[$i]) ) { $time_start=$array_json[$i]["start"]; $time_stop=$array_json[$i]["end"]; if( ( $time_start <= $epochLocal ) && ( $time_stop >= $epochLocal ) ) { if( isset($array_json[$i]["surtitle"])) { $fculture_artist=$array_json[$i]["surtitle"]; } if( isset($array_json[$i]["surtitle"])) { $fculture_title=$array_json[$i]["title"]; } $metadata[0]=$fculture_artist; $metadata[1]=$fculture_title; } $i++; } return $metadata; } function get_finter_tags() { $metadata = array(); $epochts=time(); $epochLocal = $epochts; $modSeconds=$epochts % 3600; $modHours = $epochts / 3600 % 24; $epochts=$epochts - $modHours*3600 - $modSeconds - 7200; $finter_artist="An Error Occured"; $finter_title="An Error Occured"; //$jsondata=file_get_contents("http://www.franceinter.fr/sites/default/files/conducteur/direct_$epochts.json"); $jsondata=false; if( false === $jsondata ) { $metadata[0]=$finter_artist; $metadata[1]=$finter_title; return $metadata; } $array_json = json_decode($jsondata,TRUE); $i = 0; while( isset($array_json[$i]) ) { $time_start=$array_json[$i]["date_debut"]; $time_stop=$array_json[$i]["date_fin"]; if( ( $time_start <= $epochLocal ) && ( $time_stop >= $epochLocal ) ) { $finter_title=$array_json[$i]["titre_diffusion"]; $finter_artist=$array_json[$i]["titre_emission"]; $metadata[0]=$finter_artist; $metadata[1]=$finter_title; } $i++; } return $metadata; } function get_fmusique_tags() { $metadata = array(); /* $epochts=time(); //~ echo "[DEBUG] epochts_org : $epochts
\n"; $modSeconds=$epochts % 3600; $epochts=$epochts + 7*3600 + 3600 - $modSeconds; //~ echo "[DEBUG] epochts : $epochts
\n"; $jsondata=file_get_contents("http://www.francemusique.fr/sites/default/files/lecteur_commun_json/reecoute-$epochts.json"); $array_json = json_decode($jsondata,TRUE); $fmusique_title=$array_json["diffusions"][0]["title_diff"]; $fmusique_artist=$array_json["diffusions"][0]["title_emission"]; */ $fmusique_artist = "An Error Occured"; $fmusique_title = "An Error Occured"; $metadata[0]=$fmusique_artist; $metadata[1]=$fmusique_title; return $metadata; } function get_classic21_tags() { $currDate = time(); $fake_json_data=file_get_contents("http://np.maradio.be/qp/v3/events?rpId=2&serviceNameSize=200&nameSize=200&artistNameSize=200&descriptionSize=200&callback=radioplayer.playing.receive&_=".$currDate ); $pos_start = strlen("radioplayer.playing.receive("); $pos_end = strlen( $fake_json_data ) - 1; $jsondata = substr($fake_json_data, $pos_start, $pos_end - $pos_start ); $array_json = json_decode($jsondata,TRUE); $classic21_artist = "An Error Occured"; $classic21_title = "An Error Occured"; $classic21_url = ""; if( isset($array_json["results"]["now"]["name"]) ) { $classic21_title=$array_json["results"]["now"]["name"]; } if( isset($array_json["results"]["now"]["artistName"]) ) { $classic21_artist=$array_json["results"]["now"]["artistName"]; } $classic21_url=$array_json["results"]["now"]["imageUrl"]; $metadata[0]=$classic21_artist; $metadata[1]=$classic21_title; $metadata[2]=$classic21_url; return $metadata; } function get_lgr_rock_url() { $SEARCHSUB='\n"; } //url $SEARCHSUB='\n"; echo "[DEBUG] artist : $tags[0]
\n"; echo "[DEBUG] title : $tags[1]
\n"; echo "[DEBUG] url : $tags[2]
\n"; echo "
\n"; $tags = get_lemouv_tags(); echo "[DEBUG] lemouv
\n"; echo "[DEBUG] artist : $tags[0]
\n"; echo "[DEBUG] title : $tags[1]
\n"; echo "[DEBUG] url : $tags[2]
\n"; echo "
\n"; $tags = get_fculture_tags(); echo "[DEBUG] fculture
\n"; echo "[DEBUG] artist : $tags[0]
\n"; echo "[DEBUG] title : $tags[1]
\n"; echo "
\n"; $tags = get_finter_tags(); echo "[DEBUG] finter
\n"; echo "[DEBUG] artist : $tags[0]
\n"; echo "[DEBUG] title : $tags[1]
\n"; echo "
\n"; $tags = get_fmusique_tags(); echo "[DEBUG] fmusique
\n"; echo "[DEBUG] artist : $tags[0]
\n"; echo "[DEBUG] title : $tags[1]
\n"; echo "
\n"; $tags = get_classic21_tags(); echo "[DEBUG] classic21
\n"; echo "[DEBUG] artist : $tags[0]
\n"; echo "[DEBUG] title : $tags[1]
\n"; echo "
\n"; $url = get_lgr_rock_url(); echo "[DEBUG] lgrrock : $url
\n"; echo "
\n"; $url = get_lgr_metal_url(); echo "[DEBUG] lgrmetal : $url
\n"; echo "
\n"; $url = get_lgr_reggae_url(); echo "[DEBUG] lgrreggae : $url
\n"; echo "
\n"; $tags = get_radio_nova_tags(); echo "[DEBUG] radio_nova
\n"; echo "[DEBUG] artist : $tags[0]
\n"; echo "[DEBUG] title : $tags[1]
\n"; echo "[DEBUG] url : $tags[2]
\n"; echo time(); } ?>