Skip to content

Commit

Permalink
Fixed #58: Revert API endpoint calls to older standard, to ensure com…
Browse files Browse the repository at this point in the history
…patibility with all servers
  • Loading branch information
midwan committed Mar 15, 2021
1 parent 80b116d commit 5246ba1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion MB_SubSonic/Plugin.cs
Expand Up @@ -36,7 +36,7 @@ public Interfaces.Plugin.PluginInfo Initialise(IntPtr apiInterfacePtr)
// current only applies to artwork, lyrics or instant messenger name that appears in the provider drop down selector or target Instant Messenger
_about.Type = Interfaces.Plugin.PluginType.Storage;
_about.VersionMajor = 2; // your plugin version
_about.VersionMinor = 30;
_about.VersionMinor = 31;
_about.Revision = 0;
_about.MinInterfaceVersion = Interfaces.Plugin.MinInterfaceVersion;
_about.MinApiRevision = Interfaces.Plugin.MinApiRevision;
Expand Down
4 changes: 2 additions & 2 deletions MB_SubSonic/Properties/AssemblyInfo.cs
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.30.0.0")]
[assembly: AssemblyFileVersion("2.30.0.0")]
[assembly: AssemblyVersion("2.31.0.0")]
[assembly: AssemblyFileVersion("2.31.0.0")]
28 changes: 14 additions & 14 deletions MB_SubSonic/Subsonic.cs
Expand Up @@ -67,7 +67,7 @@ public static bool PingServer(SubsonicSettings settings)

try
{
var request = new RestRequest("ping");
var request = new RestRequest("ping.view");
var response = SendRequest(request);
_serverType = GetServerTypeFromResponse(response);
return IsPingOk(response);
Expand Down Expand Up @@ -194,7 +194,7 @@ public static string[] GetFolders(string path)
}
else
{
var request = new RestRequest("getMusicDirectory");
var request = new RestRequest("getMusicDirectory.view");
request.AddParameter("id", folderId);
var response = SendRequest(request);

Expand Down Expand Up @@ -289,7 +289,7 @@ public static string[] GetFolders(string path)
if (!refresh && !FolderLookup.Count.Equals(0)) return FolderLookup.ToList();
var collection = new List<KeyValuePair<string, string>>();

var request = new RestRequest("getMusicFolders");
var request = new RestRequest("getMusicFolders.view");
var response = SendRequest(request);
if (_serverType == SubsonicSettings.ServerType.Subsonic)
{
Expand Down Expand Up @@ -379,7 +379,7 @@ public static string[] GetFolders(string path)
SetBackgroundTaskMessage("Running GetIndexes...");
var folders = new List<KeyValuePair<string, string>>();

var request = new RestRequest("getIndexes");
var request = new RestRequest("getIndexes.view");
request.AddParameter("musicFolderId", collectionId);
var response = SendRequest(request);

Expand Down Expand Up @@ -474,7 +474,7 @@ public static string[] GetFolders(string path)
if (rootFolders.Any(x => x.Key.Equals(folderId)))
return;

var request = new RestRequest("getMusicDirectory");
var request = new RestRequest("getMusicDirectory.view");
request.AddParameter("id", folderId);
var response = SendRequest(request);

Expand Down Expand Up @@ -581,7 +581,7 @@ private static string GetFolderId(string url)
else if (folderId != null)
{
var folderName = url.Substring(sectionStartIndex, charIndex - sectionStartIndex);
var request = new RestRequest("getMusicDirectory");
var request = new RestRequest("getMusicDirectory.view");
request.AddParameter("id", folderId);
var response = SendRequest(request);

Expand Down Expand Up @@ -653,7 +653,7 @@ private static string GetFileId(string url)
if (rootFolders.Any(x => x.Key.Equals(folderId)))
return null;

var request = new RestRequest("getMusicDirectory");
var request = new RestRequest("getMusicDirectory.view");
request.AddParameter("id", folderId);
var response = SendRequest(request);

Expand Down Expand Up @@ -800,7 +800,7 @@ public static bool FileExists(string url)

var baseFolderName = url.Substring(0, url.IndexOf(@"\", StringComparison.Ordinal));

var request = new RestRequest("getMusicDirectory");
var request = new RestRequest("getMusicDirectory.view");
request.AddParameter("id", folderId);
var response = SendRequest(request);

Expand Down Expand Up @@ -933,7 +933,7 @@ public static byte[] GetFileArtwork(string url)
var id = GetCoverArtId(url);
if (id != null)
{
var request = new RestRequest("getCoverArt");
var request = new RestRequest("getCoverArt.view");
request.AddParameter("id", id);
bytes = DownloadData(request);
}
Expand All @@ -951,7 +951,7 @@ public static byte[] GetFileArtwork(string url)
_lastEx = null;
var playlists = new List<KeyValuePair<string, string>>();

var request = new RestRequest("getPlaylists");
var request = new RestRequest("getPlaylists.view");
var response = SendRequest(request);

if (_serverType == SubsonicSettings.ServerType.Subsonic)
Expand Down Expand Up @@ -994,7 +994,7 @@ public static byte[] GetFileArtwork(string url)
{
_lastEx = null;
var files = new List<KeyValuePair<byte, string>[]>();
var request = new RestRequest("getPlaylist");
var request = new RestRequest("getPlaylist.view");
request.AddParameter("id", id);
var response = SendRequest(request);

Expand Down Expand Up @@ -1047,7 +1047,7 @@ public static void UpdateRating(string id, string rating)
if (string.IsNullOrEmpty(rating)) return;
int.TryParse(rating, out var result);

var request = new RestRequest("setRating");
var request = new RestRequest("setRating.view");
request.AddParameter("id", id);
request.AddParameter("rating", result);
SendRequest(request);
Expand All @@ -1067,7 +1067,7 @@ public static void UpdateRatingLove(string id, string starred)
public static void CreatePlaylist(string name, List<int> songIds)
{
//TODO
var request = new RestRequest("createPlaylist");
var request = new RestRequest("createPlaylist.view");
request.AddParameter("name", name);
foreach (var songId in songIds) request.AddParameter("songId", songId);

Expand All @@ -1083,7 +1083,7 @@ public static void CreatePlaylist(string name, List<int> songIds)
public static void DeletePlaylist(int playlistId)
{
//TODO
var request = new RestRequest("deletePlaylist");
var request = new RestRequest("deletePlaylist.view");
request.AddParameter("id", playlistId);
SendRequest(request);
}
Expand Down

0 comments on commit 5246ba1

Please sign in to comment.