Beispiel #1
0
function stream_track($track_slug)
{
    if (empty($track_slug)) {
        return new WP_Error('no-release-to-stream', __("You didn't specify a track to stream."));
    }
    $track = get_track_by_slug($track_slug);
    if (is_wp_error($release)) {
        return $track;
    }
    print_r($track);
}
Beispiel #2
0
/**
 * Outputs an individual track for the user to download.
 *
 * @author Alex Andrews <*****@*****.**>
 * @param string $track_slug The slug of the track that is to be downloaded.
 * @param string $format The format of the release to download, flac|mp3|ogg
 * @return void
 */
function download_track($track_slug, $format)
{
    global $track;
    if (empty($track_slug)) {
        return new WP_Error('ribcage-no-track-to-download', __("You didn't specify a track to grab."));
    }
    $track = get_track_by_slug($track_slug);
    if (is_wp_error($release)) {
        return $release;
    }
    if ($format == 'mp3') {
        $file = $track['track_mp3'];
    } elseif ($format == 'ogg') {
        $file = $track['track_ogg'];
    } elseif ($format == 'flac') {
        $file = $track['track_flac'];
    } else {
        return new WP_Error('ribcage-incorrect-format', __("{$format} isn't a format I am aware of.<br />Hence it isn't a format you can download."));
    }
    ribcage_log(TRUE);
    ribcage_download($file);
}