mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-05 02:39:47 +02:00
new db update, moved prefs around removed useless one and fixed some defaults, also fixed some potential issues with lastfm
This commit is contained in:
parent
f4ad61dccf
commit
b3950d0c94
10 changed files with 68 additions and 26 deletions
|
@ -4,6 +4,9 @@
|
||||||
|
|
||||||
--------------------------------------------------------------------------
|
--------------------------------------------------------------------------
|
||||||
v.3.4-Alpha3
|
v.3.4-Alpha3
|
||||||
|
- Cleaned up Preferences, moved Plugin Preferences into their own
|
||||||
|
section
|
||||||
|
- Fixed potential LastFM issue if invalid data is passed
|
||||||
- Added Abstract class for localplay and started work on
|
- Added Abstract class for localplay and started work on
|
||||||
next generation of localplay support
|
next generation of localplay support
|
||||||
- Moved Catalog functions out of sidebar, back into the content
|
- Moved Catalog functions out of sidebar, back into the content
|
||||||
|
|
|
@ -224,6 +224,9 @@ class Localplay {
|
||||||
|
|
||||||
// Load the controller and then check for its preferences
|
// Load the controller and then check for its preferences
|
||||||
$localplay = new Localplay($controller);
|
$localplay = new Localplay($controller);
|
||||||
|
// If we can't even load it no sense in going on
|
||||||
|
if (!isset($localplay->_player)) { return false; }
|
||||||
|
|
||||||
$preferences = $localplay->get_preferences();
|
$preferences = $localplay->get_preferences();
|
||||||
|
|
||||||
foreach ($preferences as $preference) {
|
foreach ($preferences as $preference) {
|
||||||
|
@ -575,7 +578,7 @@ class Localplay {
|
||||||
*/
|
*/
|
||||||
public function get_preferences() {
|
public function get_preferences() {
|
||||||
|
|
||||||
$preferences = $this->_player->preferences();
|
$preferences = $this->_player->get_preferences();
|
||||||
|
|
||||||
return $preferences;
|
return $preferences;
|
||||||
|
|
||||||
|
|
|
@ -181,10 +181,16 @@ class scrobbler {
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$as_socket = @fsockopen($this->submit_host, $this->submit_port, $errno, $errstr, 5);
|
if (!trim($this->submit_host) || !$this->submit_port) {
|
||||||
|
$this->reset_handshake = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$as_socket = @fsockopen($this->submit_host, intval($this->submit_port), $errno, $errstr, 5);
|
||||||
|
|
||||||
if(!$as_socket) {
|
if(!$as_socket) {
|
||||||
$this->error_msg = $errstr;
|
$this->error_msg = $errstr;
|
||||||
|
$this->reset_handshake = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
/**
|
/**
|
||||||
* Update Class
|
* Update Class
|
||||||
* this class handles updating from one version of
|
* this class handles updating from one version of
|
||||||
* maintain to the next. Versions are a 6 digit number
|
* ampache to the next. Versions are a 6 digit number
|
||||||
* 220000
|
* 220000
|
||||||
* ^
|
* ^
|
||||||
* Major Revision
|
* Major Revision
|
||||||
|
@ -82,8 +82,8 @@ class Update {
|
||||||
|
|
||||||
// If no table
|
// If no table
|
||||||
if (!Dba::num_rows($db_results)) {
|
if (!Dba::num_rows($db_results)) {
|
||||||
|
// They can't upgrade, they are too old
|
||||||
$version = '310000';
|
header("Location: test.php");
|
||||||
|
|
||||||
} // if table isn't found
|
} // if table isn't found
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ class Update {
|
||||||
/**
|
/**
|
||||||
* need_update
|
* need_update
|
||||||
* checks to see if we need to update
|
* checks to see if we need to update
|
||||||
* maintain at all
|
* ampache at all
|
||||||
*/
|
*/
|
||||||
public static function need_update() {
|
public static function need_update() {
|
||||||
|
|
||||||
|
@ -232,6 +232,12 @@ class Update {
|
||||||
|
|
||||||
$version[] = array('version' => '340009','description' => $update_string);
|
$version[] = array('version' => '340009','description' => $update_string);
|
||||||
|
|
||||||
|
$update_string = '- Removed Playlist Add preference.<br />' .
|
||||||
|
'- Moved Localplay* preferences to options.<br />' .
|
||||||
|
'- Tweaked Default Playlist Method.<br />' .
|
||||||
|
'- Change wording on Localplay preferences.<br />';
|
||||||
|
$version[] = array('version' => '340010','description'=>$update_string);
|
||||||
|
|
||||||
return $version;
|
return $version;
|
||||||
|
|
||||||
} // populate_version
|
} // populate_version
|
||||||
|
@ -938,5 +944,40 @@ class Update {
|
||||||
|
|
||||||
} // update_340009
|
} // update_340009
|
||||||
|
|
||||||
|
/**
|
||||||
|
* update_340010
|
||||||
|
* Bunch of minor tweaks to the preference table
|
||||||
|
*/
|
||||||
|
public static function update_340010() {
|
||||||
|
|
||||||
|
$sql = "UPDATE `preference` SET `catagory`='options' WHERE `name` LIKE 'localplay_%'";
|
||||||
|
$db_results = Dba::query($sql);
|
||||||
|
|
||||||
|
$sql = "DELETE FROM `preference` WHERE `name`='playlist_add'";
|
||||||
|
$db_results = Dba::query($sql);
|
||||||
|
|
||||||
|
$sql = "UPDATE `preference` SET `catagory`='plugins' WHERE (`name` LIKE 'mystrands_%' OR `name` LIKE 'lastfm_%') AND `catagory`='options'";
|
||||||
|
$db_results = Dba::query($sql);
|
||||||
|
|
||||||
|
$sql = "UPDATE `preference` SET `value`='default' WHERE `name`='playlist_method'";
|
||||||
|
$db_results = Dba::query($sql);
|
||||||
|
|
||||||
|
$sql = "UPDATE `preference` SET `description`='Localplay Config' WHERE `name`='localplay_level'";
|
||||||
|
$db_results = Dba::query($sql);
|
||||||
|
|
||||||
|
/* Fix every users preferences */
|
||||||
|
$sql = "SELECT `id` FROM `user`";
|
||||||
|
$db_results = Dba::query($sql);
|
||||||
|
|
||||||
|
User::fix_preferences('-1');
|
||||||
|
|
||||||
|
while ($r = Dba::fetch_assoc($db_results)) {
|
||||||
|
User::fix_preferences($r['id']);
|
||||||
|
} // while results
|
||||||
|
|
||||||
|
self::set_version('db_version','340010');
|
||||||
|
|
||||||
|
} // update_340010
|
||||||
|
|
||||||
} // end update class
|
} // end update class
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -322,23 +322,10 @@ function create_preference_input($name,$value) {
|
||||||
} // foreach themes
|
} // foreach themes
|
||||||
echo "</select>\n";
|
echo "</select>\n";
|
||||||
break;
|
break;
|
||||||
case 'random_method':
|
|
||||||
echo "<select name=\"$name\">\n";
|
|
||||||
echo "\t<option value=\"default\">" . _('Pure Random') . "</option>";
|
|
||||||
echo "\t<option value=\"album\">" . _('Related Album') . "</option>";
|
|
||||||
echo "\t<option value=\"genre\">" . _('Related Genre') . "</option>";
|
|
||||||
echo "</select>\n";
|
|
||||||
break;
|
|
||||||
case 'mystrands_pass':
|
case 'mystrands_pass':
|
||||||
case 'lastfm_pass':
|
case 'lastfm_pass':
|
||||||
echo "<input type=\"password\" size=\"16\" name=\"$name\" value=\"******\" />";
|
echo "<input type=\"password\" size=\"16\" name=\"$name\" value=\"******\" />";
|
||||||
break;
|
break;
|
||||||
case 'playlist_add':
|
|
||||||
echo "<select name=\"$name\">\n";
|
|
||||||
echo "\t<option value=\"append\">" . _('Append to Existing') . "</option>\n";
|
|
||||||
echo "\t<option value=\"default\">" . _('Default') . "</option>\n";
|
|
||||||
echo "</select>\n";
|
|
||||||
break;
|
|
||||||
case 'playlist_method':
|
case 'playlist_method':
|
||||||
${$value} = ' selected="selected"';
|
${$value} = ' selected="selected"';
|
||||||
echo "<select name=\"$name\">\n";
|
echo "<select name=\"$name\">\n";
|
||||||
|
|
|
@ -60,7 +60,7 @@ class AmpacheHttpq extends localplay_controller {
|
||||||
*/
|
*/
|
||||||
public function get_version() {
|
public function get_version() {
|
||||||
|
|
||||||
return '00001';
|
return '000001';
|
||||||
|
|
||||||
} // get_version
|
} // get_version
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
class AmpacheMpd extends localplay_controller {
|
class AmpacheMpd extends localplay_controller {
|
||||||
|
|
||||||
/* Variables */
|
/* Variables */
|
||||||
private $version = '00001';
|
private $version = '000001';
|
||||||
private $description = 'Controls an instance of MPD';
|
private $description = 'Controls an instance of MPD';
|
||||||
|
|
||||||
/* Constructed variables */
|
/* Constructed variables */
|
||||||
|
|
|
@ -54,8 +54,8 @@ class AmpacheLastfm {
|
||||||
*/
|
*/
|
||||||
public function install() {
|
public function install() {
|
||||||
|
|
||||||
Preference::insert('lastfm_user','Last.FM Username',' ','25','string','options');
|
Preference::insert('lastfm_user','Last.FM Username',' ','25','string','plugins');
|
||||||
Preference::insert('lastfm_pass','Last.FM Password',' ','25','string','options');
|
Preference::insert('lastfm_pass','Last.FM Password',' ','25','string','plugins');
|
||||||
Preference::insert('lastfm_port','Last.FM Submit Port',' ','25','string','internal');
|
Preference::insert('lastfm_port','Last.FM Submit Port',' ','25','string','internal');
|
||||||
Preference::insert('lastfm_host','Last.FM Submit Host',' ','25','string','internal');
|
Preference::insert('lastfm_host','Last.FM Submit Host',' ','25','string','internal');
|
||||||
Preference::insert('lastfm_url','Last.FM Submit URL',' ','25','string','internal');
|
Preference::insert('lastfm_url','Last.FM Submit URL',' ','25','string','internal');
|
||||||
|
@ -122,6 +122,8 @@ class AmpacheLastfm {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
debug_event('LastFM','Submission Successful','5');
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
|
@ -45,8 +45,8 @@ class AmpacheOpenStrands {
|
||||||
*/
|
*/
|
||||||
public function install() {
|
public function install() {
|
||||||
|
|
||||||
Preference::insert('mystrands_user','MyStrands Login',' ','25','string','options');
|
Preference::insert('mystrands_user','MyStrands Login',' ','25','string','plugins');
|
||||||
Preference::insert('mystrands_pass','MyStrands Password',' ','25','string','options');
|
Preference::insert('mystrands_pass','MyStrands Password',' ','25','string','plugins');
|
||||||
|
|
||||||
} // install
|
} // install
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
<tr class="table-header">
|
<tr class="table-header">
|
||||||
<th><?php echo _('Name'); ?></th>
|
<th><?php echo _('Name'); ?></th>
|
||||||
<th><?php echo _('Path'); ?></th>
|
<th><?php echo _('Path'); ?></th>
|
||||||
<th><?php echo _('Last Update'); ?></th>
|
<th><?php echo _('Last Verify'); ?></th>
|
||||||
<th><?php echo _('Last Add'); ?></th>
|
<th><?php echo _('Last Add'); ?></th>
|
||||||
<th><?php echo _('Actions'); ?></th>
|
<th><?php echo _('Actions'); ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue