summaryrefslogtreecommitdiffstats
path: root/play/index.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2005-07-13 05:34:08 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2005-07-13 05:34:08 +0000
commit817cac65b78c7676f717dc090d55e28dba6558ad (patch)
treeb6d83a6c7d13c233f70387c9774afec25eb0abf2 /play/index.php
parent645b677b57a1046afc7f146e271ca74eca52f8fb (diff)
downloadampache-817cac65b78c7676f717dc090d55e28dba6558ad.tar.gz
ampache-817cac65b78c7676f717dc090d55e28dba6558ad.tar.bz2
ampache-817cac65b78c7676f717dc090d55e28dba6558ad.zip
fixed up the now playing to account for the stupidity that is WMP10
Diffstat (limited to 'play/index.php')
-rw-r--r--play/index.php25
1 files changed, 7 insertions, 18 deletions
diff --git a/play/index.php b/play/index.php
index c3870e4f..874de187 100644
--- a/play/index.php
+++ b/play/index.php
@@ -146,11 +146,8 @@ else {
// Update the users last seen
$user->update_last_seen();
- // Garbage collection for stale entries in the now_playing table
- $time = time();
- $expire = $time - 900; // 86400 seconds = 1 day
- $sql = "DELETE FROM now_playing WHERE start_time < $expire";
- $db_result = mysql_query($sql, $dbh);
+ /* Run Garbage Collection on Now Playing */
+ gc_now_playing();
// If we are running in Legalize mode, don't play songs already playing
if (conf('lock_songs') == 'true') {
@@ -166,11 +163,7 @@ else {
}
// Put this song in the now_playing table
- $end_time = time() - $song->time;
- $sql = "INSERT INTO now_playing (`song_id`, `user`, `start_time`)" .
- " VALUES ('$song_id', '$uid', '$end_time')";
- $db_result = mysql_query($sql, $dbh);
- $lastid = mysql_insert_id($dbh);
+ $lastid = insert_now_playing($song->id,$uid,$song->time);
// make fread binary safe
set_magic_quotes_runtime(0);
@@ -282,15 +275,11 @@ else {
$user->update_stats($song_id);
}
- // If the played flag isn't set, set it
- if (!$song->played) {
- $sql = "UPDATE song SET played='1' WHERE id='$song->id'";
- $db_results = mysql_query($sql, $dbh);
- }
+ /* Set the Song as Played if it isn't already */
+ $song->update_played();
- // Remove the song from the now_playing table
- $sql = "DELETE FROM now_playing WHERE id = '$lastid'";
- $db_result = mysql_query($sql, $dbh);
+ /* Delete the Now Playing Entry */
+ delete_now_playing($lastid);
/* Clean up any open ends */
if ($ds) {