Zeugma440 / atldotnet

Fully managed, portable and easy-to-use C# library to read and edit audio data and metadata (tags) from various audio formats, playlists and CUE sheets
MIT License
461 stars 61 forks source link

Support for all ID3v2.4 Picture Type ? #110

Closed DividedSEv2 closed 3 years ago

DividedSEv2 commented 3 years ago

ATL only Supports Pic-types of Generic, Front, Back CD & Unsupported but, accourting to https://id3.org/id3v2.4.0-frames there is more options to Save Pictures

Picture type:  $00  Other
                  $01  32x32 pixels 'file icon' (PNG only)
                  $02  Other file icon
                  $03  Cover (front)
                  $04  Cover (back)
                  $05  Leaflet page
                  $06  Media (e.g. label side of CD)
                  $07  Lead artist/lead performer/soloist
                  $08  Artist/performer
                  $09  Conductor
                  $0A  Band/Orchestra
                  $0B  Composer
                  $0C  Lyricist/text writer
                  $0D  Recording Location
                  $0E  During recording
                  $0F  During performance
                  $10  Movie/video screen capture
                  $11  A bright coloured fish
                  $12  Illustration
                  $13  Band/artist logotype
                  $14  Publisher/Studio logotype

Is it possible to Support all according to ID3 2.4 standard?

Zeugma440 commented 3 years ago

Sorry for the slow answer, I'm on vacations right now 😋

The choice I initially made here is to support only generic picture types that are common to all tag formats through PictureInfo.PicType, leaving PictureInfo.NativePicCode and PictureInfo.NativePicCodeStr to use as advanced properties for people like you with more precise requirements.

That being said, I'm not 100% certain extending support to all picture types defined in ID3v2.4 would break anything.

=> Before I answer your question, I have to take a look at the specs of all formats that support embedded pictures to see if they are flexible enough to allow what you wish.

For the time being, if you exclusively work with ID3v2.4, I invite you to use PictureInfo.NativePicCode.

DividedSEv2 commented 3 years ago

Can You Please Tell How Save with NavitePicCode Though? becaz my code :-

var newArtwork=PictureInfo.fromBinaryData(System.IO.File.ReadAllBytes(filePath);
newArtwork.Description="This is a Description"
newArtwork.NativePicCode=8; or both newArtwork.NativePicCodeStr="08"
_thetrack.EmbeddedPictures.Add(newArtwork);
_thetrack.Save();

Still save the pic with nativePiccode of 0 instead of 8. Am I missing something? Or bug? Data stores perfectly both image & description but not in right piccode as given... always in 0.

NVM - I figured it out -. Default TagType of 99 was causing issue... Need to specify it to 1 for Id3v2 to work.

DividedSEv2 commented 3 years ago

Problem 1 -> If I add 3 pics in order of with NativePicCodes of 3(Front),4(Back)then 5(Leaflet) then Save... Pic with 3 shows as main coven in all audio player... After that if I remove the pic with NativepicCode 3(Front), Save & Add a new pic with nativepiccode 3(Front) Save Then the order become 4->5->3 & the pic with 4(Back) showing in all music player... & I cant make the 3(Front) pic default anymore... Problem 2....-> also If i fulfill a mp3 with all id3v2 nativepiccodes using musicbee atl can read then all, but in vice-verse of atl stores all id3v2 nativepiccodes atl can read them back but musicbee can't... Why? Problem with atl saving or musicbee ?

Zeugma440 commented 3 years ago

Before I take a look at problem 2, does that issue only exist on MusicBee, or have you seen it on other players ?

DividedSEv2 commented 3 years ago

No other Tag Editer or mediaplayer has option to save multiple APIC other than musicbee is currently installed in PC. as my internet is downed i am very limited to test it out. I will let know with mon that soon. But problem 1 is my higher priority than problem 2. If can check problem 1 in meantime will be great.

Zeugma440 commented 3 years ago

But problem 1 is my higher priority than problem 2. If can check problem 1 in meantime will be great.

Will do.

Until now, I didn't realize the order in which picture fields are saved in the file has an impact on what the player shows. I thought all players were set to display front covers by default, but apparently I've been mistaken.

DividedSEv2 commented 3 years ago

Windows thumbnails also shows the oldest one saved. (Not Front cover if it is saved after some other). An option to set as primary/main to any frame pic with any nativepiccode will be better than making front cover default always.

DividedSEv2 commented 3 years ago

So I tried some softwares... i attached 4 pics using ATL

1)Foobar- supports 5 types, shows 3/3 which it supports to show. 2) Mediamonkey - supports 17 types shows 4/4 3)Itunes - supports ? Types shows 4/4 but did not specify types( shows all as other) 4)AIMP supports only primary 5)MusicBee - supports 17 shows only 1(primary) - maybe uses taglib/taglibsharp 6) Helium - supports ? Shows only (primary) - uses taglibsharp 7) Tag scaner - suports 1 (primary) - in credit shows using Audio Tool Library but didnt found ATL.dll maybe something else. 8) Metatagger - supports 1(primary) uses taglib

