</div> <p id="error" class='pad'></p> <?php if (isset($_GET['add']) && $_GET['add'] == 1 && isset($_GET['musicpath'])) { echo "<p class='pad'>"; echo "<img src='img/progress_bar.gif' /><br/><br/>New Music is being added. This could take several minutes.<br/>"; echo "</p>"; } elseif (isset($_GET['musicpath']) && is_dir($_GET['musicpath'])) { echo "<p class='pad'>"; $path = $_GET['musicpath']; if ($path[strlen($path) - 1] != '/') { $path .= "/"; } $addMusic = new addMusic(); $addMusic->setPath($path); $addMusic->getSongs($path, $songs); $songsAdded = $addMusic->insertSongs(); //$songsAdded = $addMusic->insertSongs($addMusic->getSongs($path,&$songs)); echo "<br/>Added <strong>{$songsAdded} Songs</strong> To The Database"; echo "</p>"; } elseif (isset($_FILES['musicfile']['name'])) { echo "<pre>"; print_r($_FILES); echo "</pre>"; echo $_FILES['musicfile']['tmp_name']; echo "<br/>" . $_FILES['musicfile']['name']; move_uploaded_file($_FILES['musicfile']['tmp_name'], $GLOBALS[upload_path] . "/" . $_FILES['musicfile']['name']); } else { echo "<form action='add.php' method='get' onsubmit='return validator()'>\n"; echo "<p class='pad'><input type='hidden' value=1 name='add' /><input type='text' onfocus='this.select()' name='musicpath' id='musicpath' size='45' id='musicpath' value='/path/to/music' /><br/><br/>"; echo "<input type='submit' value='add music' class='btn' /><br/><br/>Be Patient While Music is Added. It could take several minutes.</p>";
<h1>mp3act Add Music</h1> Enter a music directory on the server or upload a file. </div> <p id="error" class='pad'></p> <?php if (isset($_GET['add']) && $_GET['add'] == 1 && isset($_GET['musicpath'])) { $path = $_GET['musicpath']; if ($path[strlen($path) - 1] != '/') { $path .= "/"; } session_write_close(); // otherwise progress isn't shown! echo "<div class='box'><div class=\"head\"><h2>Import results</h2></div><ul>"; $addMusic = new addMusic(); $addMusic->setPath($path); $addMusic->getSongs($path, $songs, $errors); $songsAdded = $addMusic->insertSongs(); echo "<li>Added <strong>{$songsAdded} Songs</strong> To The Database</li>"; echo "</ul></div>"; } elseif (isset($_FILES['musicfile']['name'])) { echo "<pre>"; print_r($_FILES); echo "</pre>"; echo $_FILES['musicfile']['tmp_name']; echo "<br/>" . $_FILES['musicfile']['name']; move_uploaded_file($_FILES['musicfile']['tmp_name'], $GLOBALS[upload_path] . "/" . $_FILES['musicfile']['name']); } else { echo "<form action='add.php' method='get' onsubmit='return validator()'>\n"; echo "<p class='pad'><input type='hidden' value=1 name='add' /><input type='text' onfocus='this.select()' name='musicpath' id='musicpath' size='45' id='musicpath' value='/path/to/music' /><br/><br/>"; echo "<input type='submit' value='add music' class='btn' /><br/><br/>Be Patient While Music is Added. It could take several minutes.</p>"; echo "</form>";
set_time_limit(0); // no time limit, this can take a while eh! session_write_close(); // otherwise progress isn't shown! echo "<div class='box'><div class=\"head\"><h2>Import results</h2></div><ul>"; $addMusic = new addMusic(); /* start by doing directories. progress per directory. */ if (count($queuedirs) > 0) { foreach ($queuedirs as $importdir) { echo "<li>Importing directory {$importdir}</li>"; if ($path[strlen($importdir) - 1] != '/') { $importdir .= "/"; } $addMusic->setPath($importdir); unset($songs); $addMusic->getSongs($importdir, $songs); $songsAdded = $addMusic->insertSongs(); echo "<li>Added <strong>{$songsAdded} Songs</strong> To The Database</li>"; } } /* then do files. here we can have one progress bar for all! */ if (count($queuefiles) > 0) { echo "<li>Adding separate songs to the database</li>"; mp3act_connect(); $last_timestamp = 0; $getID3 = new getID3(); $songsAdded = 0; $num_files = count($queuefiles); foreach ($queuefiles as $importfile) { echo "<li>Importing file {$importfile}</li>"; /* Set the database status */