Skip to content

Commit

Permalink
initial subsonic 1.16.1
Browse files Browse the repository at this point in the history
all required functions and data are available.
internet radio creation is not great as it doesn't consider codec or catalog locations
  • Loading branch information
lachlan-00 committed Mar 14, 2023
1 parent ceb7227 commit 3484478
Show file tree
Hide file tree
Showing 14 changed files with 529 additions and 244 deletions.
21 changes: 20 additions & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ You can now use a permanent session token for streaming. (check out the wiki!)
* webplayer
* Add a button next to the playlist to allow looping after the last song
* If you enable playlist loop do not remove previous tracks
* Database 600023
* Database 600024
* Add preference `webplayer_removeplayed`, Remove tracks before the current playlist item in the webplayer when played
* Drop channel table
* Add `total_skip` to podcast table
Expand All @@ -45,6 +45,8 @@ You can now use a permanent session token for streaming. (check out the wiki!)
* Extend `time` column for the song table
* Extend `time` column for the stream_playlist table
* Add `upload_access_level` to restrict uploads to certain user groups
* Add preference `show_subtitle`, Show Album subtitle on links
* Add preference `show_original_year`, Show Album original year on links (Separate from use_original_year)
* Config version 64
* Drop Channels from config
* Reset the art_order defaults
Expand All @@ -56,6 +58,7 @@ You can now use a permanent session token for streaming. (check out the wiki!)
* Add `mbid_artist` to album search
* Add `barcode` to album search
* Add `catalog_number` to album search
* Add `smartplaylist` to album search
* Add `duplicate_tracks` to album and song search (MIN & MAX id for song search)
* Alias `possible_duplicate_album` => `possible_duplicate` for album search
* Alias `album_genre` => `genre` for album search
Expand All @@ -65,6 +68,8 @@ You can now use a permanent session token for streaming. (check out the wiki!)
* webplayer
* Enable restart on democratic or random play
* Allow removing played tracks on next
* Subsonic
* API 1.16.1 support

### Changed

Expand All @@ -84,6 +89,8 @@ You can now use a permanent session token for streaming. (check out the wiki!)
* webplayer
* Only send songs (for now) to the 'Add all to playlist' button
* Added an option `loopBack` which restarts the playlist after finishing
* Subsonic
* Since 1.14.0 the newly created/updated playlist is returned. In earlier versions an empty `<subsonic-response>` element is returned.

### Removed

Expand All @@ -104,6 +111,7 @@ You can now use a permanent session token for streaming. (check out the wiki!)
* Show test errors correctly when you can connect to the server but don't have a database
* When using LDAP check for DN and username on group membership
* Browse filtering for catalogs and podcast_episodes was a bit light
* Song was not checking for channel data
* webplayer
* Visible shadow hightlight and replaygain button for light theme
* Search
Expand Down Expand Up @@ -138,8 +146,19 @@ You can now use a permanent session token for streaming. (check out the wiki!)
* Cast bool fields to `true` and `false` instead of "1" & "0"
* Add `total_count` to resonses to give clients an idea of the total possible objects
* advanced_search
* Add `album_disk` as a search type (uses album rules)
* Add `song_genre` to album and artist searches
* Add `possible_duplicate_album` to song search
* Add `mbid_artist` to album search
* Add `barcode` to album search
* Add `catalog_number` to album search
* Add `smartplaylist` to album search
* Add `duplicate_tracks` to album and song search (MIN & MAX id for song search)
* Alias `possible_duplicate_album` => `possible_duplicate` for album search
* Alias `album_genre` => `genre` for album search
* Alias `mbid_album` => `mbid` for album search
* Alias `mbid_artist` => `mbid` for artist search
* Alias `song_genre` => `genre` for song search

### Changed

Expand Down
5 changes: 3 additions & 2 deletions src/Module/Api/Method/Api4/ShareCreate4Method.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ public static function share_create(array $input, User $user): bool
if (!Api4::check_parameter($input, array('type', 'filter'), self::ACTION)) {
return false;
}
unset($user);

$object_id = $input['filter'];
$object_type = $input['type'];
Expand Down Expand Up @@ -103,14 +102,16 @@ public static function share_create(array $input, User $user): bool
$passwordGenerator = $dic->get(PasswordGeneratorInterface::class);

$results[] = Share::create_share(
$user->id,
$object_type,
$object_id,
true,
$functionChecker->check(AccessLevelEnum::FUNCTION_DOWNLOAD),
$expire_days,
$passwordGenerator->generate(PasswordGenerator::DEFAULT_LENGTH),
0,
$description);
$description
);
}
Catalog::count_table('share');
ob_end_clean();
Expand Down
1 change: 1 addition & 0 deletions src/Module/Api/Method/Api5/ShareCreate5Method.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ public static function share_create(array $input, User $user): bool
$passwordGenerator = $dic->get(PasswordGeneratorInterface::class);

$results[] = Share::create_share(
$user->id,
$object_type,
$object_id,
true,
Expand Down
1 change: 1 addition & 0 deletions src/Module/Api/Method/ShareCreateMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public static function share_create(array $input, User $user): bool
$passwordGenerator = $dic->get(PasswordGeneratorInterface::class);

$results[] = Share::create_share(
$user->id,
$object_type,
$object_id,
true,
Expand Down
38 changes: 26 additions & 12 deletions src/Module/Api/SubsonicApiApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,21 @@ public function run(): void
Preference::init();

// Define list of internal functions that should be skipped
$internal_functions = array('_check_parameter', '_decrypt_password', '_follow_stream', '_updatePlaylist', '_setStar', '_setHeader', '_apiOutput', '_apiOutput2', '_xml2json');
$internal_functions = array(
'_albumList',
'_apiOutput',
'_apiOutput2',
'_check_parameter',
'_decrypt_password',
'_follow_stream',
'_hasNestedArray',
'_output_body',
'_output_header',
'_setHeader',
'_setStar',
'_updatePlaylist',
'_xml2json'
);

// Get the list of possible methods for the Ampache API
$methods = array_diff(get_class_methods(Subsonic_Api::class), $internal_functions);
Expand All @@ -154,8 +168,8 @@ public function run(): void
if (!empty($postdata)) {
$query_string .= '&' . $postdata;
}
$query = explode('&', $query_string);
$params = array();
$query = explode('&', $query_string);
$input = array();
foreach ($query as $param) {
$decname = false;
$decvalue = false;
Expand All @@ -181,23 +195,23 @@ public function run(): void
}
}

if (array_key_exists($decname, $params)) {
if (!is_array($params[$decname])) {
$oldvalue = $params[$decname];
$params[$decname] = array();
$params[$decname][] = $oldvalue;
if (array_key_exists($decname, $input)) {
if (!is_array($input[$decname])) {
$oldvalue = $input[$decname];
$input[$decname] = array();
$input[$decname][] = $oldvalue;
}
$params[$decname][] = $decvalue;
$input[$decname][] = $decvalue;
} else {
$params[$decname] = $decvalue;
$input[$decname] = $decvalue;
}
}
//debug_event('rest/index', print_r($params, true), 5);
//debug_event('rest/index', print_r($input, true), 5);
//debug_event('rest/index', print_r(apache_request_headers(), true), 5);

// Call your function if it's valid
if (in_array($action, $methods)) {
call_user_func(array(Subsonic_Api::class, $action), $params);
call_user_func(array(Subsonic_Api::class, $action), $input, $user);
// We only allow a single function to be called, and we assume it's cleaned up!
return;
}
Expand Down
Loading

0 comments on commit 3484478

Please sign in to comment.