<?php
function bufferScrobble($timecode, $artist, $title) {
session_start();
if (isset($_SESSION['timecode'])) {
echo "coucou";
//Chanson bufferisée
if($timecode == $_SESSION['timecode']) {
//Même chanson, bonne à scrobbler
echo "scrobble ".$_SESSION['timecode']." ".$_SESSION['artist']." ".$_SESSION['title'];
session_destroy();
}
else if(($timecode - $_SESSION['timecode']) < 0) {
//Une chanson revient après ses +30sec mais on est déjà passé à la suivante
break;
}
else if(($timecode - $_SESSION['timecode']) < 30) {
//Chanson bufferisée trop courte, on passe à la nouvelle
$_SESSION['timecode'] == $timecode;
$_SESSION['artist'] == $artist;
$_SESSION['title'] == $title;
session_write_close();
sleep(30);
bufferScrobble($timecode, $artist, $title);
}
else {
//Chanson bufferisée suffisamment longue, on la scrobble et on bufferise la nouvelle
echo "scrobble ".$_SESSION['timecode']." ".$_SESSION['artist']." ".$_SESSION['title'];
$timecode == $_SESSION['timecode'];
$artist == $_SESSION['artist'];
$title == $_SESSION['title'];
session_write_close();
sleep(30);
bufferScrobble($timecode, $artist, $title);
}
}
else {
$_SESSION['timecode'] == $timecode;
$_SESSION['artist'] == $artist;
$_SESSION['title'] == $title;
session_write_close();
sleep(30);
bufferScrobble($timecode, $artist, $title);
}
}
?>
- Output for 7.0.0 - 7.0.1
- Fatal error: 'break' not in the 'loop' or 'switch' context in /in/jtdoe on line 15
Process exited with code 255. - Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.21
preferences:
172.25 ms | 1395 KiB | 35 Q