diff options
Diffstat (limited to 'lib/class')
-rw-r--r-- | lib/class/catalog.class.php | 49 | ||||
-rw-r--r-- | lib/class/localplay.class.php | 21 |
2 files changed, 61 insertions, 9 deletions
diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php index 57186865..35ac600e 100644 --- a/lib/class/catalog.class.php +++ b/lib/class/catalog.class.php @@ -493,7 +493,7 @@ class Catalog { echo "</script>\n"; flush(); } //echos song count - + // Prevent the script from timing out set_time_limit(0); @@ -501,8 +501,7 @@ class Catalog { unset($found); } // foreach albums - - echo "$art_found album's with art. . .<br />\n"; + echo "<br />$art_found " . _('album\'s with art') . ". . .<br />\n"; flush(); } // get_album_art @@ -649,7 +648,7 @@ class Catalog { // Get all of the albums in this catalog $albums = $this->get_catalog_albums($catalog_id); - echo "<br /><b>" . _("Starting Dump Album Art") . ". . .</b><br /><br />\n"; + echo "<br /><b>" . _('Starting Dump Album Art') . ". . .</b><br /><br />\n"; // Run through them an get the art! foreach ($albums as $album) { @@ -789,6 +788,12 @@ class Catalog { /* Get the songs and then insert them into the db */ $this->add_files($this->path,$type,$parse_m3u); + echo "<script language=\"JavaScript\">"; + echo "update_txt('" . $this->count . "','count_add_" . $this->id ."');"; + echo "</script>\n"; + flush(); + + foreach ($this->_playlists as $full_file) { if ($this->import_m3u($full_file)) { $file = basename($full_file); @@ -799,7 +804,7 @@ class Catalog { /* Now Adding Album Art? */ if ($gather_art) { - echo "<br />\n<b>" . _("Starting Album Art Search") . ". . .</b><br />\n"; + echo "<br />\n<b>" . _('Starting Album Art Search') . ". . .</b><br />\n"; echo _('Searched') . ": <span id=\"count_art_" . $this->id . "\">" . _('None') . "</span>"; flush(); $this->get_album_art(0,$art); @@ -952,6 +957,11 @@ class Catalog { /* Get the songs and then insert them into the db */ $this->add_files($this->path,$type,1,$verbose); + echo "<script language=\"JavaScript\">"; + echo "update_txt('" . $this->count . "','count_add_" . $this->id ."');"; + echo "</script>\n"; + flush(); + foreach ($this->_playlists as $full_file) { if ($this->import_m3u($full_file)) { $file = basename($full_file); @@ -1212,12 +1222,25 @@ class Catalog { flush(); } - $sql = "DELETE FROM song WHERE id='" . $results->id . "'"; - $db_results = mysql_query($sql, dbh()); - + /* Add this file to the list for removal from the db */ + $dead_files[] = $results; } //if error } //while gettings songs + + /* Unfortuantly it has to be done this way + * you can't delete a row at the same time you're + * doing a select on said table + */ + if (count($dead_files)) { + foreach ($dead_files as $data) { + + $sql = "DELETE FROM song WHERE id='$data->id'"; + $db_results = mysql_query($sql, dbh()); + + } //end foreach + + } // end if dead files /* Step two find orphaned Arists/Albums * This finds artists and albums that no @@ -1232,6 +1255,9 @@ class Catalog { /* Return dead files, so they can be listed */ if ($verbose) { + echo "<script language=\"JavaScript\">"; + echo "update_txt('" . $this->count ."','count_clean_" . $this->id . "');"; + echo "</script>\n"; echo "<b>" . _("Catalog Clean Done") . " [" . count($dead_files) . "] " . _("files removed") . "</b><br />\n"; flush(); } @@ -1659,6 +1685,13 @@ class Catalog { // Update the last_update $this->update_last_update(); + if ($verbose) { + echo "<script language=\"JavaScript\">"; + echo "update_txt('" . $this->count . "','count_verify_" . $this->id . "');"; + echo "</script>\n"; + flush(); + } + echo _('Update Finished.') . _('Checked') . " $this->count. $total_updated " . _('songs updated.') . "<br /><br />"; $this->count = 0; diff --git a/lib/class/localplay.class.php b/lib/class/localplay.class.php index 1cc9eccb..a3492ff3 100644 --- a/lib/class/localplay.class.php +++ b/lib/class/localplay.class.php @@ -23,7 +23,7 @@ class Localplay { /* Base Variables */ - + var $type; @@ -327,6 +327,25 @@ class Localplay { } // delete + /** + * delete_all + * This removes every song from the players playlist as defined by the delete_all function + * map + */ + function delete_all() { + + + $function = $this->_function_map['delete_all']; + + if (!$this->_player->$function($songs)) { + debug_event('localplay','Error: Unable to delete entire playlist, check ' . $this->type . ' controller','1'); + return false; + } + + return true; + + } // delete_all + } //end localplay class ?> |