Giter Club home page Giter Club logo

Comments (10)

mathiascode avatar mathiascode commented on September 21, 2024 1

Here's a quick stab at a dictionary structure. Would be accessed as such: tag.images["front_cover"]["image_data"]

mime_type and picture_type are included because ID3 provides them, but I haven't looked into what other formats do.

tag.images:

  • other
  • icon
  • other_icon
  • front_cover
    • image_data
    • description
    • mime_type
    • picture_type
  • back_cover
  • leaflet
  • media
  • lead_artist
  • artist
  • conductor
  • band
  • composer
  • lyricist
  • recording_location
  • during_recording
  • during_performance
  • video
  • bright_colored_fish
  • illustration
  • band_logo
  • publisher_logo

from tinytag.

aw-was-here avatar aw-was-here commented on September 21, 2024 1

OK I'll try to make some time today/tomorrow to play around with this feature and see how it works out in my workflow. Thanks again!

from tinytag.

aw-was-here avatar aw-was-here commented on September 21, 2024 1

The new code seems to be working ok for me with some quick, preliminary tests. Got a track with 9 front_cover images and I'm getting the proper data for all 9.

Great job! Thanks!

from tinytag.

mathiascode avatar mathiascode commented on September 21, 2024

What would the ideal API for this look like? I'm thinking something similar to the extra dict could work here, with standardized keys and image data as the value, but are we missing any important information this way? Is there anything else than the image and its description that's important to retain?

from tinytag.

aw-was-here avatar aw-was-here commented on September 21, 2024

I can't think of any other info that would be useful that would be in the purview of TinyTag. e.g., image size, image type, etc, are better handled by something like Pillow and would need to be handled by the downstream caller anyway.

from tinytag.

aw-was-here avatar aw-was-here commented on September 21, 2024

mime_type and picture_type are included because ID3 provides them, but I haven't looked into what other formats do.

I wonder how reliable those fields actually are. In my particular case I'll likely just pass the raw data to pillow to convert to a known format.

from tinytag.

mathiascode avatar mathiascode commented on September 21, 2024

PR for testing: #202

I changed my mind and used classes instead of dictionaries. Allows you to easily access images as such:

image = tag.images.front_cover
data = image.data
description = image.description

tag.get_image() remains as a way to get something that most likely resembles a cover image (sometimes it's stored in other instead of front_cover).

I wonder how reliable those fields actually are. In my particular case I'll likely just pass the raw data to pillow to convert to a known format.

I haven't had time to look into them, so I left them out for now. The format allows us to easily expose them in the future though, if necessary.

from tinytag.

mathiascode avatar mathiascode commented on September 21, 2024

The image MIME type is now available under tag.images.front_cover.mime_type.

from tinytag.

mathiascode avatar mathiascode commented on September 21, 2024

I didn't think about the case where multiple images of the same kind can exist, so the API has been changed. You can check the README.md file for more details, but it essentially boils down to:

  • tag.images.any to get any image available, prioritizing the cover art. tag.images.any.data to get the image as bytes.
  • 'images' attributes now contain lists of images. If you want to e.g. get a list of leaflet images, you can do so with tag.images.leaflet. To get the first leaflet image, tag.images.leaflet[0].
  • More uncommon image types were moved to tag.images.extra. If you want to get e.g. a list of artist images, tag.images.extra.get('artist').

from tinytag.

aw-was-here avatar aw-was-here commented on September 21, 2024

Sorry @mathiascode I got distracted with some family stuff. This one is back on my radar and I'll try it out.

from tinytag.

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.