Comments (5)
i had same issue and found that is a problem with api specifically with CoverArtImage struct id field. In api it has u64 type, but in json it has string type. so i do this
#[derive(Debug, Serialize, Deserialize)]
struct Thumbnail {
small: Option<String>,
large: Option<String>,
res_1200: Option<String>,
res_500: Option<String>,
res_250: Option<String>,
}
#[derive(Debug, Serialize, Deserialize)]
enum ImageType {
Front,
Back,
Booklet,
Medium,
Tray,
Obi,
Spine,
Track,
Liner,
Sticker,
Poster,
Watermark,
Raw,
Other,
}
#[derive(Debug, Serialize, Deserialize)]
struct CoverArt {
approved: bool,
back: bool,
comment: String,
edit: u64,
front: bool,
id: String, // Change this
image: String,
thumbnails: Thumbnail,
types: Vec<ImageType>,
}
#[derive(Debug, Serialize, Deserialize)]
struct CoverartJson {
images: Vec<CoverArt>,
}
fn foo() {
let art =
reqwest::get("http://coverartarchive.org/release/".to_string() + release.id.as_str())
.await
.unwrap()
.json::<CoverartJson>()
.await
.unwrap();
println!("{:#?}", art);
}
from musicbrainz_rs.
@oknozor can you please fix it?
from musicbrainz_rs.
Note that are some releases have string id type but some have integer type
from musicbrainz_rs.
Hey @AlePon123 I am sorry but I am in vacation right now. But you have already figured out what was going wrong. Maybe you can submit a PR ? Otherwise i'll fix when I am back.
from musicbrainz_rs.
@oknozor The change I needed is simple: #81. Not sure if it's the same AlePon123 needs.
from musicbrainz_rs.
Related Issues (20)
- Add test coverage
- Invalid date format in search_deserializer HOT 3
- Failing artist test case HOT 7
- Add authentication
- Include builder functions lack autocompletion in intelij rust HOT 1
- README still references musicbrainz_rs::model HOT 1
- BrowseQuery: Support type/status parameters on releases/release-groups HOT 1
- Query builder does not fit musicbrainz lucene query for certain entities HOT 3
- Use Default::default instead of optionals everywhere
- Add tests for Url entity HOT 1
- Improve query builder generated function by adding doc
- Use stub tests for API calls HOT 1
- Check enum at build time
- .with_url_relations() not available for fetching by artist HOT 2
- Expose chrono API
- Support release with incomplete date
- Support for browse pagination? HOT 2
- Browse requests have invalid include parameters
- rename_all serialisation/deserialization inconsistency HOT 1
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 musicbrainz_rs.