Comments (4)
You can use FetchRelease
to get the release metadata. This includes information about all images associated with the release, including the URIs of both the originally uploaded image and any thumbnails generated by the CAA.
from metabrainz.musicbrainz.coverart.
This GUID:968db8b7-c519-43e5-bb45-9f244c92b670 , doesn't have an associated cover, the library attempts to parse and throws an exception, is there a way to check if cover is available instead of a Try/Catch block ?
System.Text.Json.JsonException
HResult=0x80131500
Message='<' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0.
Source=System.Text.Json
StackTrace:
at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, JsonReaderException ex)
at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
at System.Text.Json.JsonSerializer.ReadCore[TValue](JsonConverter jsonConverter, Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
at System.Text.Json.JsonSerializer.ReadCore[TValue](JsonReaderState& readerState, Boolean isFinalBlock, ReadOnlySpan`1 buffer, JsonSerializerOptions options, ReadStack& state, JsonConverter converterBase)
at System.Text.Json.JsonSerializer.ContinueDeserialize[TValue](ReadBufferState& bufferState, JsonReaderState& jsonReaderState, ReadStack& readStack, JsonConverter converter, JsonSerializerOptions options)
at System.Text.Json.JsonSerializer.<ReadAllAsync>d__65`1.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Threading.Tasks.ValueTask`1.get_Result()
at MetaBrainz.Common.Json.JsonUtils.<GetJsonContentAsync>d__7`1.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MetaBrainz.MusicBrainz.CoverArt.CoverArt.<FetchReleaseAsync>d__83.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MetaBrainz.Common.AsyncUtils.ResultOf[T](Task`1 task)
at MetaBrainz.MusicBrainz.CoverArt.CoverArt.FetchRelease(Guid mbid)
at QuickBeat.Dialogs.TagEditor.VB$StateMachine_21_Commands_Fetch_Executed.MoveNext() in C:\Users\AnesH\source\repos\QuickBeat\QuickBeat\Windows\Dialogs\TagEditor.xaml.vb:line 210
This exception was originally thrown at this call stack:
[External Code]
Inner Exception 1:
JsonReaderException: '<' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0.
from metabrainz.musicbrainz.coverart.
Interesting. https://coverartarchive.org/release/968db8b7-c519-43e5-bb45-9f244c92b670 returns a 404, with html content, which is of course not valid JSON.
Looks like I never bothered to add proper error checking in this library (the ListenBrainz library would throw a nicer exception for this).
I may look at adding a ReleaseExists()
, but then that would fetch the result just to discard it; perhaps a FetchReleaseIfAvailable()
, which returns null
for a 404, would make more sense.
FetchRelease()
would then remain as a version that never returns null
but would throw a NotFoundException() or similar.
from metabrainz.musicbrainz.coverart.
Interestingly, the current method docs say you should get a WebException
in case of a 404 or 503. It looks like I never adjusted the error handling when I switched from WebRequest
to HttpClient
.
from metabrainz.musicbrainz.coverart.
Related Issues (5)
- MetaBrainz.MusicBrainz.CoverArt Update HOT 1
- License clarification HOT 9
- Why is `ClientLock` used? HOT 2
- NOOB question HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from metabrainz.musicbrainz.coverart.