Closed r0bbie closed 5 years ago
hey @r0bbie , thanks for reporting.
The problem appears to be in the JSON serialization (https://github.com/jesseward/jellyfin-plugin-lastfm/pull/11/files#diff-9c919f330ccd65f1e36800913392211dR53). The last.fm mobile auth handshake is specific in how it can receive its payload (https://www.last.fm/api/mobileauth).
The following change to Jellyfin.Plugin.Lastfm/Api/BaseLastfmApiClient.cs
should fix. I will get this merged soon.
$ git diff Jellyfin.Plugin.Lastfm/Api/BaseLastfmApiClient.cs
diff --git a/Jellyfin.Plugin.Lastfm/Api/BaseLastfmApiClient.cs b/Jellyfin.Plugin.Lastfm/Api/BaseLastfmApiClient.cs
index 08f0dfb..90cd6e6 100644
--- a/Jellyfin.Plugin.Lastfm/Api/BaseLastfmApiClient.cs
+++ b/Jellyfin.Plugin.Lastfm/Api/BaseLastfmApiClient.cs
@@ -48,9 +48,13 @@
Url = BuildPostUrl(request.Secure),
CancellationToken = CancellationToken.None,
DecompressionMethod = CompressionMethod.None,
+ LogRequest = true,
+ LogErrors = true,
+ LogRequestAsDebug = false,
};
- options.RequestContent = _jsonSerializer.SerializeToString(EscapeDictionary(data));
+ options.RequestContentType = "application/x-www-form-urlencoded";
+ options.RequestContent = SetPostData(data);
using (var response = await _httpClient.Post(options))
{
using (var stream = response.Content)
@@ -127,10 +131,13 @@
);
}
- private Dictionary<string, string> EscapeDictionary(Dictionary<string, string> dic)
+ private static string SetPostData(Dictionary<string, string> dic)
{
- return dic.ToDictionary(item => item.Key, item => Uri.EscapeDataString(item.Value));
+ var strings = dic.Keys.Select(key => string.Format("{0}={1}", key, Uri.EscapeDataString(dic[key])));
+ return string.Join("&", strings.ToArray());
+
}
#endregion
}
}
+
With the above, I am able to again submit tracks.
[17:24:42] [INF] Setting range response values for /media/Nightmares on Wax - Smokers Delight/01-damn.mp3. RangeRequest: bytes=0- Content-Length: 764176, Content-Range: bytes 0-764175/764176
[17:24:43] [INF] jw76 is now playing artist=Nightmares on Wax, track=Damn, album=Smokers Delight
[17:25:10] [INF] Playback stopped reported by app Jellyfin Web 10.3.7 playing Damn. Stopped at 27252 ms
[17:25:10] [INF] jw76 played artist=Nightmares on Wax, track=Damn, album=Smokers Delight
Created 2.0.0 release (https://github.com/jesseward/jellyfin-plugin-lastfm/releases/tag/v2.0.0), which should address this
Just to confirm, all now running smoothly for me!
Updated plugin version to head (9c804771386ef59c05979d508149d5a9408baf69) in order to get it working with latest version of Jellyfin again (10.3.7) with #10 now resolved.
Unfortunately scrobbling is still failing. Checked Jellyfin logs, related error pasted here: