Пример #1
0
/**
 * Creates an RAM compliant playlist and returns it for playing
 * 
 * @author Ross Carlson
 * @version 2/24/05
 * @since 2/24/05
 * @param $list The list of tracks to use when making the playlist
 * @param $return Returns the porperly formated list
 */
function SERVICE_CREATE_PLAYLIST_QT($list)
{
    global $allow_resample, $this_site, $root_dir;
    // Let's get the track so we can send it directly
    $list->flatten();
    $data = $list->getList();
    // Now let's open the embedded player
    $jzSERVICES = new jzServices();
    $jzSERVICES->loadService("players", "qt");
    $jzSERVICES->openPlayer($list);
    return;
    echo $data[0]->getFileName("user");
    exit;
    header("Location: " . $data[0]->getFileName("user"));
    exit;
    // Now let's return
    return $content;
}
Пример #2
0
 /**
  * Sets the artist that the user is browsing for tracking purposes
  * 
  * @author Ross Carlson
  * @version 01.11.05
  * @since 01.11.05
  * @param string $user_id the user id that is viewing
  */
 function getRecommendations($user_id = false)
 {
     return;
     // Ok, first let's get their entire browsing history
     if ($user_id === false) {
         $user_id = $this->getID();
     }
     $dp = $this->data_dir . "/" . $user_id . ".tracking";
     $prevArray = unserialize(@file_get_contents($dp));
     // Now let's setup our service
     $service = new jzServices();
     $service->loadService("similar", "echocloud");
     $artistList = "";
     for ($i = 0; $i < count($prevArray); $i++) {
         if ($prevArray[$i]['artist'] != "") {
             $artistList .= $prevArray[$i]['artist'] . "|";
         }
     }
     $favList = "";
     $c = 0;
     for ($i = 0; $i < count($prevArray); $i++) {
         if ($prevArray[$i]['artist'] != "") {
             if (!stristr($favList, $prevArray[$i]['artist'])) {
                 $favArray[$c]['count'] = substr_count($artistList, $prevArray[$i]['artist']);
                 $favArray[$c]['artist'] = $prevArray[$i]['artist'];
                 $c++;
                 $favList .= $prevArray[$i]['artist'];
             }
         }
     }
     $root = new jzMediaNode();
     @usort($favArray, "track_cmp");
     // Now let's trim this to only 6 artists
     $favArray = @array_slice($favArray, 0, 6);
     for ($i = 0; $i < count($favArray); $i++) {
         returnSimilar($favArray[$i]['artist'], 1);
     }
 }
Пример #3
0
/**
 * Rotates an image
 * 
 * @author Ross Carlson
 * @version 4/16/05
 * @since 4/15/05
 * @param $image string the FULL path to the image to rotate
 */
