Giter VIP home page Giter VIP logo

Comments (5)

AlePon123 avatar AlePon123 commented on August 25, 2024

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.

AlePon123 avatar AlePon123 commented on August 25, 2024

@oknozor can you please fix it?

from musicbrainz_rs.

AlePon123 avatar AlePon123 commented on August 25, 2024

Note that are some releases have string id type but some have integer type

from musicbrainz_rs.

oknozor avatar oknozor commented on August 25, 2024

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.

CrendKing avatar CrendKing commented on August 25, 2024

@oknozor The change I needed is simple: #81. Not sure if it's the same AlePon123 needs.

from musicbrainz_rs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.