// } // recupero id nextsong e metto in sessione $_SESSION['nextsongid'] = $status['nextsongid']; } // register player STATE in SESSION $_SESSION['state'] = $status['state']; // Unlock SESSION file session_write_close(); // ----- check and compare GUI state with Backend state ---- // // idle LOOP if ($_GET['state'] == $status['state']) { $status = monitorMpdState($mpd); } // idle LOOP // ----- check and compare GUI state with Backend state ---- // $curTrack = getTrackInfo($mpd, $status['song']); if (isset($curTrack[0]['Title'])) { $status['currentartist'] = $curTrack[0]['Artist']; $status['currentsong'] = $curTrack[0]['Title']; $status['currentalbum'] = $curTrack[0]['Album']; $status['fileext'] = parseFileStr($curTrack[0]['file'], '.'); } else { $path = parseFileStr($curTrack[0]['file'], '/'); $status['fileext'] = parseFileStr($curTrack[0]['file'], '.'); $status['currentartist'] = ""; $status['currentsong'] = $song; $status['currentalbum'] = "path: " . $path; } // CMediaFix if (isset($_SESSION['cmediafix']) && $_SESSION['cmediafix'] == 1 && $status['state'] == 'play') { $status['lastbitdepth'] = $_SESSION['lastbitdepth'];
function ui_status($mpd, $status) { $curTrack = getTrackInfo($mpd, $status['song']); if (isset($curTrack[0]['Title'])) { $status['currentartist'] = $curTrack[0]['Artist']; $status['currentsong'] = htmlentities($curTrack[0]['Title'], ENT_XML1, 'UTF-8'); $status['currentalbum'] = $curTrack[0]['Album']; $status['fileext'] = parseFileStr($curTrack[0]['file'], '.'); } else { $path = parseFileStr($curTrack[0]['file'], '/'); $status['fileext'] = parseFileStr($curTrack[0]['file'], '.'); $status['currentartist'] = ""; // $status['currentsong'] = $song; if (!empty($path)) { $status['currentalbum'] = $path; } else { $status['currentalbum'] = ''; } } $status['radioname'] = $curTrack[0]['Name']; return $status; }
function getInfo($stream) { if (!$stream['info']['song']) { $stream['info']['song'] == 'Not found'; return $stream; } if (GET_TRACK_INFO == TRUE) { $stream = getTrackInfo($stream); } if (GET_ALBUM_INFO && isset($stream['album']['title'])) { $stream = getAlbumInfo($stream); } if (GET_ARTIST_INFO == TRUE) { $stream = getArtistInfo($stream); } if (GET_TRACK_BUY_LINK == TRUE) { $stream = getTrackBuyLink($stream); } if (CACHE_ALBUM_ART == TRUE) { $stream['album']['local_image'] = cacheAlbumArt($stream['album']['image_l']); } if (GET_LYRICS == TRUE) { $stream['track']['lyric'] = getLyric($stream['info']['artist'], $stream['info']['song']); } $stream['fetch_time'] = time(); return $stream; }
insertImageUrl($dbHandle, $trackList->image, $imageLength, 0, $albumId, $ALBUM_ARTWORK_FLAG, array(0 => $ARTIST_ARTWORK_FLAG, 1 => $ALBUM_ARTWORK_FLAG), $MAX_IMAGE_COUNT); saveBio($albumId . "-album_bio.txt", $trackList->wiki->content, $fp, $DATABASE_SCRIPT_DIR, $DS_ALBUM_REVIEW_DIR, $DS_LOGS_DIR); $sql[0] = "UPDATE album_list SET `review_file`='" . $albumId . "-album_bio.txt' WHERE artist_id='" . $artistId . "' AND `album_title`='" . addslashes($albumInfo['name']) . "'"; $sql[1] = "SELECT * FROM album_list WHERE artist_id='" . $artistId . "' AND `album_title`='" . addslashes($albumInfo['name']) . "'"; if (!updateQuery($dbHandle, $sql)) { fprintf($fp, "Unable to update released information\n"); fclose($fp); echo "Failed <a href=\"javascript:window.open('" . $DATABASE_SCRIPT_DIR . $DS_LOGS_DIR . $logFile . "');\">view log</a> or <a href=\"javascript:resetForm();\">add another</a>"; exit; } for ($l = 0; $l < $trackLength; $l++) { $trackAddedTime = mt_rand($albumAddedTime, time(null)); if ($trackLength == 1) { $trackInfo = getTrackInfo($trackList->tracks->track); } else { $trackInfo = getTrackInfo($trackList->tracks->track[$l]); } if (trackExist($dbHandle, $albumId, addslashes($trackInfo['name']), $trackInfo['duration'])) { fprintf($fp, "DUP track, skipping track\n"); $warning++; } else { $sql[0] = "INSERT INTO track_list (album_id, track_name, duration, time_added) VALUES ('" . $albumId . "', '" . addslashes($trackInfo['name']) . "', '" . $trackInfo['duration'] . "', '" . getRandom() . "')"; $sql[1] = "SELECT * FROM track_list WHERE album_id='" . $albumId . "' AND `track_name`='" . addslashes($trackInfo['name']) . "' AND duration='" . $trackInfo['duration'] . "'"; if (!insertQuery($dbHandle, $sql)) { fprintf($fp, "Unable to insert track into database\n"); fclose($fp); echo "Failed <a href=\"javascript:window.open('" . $DATABASE_SCRIPT_DIR . $DS_LOGS_DIR . $logFile . "');\">view log</a>"; exit; } if (!trackExist($dbHandle, $albumId, addslashes($trackInfo['name']), $trackInfo['duration'])) { fprintf($fp, "Unable to get track from database\n");