Ejemplo n.º 1
0
 /**
  * Returns the track's complete file path (with $media_dir)
  * 
  * The paramater is one of: user|host|general
  *
  * @author Ben Dodson
  * @version 6/7/04
  * @since 6/7/04
  */
 function getFileName($target = "user")
 {
     global $media_dirs, $web_dirs, $web_root, $root_dir, $protocols, $jzUSER, $allow_resample, $force_resample, $no_resample_subnets, $always_resample;
     if (checkPermission($jzUSER, 'play', $this->getPath("String")) === false) {
         return false;
     }
     if ($this->playpath === false || $this->playpath == "") {
         $cache = $this->readCache();
         if ($cache[0] == "-") {
             // return error?
             $this->playpath = $this->getPath("String");
         } else {
             $this->playpath = $cache[0];
         }
     }
     if (isset($protocols) && isset($this->playpath)) {
         $parr = explode("|", $protocols);
         foreach ($parr as $p) {
             if (stristr($this->playpath, $p) !== false) {
                 return $this->playpath;
             }
         }
     }
     /**********************/
     if ($target == "user" || $target == "general") {
         if ($target == "user" && ($local_root = $jzUSER->getSetting("localpath")) !== false) {
             if (stristr($media_dirs, "|") === false) {
                 $tmp = $this->getFileName("host");
                 if (stristr($tmp, $media_dirs) !== false) {
                     return str_replace("//", "/", str_replace($media_dirs, $local_root, $tmp));
                 }
             }
         }
         $meta = $this->getMeta();
         $arr = array();
         //$arr['Artist'] = $meta['artist']; // decoy
         //$arr['Track'] = $meta['title']; // decoy
         // Resample?
         if (($allow_resample == "true" || $force_resample == "true") && !preg_match("/^{$no_resample_subnets}\$/", $_SERVER['REMOTE_ADDR'])) {
             if ($jzUSER->getSetting('resample_lock')) {
                 $arr["resample"] = $jzUSER->getSetting('resample_rate');
             } else {
                 if (isset($_SESSION['jz_resample_rate'])) {
                     if ($_SESSION['jz_resample_rate'] != "") {
                         // Ok already, we are resampling!!!
                         $arr["resample"] = $_SESSION['jz_resample_rate'];
                     }
                 } else {
                     if ($jzUSER->getSetting('stream') === false && $jzUSER->getSetting('lofi') === true || $force_resample == "true") {
                         $arr["resample"] = $jzUSER->getSetting('resample_rate');
                     }
                 }
             }
         }
         $arr['jz_user'] = $jzUSER->getID();
         // user id
         $arr['sid'] = $_SESSION['sid'];
         // unique session id
         if (getGlobal("CLIP_MODE")) {
             $arr['cl'] = 't';
         }
         // Now, if they are resampling we MUST end with an MP3
         $arr['ext'] = $meta['type'];
         if (isset($_SESSION['jz_resample_rate'])) {
             if ($_SESSION['jz_resample_rate'] != "") {
                 $arr['ext'] = "mp3";
             }
         }
         // Now we need to see if this track is a type that always gets resampled
         if ($allow_resample == "true") {
             // Now do we have a type that is going to get resampled
             if (stristr($always_resample, $meta['type'])) {
                 // Ok, let's set it to MP3
                 $arr['ext'] = "mp3";
             }
         }
         // Now should we send a path or ID?
         if ($web_dirs != "") {
             return jzCreateLink($this->getFileName("host"), "track", $arr);
         } else {
             return jzCreateLink($this->getID(), "track", $arr);
         }
     } else {
         return $this->playpath;
     }
 }
Ejemplo n.º 2
0
/**
 * Processes data for the jlGui embedded player
 * 
 * @author Ross Carlson
 * @version 3/03/05
 * @since 3/03/05
 * @param $list an array containing the tracks to be played
 */