function SERVICE_ROTATE_IMAGE_gd2($image, $node)
{
    global $allow_filesystem_modify, $include_path;
    // Let's make sure they have GD installed
    if (gd_version() < 2) {
        return false;
    }
    // Well since we can't rotate an ID3 image let's see if it's ID3
    if (stristr($image, "ID3:")) {
        // Now let's make a file out of this data
        $jzSERVICES = new jzServices();
        $jzSERVICES->loadStandardServices();
        // Now let's fix the path
        $path = substr($image, 4);
        $meta = $jzSERVICES->getTagData($path);
        // Now let's create a file
        $file = $include_path . 'data/images/' . str_replace("/", "--", $path);
        $handle = fopen($file, "wb");
        fwrite($handle, $meta['pic_data']);
        fclose($handle);
        // Now let's make this the image for the node
        $node->addMainArt($file);
        // Now let's update the name so we can rotate
        $image = $file;
    }
    // First we have to delete any resized versions of this
    $files = readDirInfo($include_path . 'data/images', "file");
    foreach ($files as $file) {
        if (stristr($file, str_replace($include_path . 'data/images/', "", substr($image, 0, -4)))) {
            @unlink($file);
        }
    }
    // Now let's set our images
    $source = @imagecreatefromjpeg($image);
    $rotate = @imagerotate($source, 90, 0);
    @imagejpeg($rotate, $image);
}
Пример #4
0
    session_name('jinzora-session');
    session_start();
}
$_SESSION['jz_load_time'] = microtime();
$web_path = $include_path;
$install_complete = "no";
// cyclic dependencies...
@(include $include_path . 'settings.php');
@(include_once $include_path . 'system.php');
@(include $include_path . 'settings.php');
include_once $include_path . "lib/general.lib.php";
include_once $include_path . 'services/class.php';
writeLogData("messages", "Index: --------------- Beginning Jinzora session ---------------");
// Load our external services:
writeLogData("messages", "Index: Loading default services");
$jzSERVICES = new jzServices();
$jzSERVICES->loadStandardServices();
if ($cms_mode == "true") {
    writeLogData("messages", "Index: Setting up CMS variables");
    $ar = $jzSERVICES->cmsGETVars();
    foreach ($ar as $id => $val) {
        $link_root .= $id . "=" . $val . "&";
    }
}
if (isset($_GET['install'])) {
    // Now let's include the right file
    if ($_GET['install'] == "step7") {
        if (isset($_POST['submit_step6_more'])) {
            $_GET['install'] = 'step6';
        }
    }
Пример #5
0
 * 
 * Contributors:
 * Please see http://www.jinzora.org/modules.php?op=modload&name=jz_whois&file=index
 *
 * Code Purpose: Takes a given path and generates a Podcast feed for it
 * Created: 9.24.03 by Ross Carlson
 *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
$include_path = getcwd() . "/";
@(include_once 'system.php');
@(include_once 'settings.php');
include_once $include_path . "lib/general.lib.php";
include_once $include_path . 'services/class.php';
include_once 'backend/backend.php';
include_once 'frontend/display.php';
$jzSERVICES = new jzServices();
$jzSERVICES->loadStandardServices();
$display = new jzDisplay();
// Now let's get the node so we can get the tracks
$node = new jzMediaNode($_GET['jz_path']);
$par = $node->getAncestor("artist");
$artist = $par->getName();
$tracks = $node->getSubNodes("tracks", -1);
// Now let's display the header
header("Content-type: application/xml");
echo '<?xml version="1.0" encoding="utf-8"?>' . "\n" . '<rss xmlns:itunes="http://www.itunes.com/DTDs/Podcast-1.0.dtd" version = "2.0">' . "\n" . '<channel>' . "\n" . '  <atom:link rel="self" type="application/rss+xml" title="Jinzora - ' . str_replace("&", "&amp;", $artist . " - " . $node->getName()) . '" href="' . $this_site . $_SERVER['REQUEST_URI'] . '" xmlns:atom="http://purl.org/atom/ns#" />' . "\n" . '  <title>Jinzora - ' . str_replace("&", "&amp;", $artist . " - " . $node->getName()) . '</title>' . "\n" . '  <link>http://www.jinzora.com/</link>' . "\n" . '  <language>en-us</language>' . "\n" . '  <generator>Jinzora http://www.jinzora.com/</generator>' . "\n";
if (($art = $node->getMainArt("200x200")) != false) {
    echo '  <itunes:image rel="image" type="video/jpeg" href="' . str_replace("&", "&amp;", $display->returnImage($art, false, false, false, "limit", false, false, false, false, false, "0", false, true)) . '">' . $node->getName() . '</itunes:image>' . "\n";
    echo '  <itunes:link rel="image" type="video/jpeg" href="' . str_replace("&", "&amp;", $display->returnImage($art, false, false, false, "limit", false, false, false, false, false, "0", false, true)) . '">' . $node->getName() . '</itunes:link>' . "\n";
}
if (($desc = $node->getDescription()) != false) {
Пример #6
0
$jzService = new jzServices();
$jzService->loadService("metadata", "msnmusic");
$image = $jzService->getAlbumMetadata($node, false, "image");
if (strlen($image) != 0) {
    echo '<img src="' . $image . '" border="0"><br>';
    echo $display->returnImageDimensions($image);
    echo '<br><br>';
    echo '<input type="hidden" value="' . $image . '" name="edit_image_' . $i . '">';
    echo '<input type="submit" name="edit_download_' . $i . '" value="' . word('Download') . '" class="jz_submit"><br><br><br>';
    $i++;
}
flushdisplay();
// Now let's get a link from Musicbrainz
unset($jzService);
unset($image);
$jzService = new jzServices();
$jzService->loadService("metadata", "musicbrainz");
$image = $jzService->getAlbumMetadata($node, false, "image");
if (strlen($image) != 0) {
    echo '<img src="' . $image . '" border="0"><br>';
    echo $display->returnImageDimensions($image);
    echo '<br><br>';
    echo '<input type="hidden" value="' . $image . '" name="edit_image_' . $i . '">';
    echo '<input type="submit" name="edit_download_' . $i . '" value="' . word('Download') . '" class="jz_submit"><br><br><br>';
    $i++;
}
flushdisplay();
echo "<br>";
$this->closeButton();
echo "</form></center>";
$this->closeBlock();
Пример #7
0
 /**
  * Returns the track's metadata as an array with the following keys:
  *
  * title
  * bitrate
  * frequency
  * filename [excluding path]
  * size
  * year
  * comment
  * length
  * length_str
  * number
  * genre
  * artist
  * album
  * lyrics
  * type [extension]
  * 
  * These are taken mostly from the ID3.
  *
  * @author Ben Dodson
  * @version 6/7/04
  * @since 6/7/04
  */
 function getMeta($mode = "cache", $installer = false)
 {
     global $track_num_seperator, $root_dir, $web_root, $include_path, $jzSERVICES;
     $meta = array();
     $cache = $this->readCache();
     if ($mode == "cache" && $this->meta != array()) {
         return $this->meta;
     }
     if ($mode == "cache") {
         $meta['title'] = $cache[7];
         $meta['bitrate'] = $cache[20];
         $meta['frequency'] = $cache[8];
         $meta['filename'] = $cache[2];
         $meta['size'] = $cache[13];
         $meta['year'] = $cache[11];
         $meta['comment'] = $cache[9] == "-" ? "" : $cache[9];
         $meta['length'] = $len = $cache[14];
         $meta['number'] = $cache[21];
         $meta['genre'] = $cache[15];
         $meta['artist'] = $cache[16];
         $meta['album'] = $cache[17];
         $meta['lyrics'] = $cache[19] == "" || $cache[19] == "-" ? "" : $cache[19];
         $meta['type'] = $cache[18];
         if (isNothing($meta['type'])) {
             $meta = $this->getMeta("file");
             $this->setMeta($meta, "cache");
         }
     } else {
         // Get it from the file.
         // other backend functions use this to get the id3 before the file is cached.
         if ($mode == "direct") {
             $fname = $this->getPath("String");
         } else {
             $fname = $this->getFileName("host");
         }
         // Do our services exist?
         if (!$jzSERVICES) {
             include_once $include_path . 'services/class.php';
             $jzSERVICES = new jzServices();
             $jzSERVICES->loadStandardServices();
         }
         // Let's setup our tagdata service and return the tag data
         $meta = $jzSERVICES->getTagData($fname, $installer);
     }
     return $meta;
 }
Пример #8
0
 */
session_name('jza');
session_start();
// Let's set the error reporting level
@error_reporting(E_ERROR);
include_once 'system.php';
@(include_once 'settings.php');
include_once 'backend/backend.php';
include_once 'playlists/playlists.php';
include_once 'lib/general.lib.php';
include_once 'lib/jzcomp.lib.php';
include_once 'services/class.php';
$ssid = strip_tags(SID);
writeLogData("as_debug", "mediabroadcast: SID = " . $ssid);
// Let's setup the services
$jzSERVICES = new jzServices();
$jzSERVICES->loadStandardServices();
// Now let's see if we need to split the URL apart
if (isset($_SERVER['PATH_INFO'])) {
    // Ok, now we need to get the variables
    $vars = substr($_SERVER['PATH_INFO'], 1);
    $vArr = explode("&", $vars);
    foreach ($vArr as $item) {
        // Now let's split that out
        $iArr = explode("=", $item);
        // Now let's set the variables
        $_GET[$iArr[0]] = $iArr[1];
    }
}
// Let's clean up the get vars
$_GET = unurlize($_GET);
Пример #9
0
/**
 * Actually sends the data in the specified file.
 * 
 * 
 * @author Ben Dodson, PHP.net
 * @version 11/11/04
 * @since 11/11/04
 */
function streamFile($path, $name, $limit = false, $resample = "", $download = false, $contentTypeFor = false)
{
    global $always_resample, $allow_resample, $always_resample_rate, $jzUSER;
    // Let's ignore if they abort, that way we'll know when the track stops...
    ignore_user_abort(TRUE);
    $jzSERVICES = new jzServices();
    $jzSERVICES->loadStandardServices();
    $status = false;
    if ($limit === false) {
        $speed_limit = 1 * 1024;
    } else {
        $speed_limit = $limit;
    }
    // limit is passed as a param because we may want to limit it for downloads
    // but not for streaming / image viewing.
    // Also, we may want to write a different function for resampling,
    // but I don't know yet.
    // IF NO SPEED LIMIT:
    // the 'speed_limit' from above is the amount
    // of buffer used while sending the file.
    // but with no speed limit, there is no 'sleep' issued.
    // this makes seeking in a file much faster.
    // Let's get the extension of the real file
    $extArr = explode(".", $path);
    $ext = $extArr[count($extArr) - 1];
    if (!is_file($path) || connection_status() != 0) {
        return false;
    }
    $meta = $jzSERVICES->getTagData($path);
    $do_resample = false;
    if (!isNothing($resample)) {
        $do_resample = true;
    }
    if ($allow_resample == "true" && stristr($always_resample, $ext)) {
        $do_resample = true;
    }
    if ($meta['type'] == "mp3") {
        if (!isNothing($resample) && $resample >= $meta['bitrate']) {
            $do_resample = false;
        }
    }
    if ($download) {
        $do_resample = false;
    }
    // Are they resampling or transcoding?
    if ($do_resample) {
        // Ok, if resampling isn't set let's go with the default
        if ($resample == "") {
            $resample = $always_resample_rate;
        }
        // Now let's load up the resampling service
        $jzSERVICES = new jzServices();
        $jzSERVICES->loadService("resample", "resample");
        $jzSERVICES->resampleFile($path, $name, $resample);
        // Now let's unset what they are playing
        $be = new jzBackend();
        $be->unsetPlaying($_GET['jz_user'], $_GET['sid']);
        return;
    }
    // Now we need to know if this is an ID3 image or not
    // First let's get their limit
    $limit = "7";
    $size = filesize($path);
    $range = getContentRange($size);
    if ($range !== false) {
        $range_from = $range[0];
        $range_to = $range[1];
    } else {
        $range_from = 0;
        $range_to = $size - 1;
    }
    $ps3 = false;
    $allheaders = getallheaders();
    if (isset($allheaders['User-Agent']) && $allheaders['User-Agent'] == "PLAYSTATION 3") {
        $ps3 = true;
    }
    if ($ps3) {
        // ps3 is picky and bizarre.
        if ($range_from > $size) {
            // This happens if the ps3 thinks the file
            // is larger than it is, and sending a
            // This is supposed to be a read of the id3v1 tag at
            // the end of a file (128 bytes), or the lyrics tag
            // (138 bytes)
            $requested = $range_to - $range_from + 1;
            $range_from = $size - $requested;
            $range_to = $size - 1;
            header("HTTP/1.1 206 Partial content");
        } else {
            if ($range_from == 0 && $size == $range_to + 1) {
                header("HTTP/1.1 200 OK");
            } else {
                header("HTTP/1.1 206 Partial content");
                header("CONTENT-RANGE: bytes {$range_from}-{$range_to}/{$size}");
            }
        }
        header("transferMode.dlna.org: Streaming");
        header("contentFeatures.dlna.org: DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=017000 00000000000000000000000000");
        header("Accept-Ranges: bytes");
        header("Connection: keep-alive");
        header("Content-Length: " . ($size - $range_from));
    } else {
        if ($range === false) {
            // Content length has already been sent
            header("Content-Length: " . (string) $size);
        } else {
            header("HTTP/1.1 206 Partial Content");
            header("Accept-Range: bytes");
            header("Content-Length: " . ($size - $range_from));
            header("Content-Range: bytes {$range_from}" . "-" . $range_to . "/{$size}");
        }
    }
    if ($contentTypeFor !== false) {
        sendContentType($contentTypeFor);
    }
    if (!$ps3) {
        header("Content-Disposition: inline; filename=\"" . $name . "\"");
        header("Expires: " . gmdate("D, d M Y H:i:s", mktime(date("H") + 2, date("i"), date("s"), date("m"), date("d"), date("Y"))) . " GMT");
        header("Last-Modified: " . gmdate("D, d M Y H:i:s", filemtime($path)) . " GMT");
        header("Cache-Control: no-cache, must-revalidate");
        header("Pragma: no-cache");
    }
    if ($file = fopen($path, 'rb')) {
        @set_time_limit(0);
        fseek($file, $range_from);
        while (!feof($file) and connection_status() == 0 and ($cur_pos = ftell($file)) < $range_to + 1) {
            print fread($file, min(1024 * $speed_limit, $range_to + 1 - $cur_pos));
            flush();
            if ($limit !== false) {
                sleep(1);
            }
        }
        $status = connection_status() == 0;
        fclose($file);
        @set_time_limit(30);
    }
    // Now let's unset what they are playing
    $be = new jzBackend();
    $be->unsetPlaying($_GET['jz_user'], $_GET['sid']);
    return $status;
}
Пример #10
0
 * 
 * - Code Purpose -
 * - Helps migrate artists to genres
 * -- COMPLETELY UNSUPPORTED!!!!   -   Use at your own risk!
 *
 * @since 01/28/05
 * @author Ross Carlson <*****@*****.**>
 *
 */
// first let's include all the functions and stuff we'll need
$include_path = str_replace("/extras", "", dirname(__FILE__)) . "/";
include_once '../settings.php';
include_once '../system.php';
include_once '../lib/general.lib.php';
include_once '../services/class.php';
$jzSERVICES = new jzServices();
$jzSERVICES->loadService("metadata", "amazon");
// Now let's see if they submitted the form
if (isset($_POST['migrate'])) {
    echo '<br><strong>Beginning reorg of media, please stand by, this could take a while...</strong><br><br>';
    echo "Scanning files";
    flushdisplay();
    // Let's read all the files into a big array
    $readCtr = 0;
    $retArray = readAllDirs($_POST['path'], $readCtr, $retArray, "false", "true", "false");
    echo "<br>";
    $master = "|||";
    // Let's look at each file one by one to see what to do with it
    foreach ($retArray as $item) {
        // Let's strip the full path so we'll have just what we need
        $data = str_replace($_POST['path'] . "/", "", $item);
Пример #11
0
/**
 * 
 * Echos out the XML header information
 *
 * @author Ross Carlson
 * @since 3/31/05
 * 
 **/
function getCurrentTrack()
{
    global $jzUSER, $this_site, $root_dir;
    // What kind of output?
    if (isset($_REQUEST['type'])) {
        $type = $_REQUEST['type'];
    } else {
        $type = "xml";
    }
    // Now let's set the width
    if (isset($_REQUEST['imagesize'])) {
        $imagesize = $_REQUEST['imagesize'] . "x" . $_REQUEST['imagesize'];
    } else {
        $imagesize = "150x150";
    }
    // Now let's see when to stop
    if (isset($_REQUEST['count'])) {
        $total = $_REQUEST['count'];
    } else {
        $total = 1;
    }
    // Let's start the page
    if ($type == "xml") {
        echoXMLHeader();
    }
    // Now let's get the data
    $be = new jzBackend();
    $ar = $be->getPlaying();
    $display = new jzDisplay();
    $fullList = "";
    $found = false;
    foreach ($ar as $user => $tracks) {
        $name = $jzUSER->getSetting("full_name");
        if ($name == "") {
            $name = $jzUSER->lookupName($user);
            // that's the user name
        }
        $i = 0;
        foreach ($tracks as $time => $song) {
            // Now let's make sure this is the right user
            if ($name == $jzUSER->getName()) {
                // Now let's make sure we don't list this twice
                if (stristr($fullList, $song['path'] . "-" . $name . "\n")) {
                    continue;
                }
                $fullList .= $song['path'] . "-" . $name . "\n";
                // Now let's create the objects we need
                $node = new jzMediaNode($song['path']);
                $track = new jzMediaTrack($song['path']);
                $album = $node->getParent();
                $artist = $album->getParent();
                $meta = $track->getMeta();
                // Now, now let's echo out the data
                switch ($type) {
                    case "xml":
                        echo "  <item>\n";
                        echo "    <title>" . $this_site . xmlUrlClean($meta['title']) . "</title>\n";
                        echo "    <album>\n";
                        echo "      <name>" . $this_site . xmlUrlClean($album->getName()) . "</name>\n";
                        echo "      <image>" . $this_site . xmlUrlClean($display->returnImage($album->getMainArt(false, true, "audio", true), $album->getName(), false, false, "limit", false, false, false, false, false, "0", false, true, true)) . "</image>\n";
                        echo "    </album>\n";
                        echo "    <artist>\n";
                        echo "      <name>" . $this_site . xmlUrlClean($artist->getName()) . "</name>\n";
                        echo "      <image>" . $this_site . xmlUrlClean($display->returnImage($artist->getMainArt(false, true, "audio", true), $artist->getName(), false, false, "limit", false, false, false, false, false, "0", false, true, true)) . "</image>\n";
                        echo "    </artist>\n";
                        echo "  </item>\n";
                        break;
                    case "html":
                        if (isset($_REQUEST['align'])) {
                            if ($_REQUEST['align'] == "center") {
                                echo "<center>";
                            }
                        }
                        echo $meta['title'] . "<br>";
                        echo $album->getName() . "<br>";
                        echo $this_site . $display->returnImage($album->getMainArt(false, true, "audio", true), $album->getName(), false, false, "limit", false, false, false, false, false, "0", false, true, true) . "<br>";
                        echo $artist->getName() . "<br>";
                        echo $display->returnImage($artist->getMainArt(false, true, "audio", true), $artist->getName(), false, false, "limit", false, false, false, false, false, "0", false, true, true) . "<br>";
                        break;
                    case "mt":
                        $art = $album->getMainArt($imagesize, true, "audio", true);
                        if ($art) {
                            // Now let's try to get the link from the amazon meta data service
                            if ($_REQUEST['amazon_id'] != "") {
                                $jzService = new jzServices();
                                $jzService->loadService("metadata", "amazon");
                                $id = $jzService->getAlbumMetadata($album, false, "id");
                                echo '<a target="_blank" href="http://www.amazon.com/exec/obidos/tg/detail/-/' . $id . '/' . $_REQUEST['amazon_id'] . '/">';
                            }
                            $display->image($art, $album->getName(), 150, false, "limit");
                            if ($_REQUEST['amazon_id'] != "") {
                                echo '</a>';
                            }
                            echo "<br>";
                        }
                        echo $meta['title'] . "<br>";
                        if ($_REQUEST['amazon_id'] != "") {
                            $jzService = new jzServices();
                            $jzService->loadService("metadata", "amazon");
                            $id = $jzService->getAlbumMetadata($album, false, "id");
                            echo '<a target="_blank" href="http://www.amazon.com/exec/obidos/tg/detail/-/' . $id . '/' . $_REQUEST['amazon_id'] . '/">' . $album->getName() . "</a><br>";
                        } else {
                            echo $album->getName() . "<br>";
                        }
                        echo $artist->getName() . "<br>";
                        break;
                }
                $found = true;
                // Now should we stop?
                $i++;
                if ($i >= $total) {
                    break;
                }
            }
        }
    }
    if (!$found) {
        // Ok, we didn't find anything so let's get the last thing they played...
        $be = new jzBackend();
        $history = explode("\n", $be->loadData("playhistory-" . $jzUSER->getID()));
        $track = new jzMediatrack($history[count($history) - 1]);
        $album = $track->getParent();
        $artist = $album->getParent();
        $meta = $track->getMeta();
        // Now, now let's echo out the data
        switch ($type) {
            case "xml":
                echo "  <item>\n";
                echo "    <title>" . $this_site . xmlUrlClean($meta['title']) . "</title>\n";
                echo "    <album>\n";
                echo "      <name>" . $this_site . xmlUrlClean($album->getName()) . "</name>\n";
                echo "      <image>" . $this_site . xmlUrlClean($display->returnImage($album->getMainArt(false, true, "audio", true), $album->getName(), false, false, "limit", false, false, false, false, false, "0", false, true, true)) . "</image>\n";
                echo "    </album>\n";
                echo "    <artist>\n";
                echo "      <name>" . $this_site . xmlUrlClean($artist->getName()) . "</name>\n";
                echo "      <image>" . $this_site . xmlUrlClean($display->returnImage($artist->getMainArt(false, true, "audio", true), $artist->getName(), false, false, "limit", false, false, false, false, false, "0", false, true, true)) . "</image>\n";
                echo "    </artist>\n";
                echo "  </item>\n";
                break;
            case "html":
                if (isset($_REQUEST['align'])) {
                    if ($_REQUEST['align'] == "center") {
                        echo "<center>";
                    }
                }
                echo $meta['title'] . "<br>";
                echo $album->getName() . "<br>";
                echo $this_site . $display->returnImage($album->getMainArt(false, true, "audio", true), $album->getName(), false, false, "limit", false, false, false, false, false, "0", false, true, true) . "<br>";
                echo $artist->getName() . "<br>";
                echo $display->returnImage($artist->getMainArt(false, true, "audio", true), $artist->getName(), false, false, "limit", false, false, false, false, false, "0", false, true, true) . "<br>";
                break;
            case "mt":
                if (isset($_REQUEST['align'])) {
                    if ($_REQUEST['align'] == "center") {
                        echo "<center>";
                    }
                }
                $art = $album->getMainArt($imagesize, true, "audio", true);
                if ($art) {
                    // Now let's try to get the link from the amazon meta data service
                    if ($_REQUEST['amazon_id'] != "") {
                        $jzService = new jzServices();
                        $jzService->loadService("metadata", "amazon");
                        $id = $jzService->getAlbumMetadata($album, false, "id");
                        echo '<a target="_blank" href="http://www.amazon.com/exec/obidos/tg/detail/-/' . $id . '/' . $_REQUEST['amazon_id'] . '/">';
                    }
                    $display->image($art, $album->getName(), 150, false, "limit");
                    if ($_REQUEST['amazon_id'] != "") {
                        echo '</a>';
                    }
                    echo "<br>";
                }
                echo $meta['title'] . "<br>";
                if ($_REQUEST['amazon_id'] != "") {
                    $jzService = new jzServices();
                    $jzService->loadService("metadata", "amazon");
                    $id = $jzService->getAlbumMetadata($album, false, "id");
                    echo '<a target="_blank" href="http://www.amazon.com/exec/obidos/tg/detail/-/' . $id . '/' . $_REQUEST['amazon_id'] . '/">' . $album->getName() . "</a><br>";
                } else {
                    echo $album->getName() . "<br>";
                }
                echo $artist->getName() . "<br>";
                break;
        }
    }
    // Now let's close out
    switch ($type) {
        case "xml":
            echoXMLFooter();
            break;
        case "html":
            echo '<a target="_blank" title="Jinzora :: Free Your Media!" href="http://www.jinzora.com"><img src="http://www.jinzora.com/downloads/button-stream.gif" border="0"></a>';
            break;
        case "mt":
            echo '<a target="_blank" title="Jinzora :: Free Your Media!" href="http://www.jinzora.com"><img src="http://www.jinzora.com/downloads/button-stream.gif" border="0"></a>';
            break;
    }
    if (isset($_REQUEST['align'])) {
        if ($_REQUEST['align'] == "center") {
            echo "</center>";
        }
    }
}
Пример #12
0
/**
 * The general resample/transcode function
 * 
 * @author Ross Carlson, Ben Dodson
 * @version 05.25.05
 * @since 05.25.05
 * @param $file The file that we are resampling/transcoding
 * @param $name The name of the stream
 * @param $resample The rate to resample/transcode to
 */
function SERVICE_RESAMPLE($file, $name, $resample)
{
    global $path_to_lame, $path_to_flac, $path_to_mpc, $path_to_wavunpack, $path_to_oggdec, $lame_cmd, $path_to_wmadec, $path_to_shn, $path_to_mplayer, $mplayer_opts, $path_to_faad, $path_to_macpipe, $path_to_ofr;
    $jzSERVICES = new jzServices();
    $jzSERVICES->loadStandardServices();
    // Now let's add the proper options to the lame command
    $lame_cmd .= $resample . ' -f -';
    //Now let's figure out the file type
    $extArr = explode(".", $file);
    $ext = $extArr[count($extArr) - 1];
    // Now if we're on Windows we need to change the slashes for the command line
    if (stristr($_ENV['OS'], "win")) {
        $file = str_replace("/", "\\", $file);
    }
    switch ($ext) {
        case "mp3":
            $meta = $jzSERVICES->getTagData($file);
            if ($meta['bitrate'] <= $resample) {
                header("Content-Type: audio/x-mp3");
                streamFile($file, $meta['artist'] . $meta['title'], $resample);
                exit;
            } else {
                $command = $path_to_lame . " --mp3input -S --silent --quiet --lowpass 12.0 --resample 22.05 -m j -b " . $resample . ' - < "' . $file . '" -';
            }
            break;
        case "flac":
            $command = $path_to_flac . ' -d -c --totally-silent "' . $file . '" | ' . $lame_cmd;
            break;
        case "mpc":
            $command = $path_to_mpc . ' --wav "' . $file . '" | ' . $lame_cmd;
            break;
        case "wv":
            $command = $path_to_wavunpack . ' -q "' . $file . '" - | ' . $lame_cmd;
            break;
        case "ogg":
            // Ok, are they using oggdec or ogg123?
            if (stristr($path_to_oggdec, "oggdec")) {
                //$command = $path_to_oggdec. ' --stdout "'. $file. '" | '. $lame_cmd;
                $command = $path_to_oggdec . ' -Q "' . $file . '" -o - | ' . $lame_cmd;
            } else {
                $command = $path_to_oggdec . ' --skip 1 -q -d wav -f - "' . $file . '" | ' . $lame_cmd;
            }
            break;
        case "wav":
            $command = $path_to_lame . " -S --silent --quiet --lowpass 12.0 --resample 22.05 -m j -b " . $resample . ' - < "' . $file . '" -';
            break;
        case "shn":
            if (stristr($_ENV['OS'], "win")) {
                $command = $path_to_shn . ' -x "' . $file . '" - | ' . str_replace(" -S --silent", " -x -S --silent", $lame_cmd);
            } else {
                $command = $path_to_shn . ' -x "' . $file . '" - | ' . $lame_cmd;
            }
            break;
        case "wma":
            $command = $path_to_wmadec . ' -w "' . $file . '" | ' . $lame_cmd;
            break;
        case "ape":
            $command = $path_to_macpipe . ' "' . $file . '" - -d | ' . $lame_cmd;
            break;
        case "ofr":
            $command = $path_to_ofr . ' --decode --silent "' . $file . '" --output - | ' . str_replace(" -S --silent", " -x -S --silent", $lame_cmd);
            break;
        case "ra":
        case "ram":
        case "rm":
        case "m4a":
            if (stristr($_ENV['OS'], "win")) {
                $command = $path_to_faad . ' -w "' . $file . '" | ' . str_replace(" -S --silent", " -x -S --silent", $lame_cmd);
            } else {
                $command = $path_to_mplayer . ' ' . $mplayer_opts . ' "' . $file . '" | ' . $lame_cmd;
            }
            break;
        default:
            exit;
            break;
    }
    // Let's log the command we just passed
    writeLogData("resample-command", $command);
    // Now let's send the resampled data
    sendResampledFile($command, $name);
    exit;
}
Пример #13
0
// This page is intended to be a one-include file to create a full Jinzora backend.
if (isset($_REQUEST['include_path']) || !isset($include_path)) {
    $include_path = "";
}
@(include $include_path . "settings.php");
require_once $include_path . "system.php";
@(include $include_path . "settings.php");
require_once $include_path . "backend/backend.php";
// We'll need to use some general functions, like urlize:
require_once $include_path . "lib/general.lib.php";
$this_page = setThisPage();
// And playlists:
require_once $include_path . "playlists/class.php";
// We need services for the URL stuff:
require_once $include_path . "services/class.php";
$jzSERVICES = new jzServices();
$jzSERVICES->loadStandardServices();
// Make a fake user, just in case:
if (defined('JZ_NO_USER')) {
    $jzUSER = new jzUser(false);
} else {
    $jzUSER = new jzUser();
}
$jzSERVICES->loadUserServices();
handleUserInit();
include_once $include_path . "frontend/icons.lib.php";
include_once $include_path . "frontend/frontends/{$my_frontend}/header.php";
// Let's build a display class:
require_once $include_path . "frontend/display.php";
$display = new jzDisplay();
// This is a bundle of useful display functions.
Пример #14
0
include_once '../settings.php';
include_once '../lib/general.lib.php';
include_once '../services/class.php';
// First let's clean up their media dir
$media_dir = $_POST['media_dir'];
$media_dir = str_replace("//", "/", str_replace("\\", "/", $media_dir));
// Now let's read each file under there
echo "Reading all files in: " . $media_dir . ", please wait this might take quite a while...<br>";
$readCtr = 0;
$retArray = readAllDirs($media_dir, &$readCtr, &$retArray, "false", "true");
echo "<br>" . count($retArray) . " files read, processing...<br>";
// Let's connect to the database
mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname);
// Let's load up our services
$jzSERVICES = new jzServices();
$jzSERVICES->loadStandardServices();
foreach ($retArray as $file) {
    // Let's read the meta data from the file
    $meta = $jzSERVICES->getTagData($file);
    // Let's insert into Genres
    $query = 'insert into jz_genres (Name) values ("' . $meta['genre'] . '")';
    mysql_query($query);
    // Now let's get the ID for that genre
    $query = 'select ID from jz_genres where Name = "' . $meta['genre'] . '"';
    $result = mysql_query($query);
    while (list($ID) = mysql_fetch_row($result)) {
        $genreID = $ID;
    }
    // Let's insert into artists
    $query = 'insert into jz_artists (Name) values ("' . $meta['artist'] . '")';