Ejemplo n.º 1
0
function track_data()
{
    $tracks = CMP3File::get_tracks(TRACKS_LOCATION);
    $data = ["total_tracks" => count($tracks), "tracks_location" => TRACKS_LOCATION, "tracks_size" => format_bytes(folder_size(TRACKS_LOCATION))];
    return $data;
}
Ejemplo n.º 2
0
<?php

include "CMP3File.class.php";
$filepathname = "Introduction~Where idiot should go~.mp3";
$mp3file = new CMP3File();
$mp3file->getid3("aud/" . $filepathname);
?>
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
</head>
<body>
<?php 
echo "Filename: " . "aud/" . $filepathname . "<br>\n";
echo "Title: {$mp3file->title}<br>\n";
echo "Artist: {$mp3file->artist}<br>\n";
echo "Album: " . $mp3file->album . "<br>\n";
echo "Year: {$mp3file->year}<br>\n";
echo "Comment: {$mp3file->comment}<br>\n";
echo "Genre: " . Ord($mp3file->genre) . "<br>\n";
echo "test: 人生x僕=<br>\n";
?>
</body>
</html>
Ejemplo n.º 3
0
<?php

include "CMP3File.php";
$filename = "rockstar - 12 - tum ho.mp3";
$mp3file = new CMP3File();
$mp3file->getid3($filename);
echo "Title: {$mp3file->title}<br>\n";
echo "Artist: {$mp3file->artist}<br>\n";
echo "Album: {$mp3file->album}<br>\n";
echo "Year: {$mp3file->year}<br>\n";
echo "Comment: {$mp3file->comment}<br>\n";
echo "Genre: " . Ord($mp3file->genre) . "<br>\n";
Ejemplo n.º 4
0
<?php