function SERVICE_OPEN_PLAYER_xspf($list)
{
    global $include_path, $root_dir, $this_site;
    $display = new jzDisplay();
    // Let's set the name of this player for later
    $player_type = "xspf";
    // Now let's loop through each file
    $list->flatten();
    $output_content = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
    $output_content .= '<playlist version="1" xmlns = "http://www.jinzora.org">' . "\n";
    $output_content .= '  <trackList>' . "\n";
    // Now let's loop throught the items to create the list
    foreach ($list->getList() as $track) {
        // Should we play this?
        if ((stristr($track->getPath("String"), ".lofi.") or stristr($track->getPath("String"), ".clip.")) and $_SESSION['jz_play_all_tracks'] != true) {
            continue;
        }
        // Let's get the meta
        $meta = $track->getMeta();
        // Let's get the art
        $parent = $track->getParent();
        if (($art = $parent->getMainArt("150x150")) !== false) {
            $image = jzCreateLink($art, "image");
        } else {
            $image = $this_site . $root_dir . "/style/images/default.jpg";
        }
        $output_content .= '    <track>' . "\n";
        $output_content .= '      <location>' . $track->getFileName("user") . '</location>' . "\n";
        $output_content .= '      <image>' . $image . '</image>' . "\n";
        $output_content .= '      <annotation>' . $meta['artist'] . " - " . $meta['title'] . '</annotation>' . "\n";
        $output_content .= '    </track>' . "\n";
    }
    // Now let's finish up the content
    $output_content .= '  </trackList>' . "\n";
    $output_content .= '</playlist>';
    // Now that we've got the playlist, let's write it out to the disk
    $plFile = $include_path . "temp/playlist.xspf";
    @unlink($plFile);
    $handle = fopen($plFile, "w");
    fwrite($handle, $output_content);
    fclose($handle);
    // Now let's display
    $width = "445";
    $height = "250";
    SERVICE_DISPLAY_PLAYER_xspf($width, $height);
}
Ejemplo n.º 3
0
/**
 * Processes data for the jlGui embedded player
 * 
 * @author Ross Carlson
 * @version 3/03/05
 * @since 3/03/05
 * @param $list an array containing the tracks to be played
 */
