Example #1
0
function SynchronizeAllTags($filename, $synchronizefrom = 'all', $synchronizeto = 'A12', &$errors)
{
    global $getID3;
    set_time_limit(30);
    $ThisFileInfo = $getID3->analyze($filename);
    getid3_lib::CopyTagsToComments($ThisFileInfo);
    if ($synchronizefrom == 'all') {
        $SourceArray = @$ThisFileInfo['comments'];
    } elseif (!empty($ThisFileInfo['tags'][$synchronizefrom])) {
        $SourceArray = @$ThisFileInfo['tags'][$synchronizefrom];
    } else {
        die('ERROR: $ThisFileInfo[tags][' . $synchronizefrom . '] does not exist');
    }
    $SQLquery = 'DELETE FROM `' . GETID3_DB_TABLE . '`';
    $SQLquery .= ' WHERE (`filename` = "' . mysql_escape_string($filename) . '")';
    safe_mysql_query($SQLquery);
    $TagFormatsToWrite = array();
    if (strpos($synchronizeto, '2') !== false && $synchronizefrom != 'id3v2') {
        $TagFormatsToWrite[] = 'id3v2.3';
    }
    if (strpos($synchronizeto, 'A') !== false && $synchronizefrom != 'ape') {
        $TagFormatsToWrite[] = 'ape';
    }
    if (strpos($synchronizeto, 'L') !== false && $synchronizefrom != 'lyrics3') {
        $TagFormatsToWrite[] = 'lyrics3';
    }
    if (strpos($synchronizeto, '1') !== false && $synchronizefrom != 'id3v1') {
        $TagFormatsToWrite[] = 'id3v1';
    }
    getid3_lib::IncludeDependency(GETID3_INCLUDEPATH . 'write.php', __FILE__, true);
    $tagwriter = new getid3_writetags();
    $tagwriter->filename = $filename;
    $tagwriter->tagformats = $TagFormatsToWrite;
    $tagwriter->overwrite_tags = true;
    $tagwriter->tag_encoding = $getID3->encoding;
    $tagwriter->tag_data = $SourceArray;
    if ($tagwriter->WriteTags()) {
        $errors = $tagwriter->errors;
        return true;
    }
    $errors = $tagwriter->errors;
    return false;
}
        $SQLquery .= ' ORDER BY vbr_method';
        $result = safe_mysql_query($SQLquery);
        echo 'VBR methods:<TABLE BORDER="1" CELLSPACING="0" CELLPADDING="4">';
        echo '<TR><TH>Count</TH><TH>VBR Method</TH></TR>';
        while ($row = mysql_fetch_array($result)) {
            echo '<TR>';
            echo '<TD ALIGN="RIGHT">' . FixTextFields(number_format($row['num'])) . '</TD>';
            echo '<TD><A HREF="' . $_SERVER['PHP_SELF'] . '?vbrmethod=' . $row['vbr_method'] . '">' . FixTextFields($row['vbr_method']) . '</A></TD>';
            echo '</TR>';
        }
        echo '</TABLE>';
    } else {
        $SQLquery = 'SELECT filename';
        $SQLquery .= ' FROM files';
        $SQLquery .= ' WHERE (vbr_method = "' . FixDBFields($_REQUEST['vbrmethod']) . '")';
        $result = safe_mysql_query($SQLquery);
        echo number_format(mysql_num_rows($result)) . ' files with VBR_method of "' . $_REQUEST['vbrmethod'] . '":<BR><BR>>';
        while ($row = mysql_fetch_array($result)) {
            echo '<A HREF="getid3.demo.check.php?filename=' . rawurlencode($row['filename']) . '">' . $row['filename'] . '</A><BR>';
        }
    }
    echo '<HR>';
}
echo '<HR><FORM ACTION="' . FixTextFields($_SERVER['PHP_SELF']) . '">';
echo '<B>Warning:</B> Scanning a new directory will erase all previous entries in the database!<BR>';
echo 'Directory: <INPUT TYPE="TEXT" NAME="scan" VALUE="' . FixTextFields(!empty($_REQUEST['scan']) ? $_REQUEST['scan'] : '') . '"> ';
echo '<INPUT TYPE="SUBMIT" VALUE="Go">';
echo '</FORM>';
echo '<HR><FORM ACTION="' . FixTextFields($_SERVER['PHP_SELF']) . '">';
echo 'Re-scanning a new directory will only add new, previously unscanned files into the list (and not erase the database).<BR>';
echo 'Directory: <INPUT TYPE="TEXT" NAME="newscan" VALUE="' . FixTextFields(!empty($_REQUEST['newscan']) ? $_REQUEST['newscan'] : '') . '"> ';
Example #3
0
function submitquery($nr, $ledtext, $sqlStmt, $showsql = '0')
{
    print "<p class='smallsans'>" . (safe_mysql_query($sqlStmt, "FIX-" . $nr) ? "<br>" . $ledtext . " OK " . mysql_affected_rows() : "<br>" . $ledtext . " FAIL " . mysql_error()) . ($showsql ? "<br><tt>" . $sqlStmt . "</tt>" : "") . "</p>";
}
        $album = @implode($ThisFileInfo['comments_html']['album']);
        //$length = $ThisFileInfo['playtime_seconds'];
        $length = filesize($processme);
        $mod_date = filemtime($processme);
        //$filepath = PODCAST_WWW . $ThisFileInfo['filenamepath'];
        $filepath = PODCAST_WWW . $file;
        $SQLquery = 'INSERT INTO `' . PODCAST_TABLE . '` (`ID`, `artist`, `title`, `description`, `album`, `length`, `date`, `filepath`) VALUES (';
        $SQLquery .= '"' . mysql_escape_string($i) . '", ';
        $SQLquery .= '"' . mysql_escape_string($artist) . '", ';
        $SQLquery .= '"' . mysql_escape_string($title) . '", ';
        $SQLquery .= '"' . mysql_escape_string($descrip) . '", ';
        $SQLquery .= '"' . mysql_escape_string($album) . '", ';
        $SQLquery .= '"' . mysql_escape_string($length) . '", ';
        $SQLquery .= '"' . mysql_escape_string($mod_date) . '", ';
        $SQLquery .= '"' . mysql_escape_string($filepath) . '")';
        safe_mysql_query($SQLquery);
        $i++;
    }
}
closedir($folder);
/*  =========================  BUILD PODCAST XML  ==============================  */
// create the new instance of the rss feed generator
//    setup some basic info about the feed
$rss = new UniversalFeedCreator();
$rss->useCached();
$rss->title = "Tech-Noid Systems Live Show Podcast";
$rss->description = "An Online Resource Catering in All Things EDM";
$rss->link = "http://www.tech-noid.net";
$rss->syndicationURL = "http://radio.tech-noid.net/";
// add some image and its info to the feed xml
$image = new FeedImage();