Exemplo n.º 1
0
/**
 * Returns the current playing track
 * 
 * @author Ross Carlson
 * @version 2/9/05
 * @since 2/9/05
 * @return Returns the name of the current playing track
 */
function getCurTrackName()
{
    global $jbArr;
    $myMpd = _mpdConnection();
    if ($myMpd->current_track_id == -1) {
        return false;
    }
    if (isset($jbArr[$_SESSION['jb_id']]['prefix']) && $jbArr[$_SESSION['jb_id']]['prefix'] == "http") {
        $id = getTrackIdFromURL($myMpd->playlist[$myMpd->current_track_id]['file']);
        if (false !== $id) {
            $track = new jzMediaTrack($id, 'id');
            $meta = $track->getMeta();
            return $meta['artist'] . ' - ' . $meta['title'];
        } else {
            return 'Unknown';
        }
    } else {
        return $myMpd->playlist[$myMpd->current_track_id]['Artist'] . " - " . $myMpd->playlist[$myMpd->current_track_id]['Title'];
    }
}
Exemplo n.º 2
0
/**
 * Returns the current playing track
 * 
 * @author Ben Dodson
 * @version 12/04/08
 * @since 12/04/08
 * @return Returns the name of the current playing track
 */
function getCurTrackName()
{
    $box = Quickbox::load();
    if (sizeof($box['playlist']) > 0 && isset($box['pos'])) {
        $entry = $box['playlist'][$box['pos']];
    }
    if (false !== ($id = getTrackIdFromURL($entry))) {
        $track = new jzMediaTrack($id, 'id');
        $meta = $track->getMeta();
        return $meta['artist'] . ' - ' . $meta['title'];
    } else {
        return word('Unknown');
    }
}
Exemplo n.º 3
0
/**
* Returns the current playing track
* 
* @author Ross Carlson
* @version 2/9/05
* @since 2/9/05
* @return Returns the name of the current playing track
*/
function getCurTrackName()
{
    global $jbArr;
    $xml = getPlaylistXML();
    $res = $xml->xpath("//leaf[@current='current']");
    writeLogData("messages", "VLC: Returning current track name: " . $val);
    if (isset($jbArr[$_SESSION['jb_id']]['prefix']) && $jbArr[$_SESSION['jb_id']]['prefix'] == "http") {
        if (false !== ($id = getTrackIdFromURL($res[0]['name']))) {
            return idToName($id);
        }
    }
    return $res[0]['name'];
}
Exemplo n.º 4
0
/**
 * Returns the currently playing playlist
 * 
 * @author Ross Carlson
 * @version 2/9/05
 * @since 2/9/05
 * @param return Returns the currently playling playlist
 */
function getCurPlaylist()
{
    global $jbArr;
    $val = array();
    if (isset($jbArr[$_SESSION['jb_id']]['prefix']) && $jbArr[$_SESSION['jb_id']]['prefix'] == "http") {
        $arr = httpqRequest('getplaylistfile', array('delim' => ';;;'));
        $arr = explode(';;;', $arr);
        foreach ($arr as $i => $url) {
            if (false != ($id = getTrackIdFromURL($url))) {
                $track = new jzMediaTrack($id, 'id');
                $meta = $track->getMeta();
                $title = '';
                if (!isNothing($meta['artist'])) {
                    $title .= $meta['artist'];
                }
                if (!isNothing($meta['title'])) {
                    if (!isNothing($title)) {
                        $title .= ' - ';
                    }
                    $title .= $meta['title'];
                }
                if (isNothing($title)) {
                    $title = $track->getName();
                }
                $val[] = $title;
            } else {
                // $val[] = $url; // faster
                $val[] = httpqRequest('getplaylisttitle', array('index' => $i));
                // better
            }
        }
    } else {
        $val = explode(";;;", @file_get_contents("http://" . $jbArr[$_SESSION['jb_id']]['server'] . ":" . $jbArr[$_SESSION['jb_id']]['port'] . "/getplaylisttitle?p=" . $jbArr[$_SESSION['jb_id']]['password'] . "&delim=;;;"));
    }
    writeLogData("messages", "Winamp3: Returning the current playlist");
    return $val;
}