function SERVICE_OPEN_PLAYER_wimpy($list)
{
    global $include_path, $root_dir, $this_site;
    $display = new jzDisplay();
    // Let's set the name of this player for later
    $player_type = "wimpy";
    // Now let's loop through each file
    $list->flatten();
    $output_content = '<?xml version="1.0"?>' . "\n" . '<playlist>' . "\n";
    // Now let's loop throught the items to create the list
    foreach ($list->getList() as $track) {
        // Should we play this?
        if ((stristr($track->getPath("String"), ".lofi.") or stristr($track->getPath("String"), ".clip.")) and $_SESSION['jz_play_all_tracks'] != true) {
            continue;
        }
        // Let's get the meta
        $meta = $track->getMeta();
        // Let's get the art
        $parent = $track->getParent();
        if (($art = $parent->getMainArt("150x150")) !== false) {
            $image = jzCreateLink($art, "image");
        } else {
            $image = $this_site . $root_dir . "/style/images/default.jpg";
        }
        // Now let's fix the track URL & image
        $tUrl = urlencode($track->getFileName("user"));
        $tUrl = str_replace("http%3A%2F%2F", "http://", $tUrl);
        $tUrl = str_replace("https%3A%2F%2F", "https://", $tUrl);
        $tUrl = str_replace("%2F", "/", $tUrl);
        $image = urlencode($image);
        $image = str_replace("http%3A%2F%2F", "http://", $image);
        $image = str_replace("https%3A%2F%2F", "https://", $image);
        $image = str_replace("%2F", "/", $image);
        $output_content .= '     <item>' . "\n" . '          <filename>' . $tUrl . '</filename>' . "\n" . '          <artist>' . urlencode($meta['artist']) . '</artist>' . "\n" . '          <album>' . urlencode($meta['album']) . '</album>' . "\n" . '          <title>' . urlencode($meta['title']) . '</title>' . "\n" . '          <track>' . urlencode($meta['number']) . '</track>' . "\n" . '          <comments>' . urlencode($track->getDescription) . '</comments>' . "\n" . '          <genre>' . urlencode($meta['genre']) . '</genre>' . "\n" . '          <seconds>' . $meta['length'] . '</seconds>' . "\n" . '          <filesize>' . $meta['size'] . '</filesize>' . "\n" . '          <bitrate>' . $meta['bitrate'] . '</bitrate>' . "\n" . '          <visual>' . $image . '</visual>' . "\n" . '          <url>' . $this_site . $root_dir . '</url>' . "\n" . '     </item>' . "\n";
    }
    // Now let's finish up the content
    $output_content .= '</playlist>';
    // Now that we've got the playlist, let's write it out to the disk
    $plFile = $include_path . "temp/Playlist.xml";
    @unlink($plFile);
    $handle = fopen($plFile, "w");
    fwrite($handle, $output_content);
    fclose($handle);
    // Ok, now we need to pop open the Wimpy player
    $width = "520";
    $height = "350";
    SERVICE_DISPLAY_PLAYER_wimpy($width, $height);
    exit;
}
Ejemplo n.º 4
0
 echo '<?xml version="1.0" encoding="ISO-8859-1"?>' . "\n" . '<rdf:RDF' . "\n" . 'xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"' . "\n" . 'xmlns="http://purl.org/rss/1.0/"' . "\n" . 'xmlns:dc="http://purl.org/dc/elements/1.1/"' . "\n" . 'xmlns:slash="http://purl.org/rss/1.0/modules/slash/"' . "\n" . 'xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/"' . "\n" . 'xmlns:admin="http://webns.net/mvcb/"' . "\n" . 'xmlns:syn="http://purl.org/rss/1.0/modules/syndication/"' . "\n" . '>' . "\n" . '<channel rdf:about="http://www.jinzora.com">' . "\n" . '<title>Jinzora RSS</title>' . "\n" . '<link>http://www.jinzora.com</link>' . "\n" . "<description>Jinzora " . $title . "</description>\n" . "<items>\n" . "</items>\n" . '</channel>' . "\n";
 if (isset($_GET['root'])) {
     $node = new jzMediaNode(stripSlashes($_GET['root']));
 } else {
     $node = new jzMediaNode();
 }
 if ($distance == "track") {
     $returnType = "tracks";
 } else {
     $returnType = "nodes";
 }
 $arr = $node->{$func}($returnType, distanceTo($distance, $node), 5);
 for ($i = 0; $i < count($arr); $i++) {
     // Now let's create the display
     $art = $arr[$i]->getMainArt();
     $imgUrl = jzCreateLink($art, "image");
     $urlArr = array();
     $urlArr['action'] = "playlist";
     $urlArr['jz_path'] = $arr[$i]->getPath("String");
     if ($distance == "track") {
         $urlArr['type'] = "track";
     }
     $title_add = "";
     if ($showPlays) {
         $title_add = ' (' . $arr[$i]->getPlayCount() . ')';
     }
     if ($showDownload) {
         $title_add = ' (' . $arr[$i]->getDownloadCount() . ')';
     }
     // Now that we have the data let's echo it
     echo '<item rdf:about="' . $this_site . str_replace("rss.php", "index.php", str_replace("&", "&amp;", urlize($urlArr))) . '">' . "\n";
Ejemplo n.º 5
0
 /**
  * Same as the above, but returns it instead of displaying it.
  * Useful for use in links.
  *  
  * @author Ben Dodson
  * @version 11/10/04
  * @since 11/10/04
  */
 function returnImage($path, $alt = false, $width = false, $height = false, $method = "limit", $gd = false, $save = false, $align = false, $hspace = false, $vspace = false, $border = "0", $class = false, $linkOnly = false)
 {
     global $album_img_width, $album_img_height, $allow_filesystem_modify, $root_dir;
     $art = jzCreateLink($path, "image");
     if ($linkOnly) {
         return $art;
     }
     $tag = "";
     if ($alt !== false) {
         $tag .= "alt=\"{$alt}\" ";
     }
     $tag .= "title=\"{$alt}\" ";
     if ($method == "fixed") {
         if ($width !== false) {
             $tag .= "width=\"{$width}\" ";
         }
         if ($height !== false) {
             $tag .= "height=\"{$height}\"";
         }
     } else {
         $size = @getimagesize($path);
         $displaywidth = $size[0];
         $displayheight = $size[1];
         if ($size && $size[0] > 0 && $size[1] > 0) {
             switch ($method) {
                 case "limit":
                     if ($width !== false && $width < $displaywidth) {
                         $displayheight = (int) ($displayheight * $width / $displaywidth);
                         $displaywidth = $width;
                     }
                     if ($height && $height < $displayheight) {
                         $displaywidth = (int) ($displaywidth * $height / $displayheight);
                         $displayheight = $height;
                     }
                     $tag .= "width=\"{$displaywidth}\" height=\"{$displayheight}\"";
                     break;
                 case "fit":
                     if ($width !== false) {
                         $displayheight = (int) ($displayheight * $width / $displaywidth);
                         $displaywidth = $width;
                     } else {
                         if ($height !== false) {
                             $displaywidth = (int) ($displaywidth * $height / $displayheight);
                             $displayheight = $height;
                         }
                     }
                     $tag .= "width=\"{$displaywidth}\" height=\"{$displayheight}\"";
                     break;
             }
         }
     }
     if ($align) {
         $tag .= ' align="' . $align . '" ';
     }
     if ($vspace) {
         $tag .= 'vspace="' . $vspace . '" ';
     }
     if ($hspace) {
         $tag .= ' hspace="' . $hspace . '" ';
     }
     if ($class) {
         $tag .= ' class="' . $class . '" ';
     }
     // Now let's set the border
     $tag .= ' border="' . $border . '" ';
     return "<img src=\"" . $art . "\" {$tag}>";
 }
Ejemplo n.º 6
0
/**
 * Processes data for the jlGui embedded player
 * 
 * @author Ross Carlson
 * @version 3/03/05
 * @since 3/03/05
 * @param $list an array containing the tracks to be played
 */
function SERVICE_OPEN_PLAYER_fsmp3($list)
{
    global $include_path, $root_dir, $this_site;
    $display = new jzDisplay();
    // Let's set the name of this player for later
    $player_type = "fsmp3";
    // Now let's loop through each file
    $list->flatten();
    $output_content = '<?xml version="1.0"?>' . "\n" . '<songs>' . "\n";
    // Now let's loop throught the items to create the list
    foreach ($list->getList() as $track) {
        // Should we play this?
        if ((stristr($track->getPath("String"), ".lofi.") or stristr($track->getPath("String"), ".clip.")) and $_SESSION['jz_play_all_tracks'] != true) {
            continue;
        }
        // Let's get the meta
        $meta = $track->getMeta();
        // Let's get the art
        $parent = $track->getParent();
        if (($art = $parent->getMainArt("150x150")) !== false) {
            $image = jzCreateLink($art, "image");
        } else {
            $image = $this_site . $root_dir . "/style/images/default.jpg";
        }
        $output_content .= '<song path="' . $track->getFileName("user") . '" bild="' . $image . '" artist="' . $meta['artist'] . '" title="' . $meta['title'] . '"/>' . "\n";
    }
    // Now let's finish up the content
    $output_content .= '</songs>';
    // Now that we've got the playlist, let's write it out to the disk
    $plFile = $include_path . "temp/audiolist.xml";
    @unlink($plFile);
    $handle = fopen($plFile, "w");
    fwrite($handle, $output_content);
    fclose($handle);
    // Ok, now we need to pop open the fsmp3 Player
    $width = "400";
    $height = "360";
    SERVICE_DISPLAY_PLAYER_fsmp3($width, $height);
    exit;
}