summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-07-01 23:51:41 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-07-01 23:51:41 +0000
commit4d4712f34166a9138c6c2f627187bfcccbddd169 (patch)
tree0207890fc425095acad08db9d1ec64620a284ced
parentc78314791e6b84945f693720c33fcdf9a4ba324f (diff)
downloadampache-4d4712f34166a9138c6c2f627187bfcccbddd169.tar.gz
ampache-4d4712f34166a9138c6c2f627187bfcccbddd169.tar.bz2
ampache-4d4712f34166a9138c6c2f627187bfcccbddd169.zip
bunch of minor fixes and a db change
-rw-r--r--admin/catalog.php2
-rwxr-xr-xdocs/CHANGELOG3
-rw-r--r--lib/class/catalog.class.php11
-rw-r--r--lib/class/update.class.php11
-rw-r--r--lib/stream.lib.php36
-rw-r--r--play/index.php5
-rw-r--r--templates/show_adds_catalog.inc.php2
-rw-r--r--templates/show_artist_box.inc.php12
-rw-r--r--templates/show_edit_catalog.inc.php4
9 files changed, 43 insertions, 43 deletions
diff --git a/admin/catalog.php b/admin/catalog.php
index 8f07f094..f987c289 100644
--- a/admin/catalog.php
+++ b/admin/catalog.php
@@ -242,7 +242,7 @@ switch ($_REQUEST['action']) {
show_confirmation(_('Delete Catalog'),_('Do you really want to delete this catalog?') . " -- $catalog->name ($catalog->path)",$nexturl,1);
break;
case 'show_customize_catalog':
- include(conf('prefix') . '/templates/show_edit_catalog.inc.php');
+ require_once Config::get('prefix') . '/templates/show_edit_catalog.inc.php';
break;
case 'gather_album_art':
$catalogs = Catalog::get_catalogs();
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index 013d76f1..fc07e541 100755
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -4,6 +4,9 @@
--------------------------------------------------------------------------
v.3.4-Alpha1
+ - Round the downsampled content-length
+ - Fixed cataloging so that Orphaned Albums are always the same year
+ - Added new preferences, created new Playlist Preference section
- Fixed Find album art so it can look in the id3/wma art tags
correctly (Thx Karl Hungus)
- Updated SQL to latest version
diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php
index eef579ac..1ceaf9ce 100644
--- a/lib/class/catalog.class.php
+++ b/lib/class/catalog.class.php
@@ -1021,8 +1021,8 @@ class Catalog {
}
show_box_top();
- echo "\n<br />" . _("Catalog Update Finished") . "... " . _("Total Time") . " [" . date("i:s",$time_diff) . "] " .
- _("Total Songs") . " [" . $this->count . "] " . _("Songs Per Seconds") . " [" . $song_per_sec . "]<br /><br />";
+ echo "\n<br />" . _('Catalog Update Finished') . "... " . _('Total Time') . " [" . date("i:s",$time_diff) . "] " .
+ _('Total Songs') . " [" . $this->count . "] " . _('Songs Per Seconds') . " [" . $song_per_sec . "]<br /><br />";
show_box_bottom();
} // add_to_catalog
@@ -1594,7 +1594,7 @@ class Catalog {
/* Ohh no the artist has lost it's mojo! */
if (!$artist) {
- $artist = "Unknown (Orphaned)";
+ $artist = _('Unknown (Orphaned)');
}
// Remove the prefix so we can sort it correctly
@@ -1671,7 +1671,8 @@ class Catalog {
/* Ohh no the album has lost it's mojo */
if (!$album) {
- $album = "Unknown (Orphaned)";
+ $album = _('Unknown (Orphaned)');
+ unset($album_year);
}
// Remove the prefix so we can sort it correctly
@@ -1751,7 +1752,7 @@ class Catalog {
/* If a genre isn't specified force one */
if (strlen(trim($genre)) < 1) {
- $genre = "Unknown (Orphaned)";
+ $genre = _('Unknown (Orphaned)');
}
if ($this->genres[$genre]) {
diff --git a/lib/class/update.class.php b/lib/class/update.class.php
index 79556491..067a3753 100644
--- a/lib/class/update.class.php
+++ b/lib/class/update.class.php
@@ -199,7 +199,10 @@ class Update {
$update_string = '- Alter the Session.id to be VARCHAR(64) to account for all potential configs.<br />' .
'- Added new user_shout table for Sticky objects / shoutbox.<br />' .
- '- Added new playlist preferences, and new preference catagory of playlist.<br />';
+ '- Added new playlist preferences, and new preference catagory of playlist.<br />' .
+ '- Tweaked Now Playing Table.<br />';
+
+ $version[] = array('version' => '340004','description' => $update_string);
return $version;
@@ -685,6 +688,12 @@ class Update {
$sql = "ALTER TABLE `user_shout` ADD INDEX ( `user` )";
$db_results = Dba::query($sql);
+ $sql = "ALTER TABLE `now_playing` CHANGE `start_time` `expire` INT( 11 ) UNSIGNED NOT NULL DEFAULT '0'";
+ $db_results = Dba::query($sql);
+
+ $sql = "OPTIMIZE TABLE `album`";
+ $db_results = Dba::query($sql);
+
// Update our database version now that we are all done
self::set_version('db_version','340004');
diff --git a/lib/stream.lib.php b/lib/stream.lib.php
index ec404077..3955403e 100644
--- a/lib/stream.lib.php
+++ b/lib/stream.lib.php
@@ -32,11 +32,11 @@ function delete_now_playing($insert_id) {
$user_agent = $_SERVER['HTTP_USER_AGENT'];
// Account for WMP and the Flash Player
- if (stristr($user_agent,"NSPlayer") || $_REQUEST['flash_hack'] == 1) {
+// if (stristr($user_agent,"NSPlayer") || $_REQUEST['flash_hack'] == 1) {
// Commented out until I can figure out the
// trick to making this work
- return true;
- }
+// return true;
+// }
// Remove the song from the now_playing table
$sql = "DELETE FROM `now_playing` WHERE `id` = '$insert_id'";
@@ -54,16 +54,15 @@ function delete_now_playing($insert_id) {
function gc_now_playing() {
/* Account for WMP11's Initial Streaming */
- if (strstr($_SERVER['HTTP_USER_AGENT'],"WMFSDK/11")) { return false; }
+ //if (strstr($_SERVER['HTTP_USER_AGENT'],"WMFSDK/11")) { return false; }
$time = time();
- $expire = $time - 3200; // 86400 seconds = 1 day
$session_id = Dba::escape($_REQUEST['sid']);
if (strlen($session_id)) {
$session_sql = " OR session = '$session_id'";
}
- $sql = "DELETE FROM now_playing WHERE start_time < $expire" . $session_sql;
+ $sql = "DELETE FROM `now_playing` WHERE `expire` < '$time'" . $session_sql;
$db_result = Dba::query($sql);
} // gc_now_playing
@@ -73,33 +72,24 @@ function gc_now_playing() {
* This function takes care of inserting the now playing data
* we use this function because we need to do thing differently
* depending upon which play is actually streaming
- * @package General
- * @catagory Now Playing
*/
function insert_now_playing($song_id,$uid,$song_length) {
$user_agent = $_SERVER['HTTP_USER_AGENT'];
- $time = time();
+ $time = time()+$song_length;
+ $session_id = Dba::escape($_REQUEST['sid']);
/* Windows Media Player is evil and it makes multiple requests per song */
- if (stristr($user_agent,"Windows-Media-Player")) { return false; }
+ if (stristr($user_agent,"Windows-Media-Player") || strstr($user_agent,"Audacious")) { $session_id = ' '; }
/* Check for Windows Media Player 11 */
- if (strstr($user_agent,'NSPlayer/11') AND !strstr($user_agent,'WMFSDK/11')) { return false; }
-
- /* Set the Expire Time */
+ if (strstr($user_agent,'NSPlayer/11') AND !strstr($user_agent,'WMFSDK/11')) { $session_id = ' '; }
// If they are using Windows media player
- if (strstr($user_agent,"NSPlayer") || $_REQUEST['flash_hack'] == 1) {
- // WMP does keep the session open so we need to cheat a little here
- $session_id = Dba::escape($_REQUEST['sid']);
- }
-
- /* Set expire time for worst case clean up */
- $expire = $time;
+ if (strstr($user_agent,"NSPlayer") || $_REQUEST['flash_hack'] == 1) { $session_id = ' '; }
- $sql = "INSERT INTO now_playing (`song_id`, `user`, `start_time`,`session`)" .
- " VALUES ('$song_id', '$uid', '$expire','$session_id')";
+ $sql = "INSERT INTO now_playing (`song_id`, `user`, `expire`,`session`)" .
+ " VALUES ('$song_id', '$uid', '$time','$session_id')";
$db_result = Dba::query($sql);
@@ -210,7 +200,7 @@ function start_downsample($song,$now_playing_id=0,$song_name=0) {
}
- header("Content-Length: " . $sample_ratio*$song->size);
+ header("Content-Length: " . intval($sample_ratio*$song->size));
$browser->downloadHeaders($song_name, $song->mime, false,$sample_ratio*$song->size);
/* Get Offset */
diff --git a/play/index.php b/play/index.php
index 3bef1226..846c86a4 100644
--- a/play/index.php
+++ b/play/index.php
@@ -221,7 +221,7 @@ if (!is_resource($fp)) {
} // else not downsampling
// We need to check to see if they are rate limited
-$chunk_size = '8192';
+$chunk_size = '4096';
if ($GLOBALS['user']->prefs['rate_limit'] > 0) {
$chunk_size = $GLOBALS['user']->prefs['rate_limit'];
@@ -250,13 +250,10 @@ else {
/* Let's force them to actually play a portion of the song before
* we count it in the statistics
- * @author SH
*/
$bytesStreamed = $start;
$minBytesStreamed = $song->size / 2;
-
-
// Actually do the streaming
while (!feof($fp) && (connection_status() == 0)) {
$buf = fread($fp, $chunk_size);
diff --git a/templates/show_adds_catalog.inc.php b/templates/show_adds_catalog.inc.php
index 14844aaf..6031ef65 100644
--- a/templates/show_adds_catalog.inc.php
+++ b/templates/show_adds_catalog.inc.php
@@ -22,6 +22,6 @@
show_box_top();
echo "\n" . _('Starting New Song Search on') . " <b>[$this->name]</b> " . _('catalog') . "<br />\n";
echo _('Found') . ": <span id=\"add_count_" . $this->id ."\">" . _('None') . "</span><br />\n";
-echo _('Reading') . ":<span id=\"add_dir_$catalog_id\"></span><br />";
+echo _('Reading') . ":<span id=\"add_dir_" . $this->id . "\"></span><br />";
show_box_bottom();
?>
diff --git a/templates/show_artist_box.inc.php b/templates/show_artist_box.inc.php
index cf3d71e6..d75c116e 100644
--- a/templates/show_artist_box.inc.php
+++ b/templates/show_artist_box.inc.php
@@ -29,12 +29,12 @@ if (Config::get('ratings')) {
echo "</span>";
} // end if ratings ?>
<strong><?php echo _('Actions'); ?>:</strong><br />
-<a href="<?php echo $web_path; ?>/artists.php?action=show_all_songs&amp;artist=<?php echo $artist_id; ?>"><?php echo _("Show All Songs By") . " " . $artist->full_name; ?></a><br />
-<a href="<?php echo $web_path; ?>/song.php?action=artist&amp;artist_id=<?php echo $artist_id; ?>"><?php echo _("Play All Songs By") . " " . $artist->full_name; ?></a><br />
-<a href="<?php echo $web_path; ?>/song.php?action=artist_random&amp;artist_id=<?php echo $artist_id; ?>"><?php echo _("Play Random Songs By") . " " . $artist->full_name; ?></a><br />
+<a href="<?php echo $web_path; ?>/artists.php?action=show_all_songs&amp;artist=<?php echo $artist->id; ?>"><?php echo _("Show All Songs By") . " " . $artist->full_name; ?></a><br />
+<a href="<?php echo $web_path; ?>/stream.php?action=artist&amp;artist_id=<?php echo $artist->id; ?>"><?php echo _("Play All Songs By") . " " . $artist->full_name; ?></a><br />
+<a href="<?php echo $web_path; ?>/stream.php?action=artist_random&amp;artist_id=<?php echo $artist->id; ?>"><?php echo _("Play Random Songs By") . " " . $artist->full_name; ?></a><br />
<?php if ($GLOBALS['user']->has_access('100')) { ?>
- <a href="<?php echo $web_path; ?>/artists.php?action=update_from_tags&amp;artist=<?php echo $artist_id; ?>"><?php echo _("Update from tags"); ?></a><br />
- <a href="<?php echo $web_path; ?>/artists.php?action=show_rename&amp;artist=<?php echo $artist_id; ?>"><?php echo _("Rename Artist"); ?></a><br />
- <a href="<?php echo $web_path; ?>/artists.php?action=show_similar&amp;artist=<?php echo $artist_id; ?>"><?php echo _("Find duplicate artists"); ?></a><br />
+ <a href="<?php echo $web_path; ?>/artists.php?action=update_from_tags&amp;artist=<?php echo $artist->id; ?>"><?php echo _("Update from tags"); ?></a><br />
+ <a href="<?php echo $web_path; ?>/artists.php?action=show_rename&amp;artist=<?php echo $artist->id; ?>"><?php echo _("Rename Artist"); ?></a><br />
+ <a href="<?php echo $web_path; ?>/artists.php?action=show_similar&amp;artist=<?php echo $artist->id; ?>"><?php echo _("Find duplicate artists"); ?></a><br />
<?php } ?>
<?php show_box_bottom(); ?>
diff --git a/templates/show_edit_catalog.inc.php b/templates/show_edit_catalog.inc.php
index aaa3e950..efd406ae 100644
--- a/templates/show_edit_catalog.inc.php
+++ b/templates/show_edit_catalog.inc.php
@@ -1,7 +1,7 @@
<?php
/*
- Copyright (c) 2001 - 2006 Ampache.org
+ Copyright (c) 2001 - 2007 Ampache.org
All rights reserved.
This program is free software; you can redistribute it and/or
@@ -20,7 +20,7 @@
*/
?>
<?php show_box_top(_('Settings for') . ' ' . $catalog->name . ' (' . $catalog->path . ')'); ?>
-<form method="post" action="<?php echo conf('web_path'); ?>/admin/catalog.php" enctype="multipart/form-data">
+<form method="post" action="<?php echo Config::get('web_path'); ?>/admin/catalog.php" enctype="multipart/form-data">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td><?php echo _('Name'); ?>:</td>