header("Content-Type", "text/json");
include "inc/inc.php";
$data = [];
$tracks = CMP3File::get_tracks(TRACKS_LOCATION);
foreach ($tracks as $track) {
    $data[substr(md5($track->filename), 0, 9)] = ["track_src" => $track->filename, "track_name" => $track->title, "track_album" => $track->album, "artist_name" => $track->artist];
}
echo json_encode($data);
Ejemplo n.º 5
0
function nonRemoteMedia($dirArray, $maxFeeds, $delim1, $sftypes, $overrideFileType, $aItemsEmpty, $rootMP3URL, $ownerEmailTAG, $timeAdjstMinus, $timeAdjstPlus, $keywordTAG, $imageItemTAG, $linkTAG, $overrideFolder, $imageUrlTAG, $imageTitleTAG)
{
    while (list($filename, $filedate) = each($dirArray) and $maxFeeds > 0) {
        $mp3file = new CMP3File();
        $mp3file->getid3($filename);
        echo "  <item>\n";
        $descriptiveFileName = stripType($delim1, $sftypes, $filename) . $overrideFileType;
        $descriptiveFileName = $overrideFolder . basename($descriptiveFileName);
        $aItems = $aItemsEmpty;
        if (file_exists($descriptiveFileName)) {
            getDescriptions($descriptiveFileName, $aItems);
            // alters aItems
        }
        // nonremote remote This is the location of the hosting page that has the enclosure
        if ($aItems['link'] == '') {
            $url = $rootMP3URL . "/" . htmlentities(str_replace(" ", "%20", $filename));
        } else {
            $url = $aItems['link'];
        }
        echo "    <link>" . $url . "</link>\n";
        //link string
        // nonremote item title
        if ($aItems['title'] == '') {
            // title tag
            $title = str_replace("_", " ", $mp3file->title);
            //handle empty title in id3 tag
            if (empty($title)) {
                //use file name, drop file extension
                $title = stripType($delim1, $sftypes, $filename);
            }
            //handle '&' in names
            $title = htmlentities($title);
        } else {
            //title from descriptions file
            $title = $aItems['title'];
        }
        echo "    <title>" . $title . "</title>\n";
        // title string
        // nonremote item artist
        if ($aItems['artist'] == '') {
            $artist = $mp3file->artist;
            $artist = htmlentities($artist);
        } else {
            $artist = $aItems['artist'];
        }
        // nonremote item author
        if ($aItems['author'] == '') {
            $author = $ownerEmailTAG;
            $author = htmlentities($author);
        } else {
            $author = $aItems['author'];
        }
        echo "    <author>{$author}</author>\n";
        // nonremote album
        if ($aItems['album'] == '') {
            $album = $mp3file->album;
            $album = htmlentities($album);
        } else {
            $album = $aItems['album'];
        }
        // nonremote composer
        if ($aItems['composer'] == '') {
            $composer = $mp3file->composer;
            $composer = htmlentities($composer);
        } else {
            $composer = $aItems['composer'];
        }
        // nonremote genre
        if ($aItems['genre'] == '') {
            $genre = $mp3file->genre;
            $genre = htmlentities($genre);
        } else {
            $genre = $aItems['genre'];
        }
        // nonremote year
        if ($aItems['year'] == '') {
            $year = $mp3file->year;
            $year = htmlentities($year);
        } else {
            $year = $aItems['year'];
        }
        // nonremote track
        if ($aItems['track'] == '') {
            $track = '';
        } else {
            $track = $aItems['track'];
        }
        // nonremote coyright
        if ($aItems['copyright'] == '') {
            $copyright = $mp3file->copyright;
            $copyright = htmlentities($copyright);
        } else {
            $copyright = $aItems['copyright'];
        }
        // nonremote item description
        $description = '';
        if ($mp3file->comment != '') {
            $description = $mp3file->comment;
        }
        if ($aItems['commentText'] != '') {
            $description = $aItems['commentText'];
        }
        if ($description == '') {
            if (!empty($album)) {
                $description = $title . " - {$album}";
            } else {
                $description = $title . " - {$artist}";
            }
        }
        // non-remote description override, if commentCDATA is present
        if ($aItems['commentCDATA'] != '') {
            $description = $aItems['commentCDATA'];
        }
        echo "    <description>{$description}</description>\n";
        // nonremote item pubDate
        if ($aItems['pubDate'] == '') {
            $itemTimeAdjust = $filedate;
            if ($timeAdjstMinus) {
                $itemTimeAdjust = $filedate - 60 * 60;
                // decrease an hour
            } else {
                if ($timeAdjstPlus) {
                    $itemTimeAdjust = $filedate + 60 * 60;
                    // advance an hur
                }
            }
            $pubdate = fixDate(date("r", $itemTimeAdjust));
        } else {
            $pubdate = $aItems['pubDate'];
        }
        echo "    <pubDate>{$pubdate}</pubDate>\n";
        // nonremote item enclosure
        if ($aItems['enclosureURL'] == '') {
            $enclosure = "\"" . $url . "\" length=\"" . filesize($filename) . "\" type=\"{$mp3file->mime_type}\"";
        } else {
            if ($aItems['enclosureLength'] == '') {
                $enclosureLength = " length=\"" . filesize($filename) . "\"";
            } else {
                $enclosureLength = " length=\"" . $aItems['enclosureLength'] . "\"";
            }
            if ($aItems['enclosureType'] == '') {
                $enclosureType = " type=\"{$mp3file->mime_type}\"";
            } else {
                $enclosureType = " type=\"" . $aItems['enclosureType'] . "\"";
            }
            $enclosure = $aItems['enclosureURL'] . $enclosureLength . $enclosureType;
        }
        echo "    <enclosure url={$enclosure} />\n";
        // nonremote item author
        if ($aItems['author'] == '') {
            $author = $artist;
        } else {
            $author = $aItems['author'];
        }
        echo "    <itunes:author>{$author}</itunes:author>\n";
        // nonremote item summary
        if ($aItems['summary'] == '') {
            $summary = $mp3file->comment;
            $summary = htmlentities($summary);
        } else {
            $summary = $aItems['summary'];
        }
        echo "    <itunes:summary>{$summary}</itunes:summary>\n";
        // nonremote item subtitle
        if ($aItems['subtitle'] == '') {
            $subtitle = $mp3file->comment;
            $subtitle = htmlentities($subtitle);
        } else {
            $subtitle = $aItems['subtitle'];
        }
        echo "    <itunes:subtitle>{$subtitle}</itunes:subtitle>\n";
        // nonremote item keywords
        if ($aItems['keywords'] == '') {
            $keywords = $keywordTAG;
            $keywords = htmlentities($keywords);
        } else {
            $keywords = $aItems['keywords'];
        }
        echo "    <itunes:keywords>{$keywords}</itunes:keywords>\n";
        // non-remote item image
        // check to see if we want image info for each item
        if ($imageItemTAG == "yes") {
            if ($aItems['allowItemImage'] == '') {
                $imageURL = $imageUrlTAG;
                $imageTitle = $imageTitleTAG;
            } else {
                $imageURL = $aItems['imageURL'];
                $imageTitle = $aItems['imageTitle'];
            }
            if ($aItems['imageFileType'] == '') {
                $imageFileType = 'video/jpeg';
            } else {
                $imageFileType = $aItems['imageFileType'];
            }
            $imageURL = htmlentities(str_replace(" ", "%20", $imageURL));
            echo "    <itunes:link rel=\"image\" type=\"{$imageFileType}\" href=\"{$imageURL}\">{$imageTitle}</itunes:link>\n";
        }
        // non-remote item duration
        $fix_duration = $mp3file->duration;
        if (strlen($fix_duration) < 3) {
            $fix_duration = "00:00:" . $fix_duration;
        }
        if (strlen($fix_duration) < 6) {
            $fix_duration = "00:" . $fix_duration;
        }
        // item duration
        if ($aItems['duration'] == '') {
            $duration = $fix_duration;
        } else {
            $duration = $aItems['duration'];
        }
        // non-remote item duration - by Jarod 2007=11
        list($dur_hour, $dur_minute, $dur_second) = explode(":", $duration);
        $dur_total_seconds = $dur_second;
        $dur_total_seconds += $dur_minute * 60;
        $dur_total_seconds += $dur_hour * 3600;
        $duration = gmdate("H:i:s", $dur_total_seconds);
        // end - item duration - by Jarod 2007=11
        echo "    <itunes:duration>{$duration}</itunes:duration>\n";
        // remote item guid
        if ($aItems['guid'] == '') {
            $guid = $url;
            // from link logic
        } else {
            $guid = $aItems['guid'];
        }
        echo "    <guid isPermaLink=\"false\">" . $guid . "</guid>\n";
        // item close
        print "  </item>\n";
        $maxFeeds--;
    }
    // end while
}