// --force if (strtolower($argv[$x]) == '--force') { $crontasks = makeCorrectFile(FROXLOR_INSTALL_DIR . '/scripts/jobs/cron_tasks.php'); // really force re-generating of config-files by // inserting task 1 inserttask('1'); // bind (if enabled, inserttask() checks this) inserttask('4'); // also regenerate cron.d-file inserttask('99'); addToQueue($jobs_to_run, $crontasks); $lastrun_update['tasks'] = $crontasks; } elseif (substr(strtolower($argv[$x]), 0, 2) == '--') { if (strlen($argv[$x]) > 3) { $cronfile = makeCorrectFile(FROXLOR_INSTALL_DIR . '/scripts/jobs/cron_' . substr(strtolower($argv[$x]), 2) . '.php'); addToQueue($jobs_to_run, $cronfile); $lastrun_update[substr(strtolower($argv[$x]), 2)] = $cronfile; } } } } // do we have anything to include? if (count($jobs_to_run) > 0) { // include all jobs we want to execute foreach ($jobs_to_run as $cron) { updateLastRunOfCron($lastrun_update, $cron); require_once $cron; } } fwrite($debugHandler, 'Cronfiles have been included' . "\n"); /**
// --force if (strtolower($argv[$x]) == '--force') { // really force re-generating of config-files by // inserting task 1 inserttask('1'); // bind (if enabled, inserttask() checks this) inserttask('4'); // also regenerate cron.d-file inserttask('99'); addToQueue($jobs_to_run, 'tasks'); } elseif (strtolower($argv[$x]) == '--debug') { define('CRON_DEBUG_FLAG', 1); } elseif (substr(strtolower($argv[$x]), 0, 2) == '--') { if (strlen($argv[$x]) > 3) { $cronname = substr(strtolower($argv[$x]), 2); addToQueue($jobs_to_run, $cronname); } } } } $cronlog->setCronDebugFlag(defined('CRON_DEBUG_FLAG')); // do we have anything to include? if (count($jobs_to_run) > 0) { // include all jobs we want to execute foreach ($jobs_to_run as $cron) { updateLastRunOfCron($cron); $cronfile = getCronFile($cron); require_once $cronfile; } } fwrite($debugHandler, 'Cronfiles have been included' . "\n");
case 'addplay': if ($activePlayer === 'MPD') { if (isset($_POST['path'])) { $status = _parseStatusResponse(MpdStatus($mpd)); $pos = $status['playlistlength']; addToQueue($mpd, $_POST['path'], 1, $pos); // send MPD response to UI ui_mpd_response($mpd, array('title' => 'Added to queue', 'text' => $_POST['path'])); } } break; case 'addreplaceplay': if ($activePlayer === 'MPD') { if (isset($_POST['path'])) { sendMpdCommand($mpd, 'clear'); addToQueue($mpd, $_POST['path']); sendMpdCommand($mpd, 'play'); // send MPD response to UI ui_mpd_response($mpd, array('title' => 'Queue cleared<br> Added to queue', 'text' => $_POST['path'])); } } break; case 'update': if ($activePlayer === 'MPD') { if (isset($_POST['path'])) { sendMpdCommand($mpd, "update \"" . html_entity_decode($_POST['path']) . "\""); // send MPD response to UI ui_mpd_response($mpd, array('title' => 'MPD update DB path:', 'text' => $_POST['path'])); } } break;
<?php require_once 'config.php'; require_once '../lib/config.php'; $session_code = $_POST['session_code']; $track_uri = $_POST['track_uri']; $spotify = MetaTune\MetaTune::getInstance(); $track = $spotify->lookup($track_uri); addToQueue($session_code, $track); function addToQueue($session_code, $track) { global $connection; $query = "INSERT INTO Tracks (session_code,spotify_uri,artist,album,title,image,length) VALUES ('" . strtoupper($session_code) . "','" . mysqli_real_escape_string($connection, $track->getURI()) . "','" . mysqli_real_escape_string($connection, $track->getArtistAsString()) . "','" . mysqli_real_escape_string($connection, $track->getAlbum()) . "','" . mysqli_real_escape_string($connection, $track->getTitle()) . "','" . mysqli_real_escape_string($connection, getImage($track->getURI())) . "'," . (int) $track->getLength() . ")"; mysqli_query($connection, $query); return true; } function getImage($track_uri) { $url = "https://embed.spotify.com/oembed/index.php?url=" . $track_uri . "&format=json"; echo $url; $output = get_content($url); $output = json_decode($output, true); return $output['thumbnail_url']; } function get_content($Url) { if (!function_exists('curl_init')) { die('Sorry cURL is not installed!'); } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $Url);
function rp_addPlay($path, $mpd, $pos) { $song = parseFileStr($path, "/"); $ramplaypath = "ramplay/" . $song; $_SESSION['DEBUG'] .= "rp_addPlay:{$id} {$song} {$path} {$pos}|"; addToQueue($mpd, $ramplaypath); sendMpdCommand($mpd, 'play ' . $pos); }