So I think Problem 2 is a issue between atl & taglib. & problem 1 is issue of atl in every software.

Zeugma440 commented 3 years ago

Problem 1 should be fixed by 0e0ff05389e9b2177ccb1dd5e69759731c8be200

Now saved pictures order should follow the order of the pictures in Track.EmbeddedPictures

See the relevant unit test https://github.com/Zeugma440/atldotnet/blob/0e0ff05389e9b2177ccb1dd5e69759731c8be200/ATL.test/IO/HighLevel.cs#L501

Could you confirm it works for you ?

I'll get back to you about problem 2.

DividedSEv2 commented 3 years ago

OK. I will test it soon & let you know. So just to clarify.. If I want to put 5 pics with different piccodes. I need to manully insert the any pic with any native code( not limited to front cover 03) at Embeddedpicture(0) position & it would show the 0 position pic with any native code as default to everywhere right? So1) front cover -> cd -> leaflet ... Shows front cover 2) piccode(08)- > piccode(6) -> cd -> front cover ... Shows piccode(08) right?

Zeugma440 commented 3 years ago

Tag scaner - suports 1 (primary) - in credit shows using Audio Tool Library but didnt found ATL.dll maybe something else.

Don't forget the original Audio Tools Library is a library written for Borland Delphi. Maybe Tag Scanner uses that one, not the .NET port I've been maintaining.

Zeugma440 commented 3 years ago

OK. I will test it soon & let you know. So just to clarify.. If I want to put 5 pics with different piccodes. I need to manully insert the any pic with any native code( not limited to front cover 03) at Embeddedpicture(0) position & it would show the 0 position pic with any native code as default to everywhere right? So1) front cover -> cd -> leaflet ... Shows front cover 2) piccode(08)- > piccode(6) -> cd -> front cover ... Shows piccode(08) right?

That's the idea, yeah. Anything you save at position 0 should be saved first in the file, and should appear on screen.

DividedSEv2 commented 3 years ago

It works. I can now manually select any pic with any nativepiccode as default pic. Most Audio Player detected it flawlessly including windows thumbnails itself. But I noticed some app like VLC still follows some different algo-> if the default is a pic with native code 08 & front cover(03) is missing it shows next pic with native code 4 or 5 whichever available & not 8 still). Thts an exception of their app cant do anything about it.

Zeugma440 commented 3 years ago

Glad to read that 😁

Same as the other issue, then.... I'll consider your problems solved but will keep the issue open because I still haven't answered the initial question that is "Is it possible to support for all ID3v2.4 Picture Type without having to use NativePicCode ?"

DividedSEv2 commented 3 years ago

Sure that thing will be less work for client( but as i already done it you can take time) but problem 2 should be checked.. i dont know musicbee uses taglib or not. It maybe a compatibility issue between atl & whatever musicbee uses for tag read. Beacz not only the musicbee only show 1/? Pics it does not show any tags data atl writes in its tag editor textboxes but there is a tag ispector option in its tag viewer which shows all in a listview(but not populate the particular textboxes idk why????). Can you test & confirm it is a issue of musicbee so i dont need to worry about it!!!!

Zeugma440 commented 3 years ago

Just found out what was off with MusicBee : the data length indicator of the picture frame was 4 bytes too large. As the spec doesn't say clearly, the reported size should not take the descriptor's own length into account.

I just fixed that and MusicBee seems to be happy now !

Zeugma440 commented 3 years ago

Regarding the initial request, it turns out I was worrying for nothing

image

=> The only special case to handle is APE, and we can handle it by using the COVER ART (xxx) pattern, where xxx is "Front", "Back", "Media", "Conductor", ...

Zeugma440 commented 3 years ago

All done for next release !

DividedSEv2 commented 3 years ago

Tested working on musicbee. Also any idea on this? It was also a problem on musicbee? weirdMBagain

Zeugma440 commented 3 years ago

Care to share a sample file with that problem ?

DividedSEv2 commented 3 years ago

Nevermind. Musicbee is bugged. Its not a problem of atl. Right click to play with musicbee dont read the tags. Then i removed the song from playlist. Drag&drop the file back to the playlist & volla its read it.. tested 3-4 time with different file same issue. Problem solved. BuggyBee

Zeugma440 commented 3 years ago

This problem is completely different than supporting the ID3v2 picture types.

Please open a new issue.

DividedSEv2 commented 3 years ago

I think this can be closed now then.

Zeugma440 commented 3 years ago

Thanks !