Comments (10)
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.
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.
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.
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.
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.
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.
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.
The image MIME type is now available under tag.images.front_cover.mime_type
.
from tinytag.
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.
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)
- [BUG] Can't read `extra` tags from .m4a files HOT 1
- Expose a list of supported file extensions HOT 4
- Fail to read track_total, but it is ok in foobar
- asyncio interfaces HOT 3
- [BUG] Incompatibility with Python-pip HOT 2
- [BUG] `tags.year` is null although the MP3 file has the year set HOT 2
- [BUG] tinytag 1.10.0 aiff does not have extra data HOT 4
- Add support for ID3 Chapters (CHAP/CTOC) HOT 2
- [BUG] only get the first artist in multiple when read flac file HOT 7
- [BUG] non-existent tag content appeared in mp3 files
- [BUG] tinytag does not support certain non-ascii filenames HOT 1
- [BUG] ID3: Only first WOAR frame is kept HOT 16
- [BUG] Wrong duration using TinyTag.get HOT 5
- Please do not put the document of unreleased version on master branch
- Change DEBUG global name HOT 1
- Support for multiple entries in tags HOT 4
- Support ratings HOT 5
- [2.0] Cannot transform tag into dictionary HOT 2
- Cannot convert data type: 18
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 tinytag.