diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-05-13 07:27:16 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-05-13 07:27:16 +0000 |
commit | 6546c826432b5c18c22a2ac2cd7dd1d77a7002c3 (patch) | |
tree | 425469fcd29d5fbb26455220b40d3f576802dc38 /lib | |
parent | ada740ec4123cf286c8abc3a09eb62ed80716fba (diff) | |
download | ampache-6546c826432b5c18c22a2ac2cd7dd1d77a7002c3.tar.gz ampache-6546c826432b5c18c22a2ac2cd7dd1d77a7002c3.tar.bz2 ampache-6546c826432b5c18c22a2ac2cd7dd1d77a7002c3.zip |
fixed playlists thing for real this time
Diffstat (limited to 'lib')
-rw-r--r-- | lib/class/catalog.class.php | 30 | ||||
-rw-r--r-- | lib/log.lib.php | 4 | ||||
-rw-r--r-- | lib/preferences.php | 11 |
3 files changed, 32 insertions, 13 deletions
diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php index 35ac600e..c70095cf 100644 --- a/lib/class/catalog.class.php +++ b/lib/class/catalog.class.php @@ -282,7 +282,7 @@ class Catalog { @param $gather_type=0 Determins if we need to check the id3 tags of the file or not @param $parse_m3u Tells Ampache to look at m3us */ - function add_files($path,$gather_type='',$parse_m3u='',$verbose=1) { + function add_files($path,$gather_type='',$parse_m3u=0,$verbose=1) { /* Strip existing escape slashes and then add them again This is done because we keep adding to the dir (slashed) + (non slashed) and a double addslashes would pooch things @@ -377,7 +377,7 @@ class Catalog { if (is_readable($full_file)) { - if (substr($file,-3,3) == 'm3u' AND $parse_m3u) { + if (substr($file,-3,3) == 'm3u' AND $parse_m3u > 0) { $this->_playlists[] = $full_file; } // if it's an m3u @@ -955,7 +955,7 @@ class Catalog { $start_time = time(); /* Get the songs and then insert them into the db */ - $this->add_files($this->path,$type,1,$verbose); + $this->add_files($this->path,$type,0,$verbose); echo "<script language=\"JavaScript\">"; echo "update_txt('" . $this->count . "','count_add_" . $this->id ."');"; @@ -1933,17 +1933,18 @@ class Catalog { $sql = "SELECT id FROM genre WHERE name LIKE '$genre'"; $db_results = mysql_query($sql, dbh()); - $results = mysql_fetch_object($db_results); + $results = mysql_fetch_assoc($db_results); - if (!$results->id) { + if (!$results['id']) { $sql = "INSERT INTO genre (name) VALUES ('$genre')"; $db_results = mysql_query($sql, dbh()); - $results->id = mysql_insert_id(dbh()); + $insert_id = mysql_insert_id(dbh()); } + else { $insert_id = $results['id']; } - $this->genres[$genre] = $results->id; + $this->genres[$genre] = $insert_id; - return $results->id; + return $insert_id; } //check_genre @@ -2122,16 +2123,19 @@ class Catalog { $results = explode("\n",$data); + $pattern = "/\.(" . conf('catalog_file_pattern'); + $pattern .= ")$/i"; + foreach ($results as $value) { // Remove extra whitespace $value = trim($value); - if (preg_match("/\.[A-Za-z0-9]{3,4}$/",$value)) { - $file[0] = str_replace("/","\\",$value); - $file[1] = str_replace("\\","/",$value); + if (preg_match($pattern,$value)) { + $filename = basename($value); /* Search for this filename, cause it's a audio file */ - $sql = "SELECT id FROM song WHERE file LIKE '%" . sql_escape($file[0]) . "' OR file LIKE '%" . sql_escape($file[1]) . "'"; + $sql = "SELECT id FROM song WHERE file LIKE '%" . sql_escape($filename) . "'"; $db_results = mysql_query($sql, dbh()); - $song_id = mysql_result($db_results,'id'); + $results = mysql_fetch_assoc($db_results); + $song_id = $results['id']; if ($song_id) { $songs[] = $song_id; } } // if it's a file diff --git a/lib/log.lib.php b/lib/log.lib.php index d187fa60..a82338f0 100644 --- a/lib/log.lib.php +++ b/lib/log.lib.php @@ -81,6 +81,10 @@ function ampache_error_handler($errno, $errstr, $errfile, $errline) { break; } // end switch + /* Don't log var: Deprecated we know shutup! */ + if (strstr($errstr,"var: Deprecated. Please use the public/private/protected modifiers")) { + return false; + } $log_line = "[$error_name] $errstr on line $errline in $errfile"; debug_event('error',$log_line,$level); diff --git a/lib/preferences.php b/lib/preferences.php index 371c5d92..a94140a6 100644 --- a/lib/preferences.php +++ b/lib/preferences.php @@ -428,4 +428,15 @@ function init_preferences() { } // init_preferences +/** + * show_import_playlist + * This just shows the template for importing playlists + * from something outside Ampache such as a m3u + */ +function show_import_playlist() { + + require_once(conf('prefix') . '/templates/show_import_playlist.inc.php'); + +} // show_import_playlist + ?> |