Author Topic: BASS_TAG_GetFromFile doesn't read two backslashes in a row  (Read 367 times)

GTHvidsten

  • Posts: 29
I've tested this with the BASS (2.4.17), BASS.NET (2.4.17.2) and BASSFLAC (2.4.5.3). I'm not sure which of these are the culprit.

When an ID3 tag contains to backslashes in a row, everything after, and including, is removed.
For example "Artist One\\Artist Two" is read as "Artist One".

One backslash works as expected where "Artist One\Artist Two" is read as "Artist One\Artist Two".

Here's the code I've used to recreate the issue, where "args[0]" is a valid FLAC file:

Code: [Select]
Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero);
int stream = Un4seen.Bass.AddOn.Flac.BassFlac.BASS_FLAC_StreamCreateFile(args[0], 0, 0, BASSFlag.BASS_DEFAULT);
var tagInfo = new TAG_INFO(args[0]);
if (BassTags.BASS_TAG_GetFromFile(stream, tagInfo))
{
    Console.WriteLine($"Composer: {tagInfo.composer}");
}

radio42

  • Posts: 4834
Can you provide a sample audio file to look at, as in my tests I don't get such results and can not reproduce your case.

FLAC by default uses METADATA_BLOCK_VORBIS_COMMENT structure as explained here (https://www.xiph.org/vorbis/doc/v-comment.html) and not ID3 tags.

Note, that BASS_TAG_GetFromFile will return multiple values semicolon separated.
And that the Artist value is stored in the tagInfo.artist member and not the tagInfo.composer value - is that maybe your issue?

GTHvidsten

  • Posts: 29
I'm sending you a sample audio file in a PM.

In this case I'm specifically looking for the tagInfo.composer value.

When I'm using this file in the sample code I wrote above I only get the first name in the composer tag (as it is separated by two backslashes).

radio42

  • Posts: 4834
Thanks for the sample.
An update (v2.4.17.3) is up on the BASS page (https://www.un4seen.com/download.php?z/4/Bass24.Net.zip), which should fix the issue.

GTHvidsten

  • Posts: 29
I think you forgot to pack a new "core" version of the DLL. Only the "full" DLL reports 2.4.17.3. The "core" still says 2.3.17.2 :)

radio42

  • Posts: 4834
I just re-downloaded it and here it says 2.4.17.3 for both sub-folders core and full - as well as in the nuget package?!

GTHvidsten

  • Posts: 29
I just downloaded it again and now it says 2.4.17.3. Weird. I don't know why it didn't work earlier.

I've also checked all the DLLs in the same folder as the built .exe and the Bass.Net.dll now properly says 2.4.17.3 as well.

However, when running my test application it still doesn't read two backslashes in a row :(

radio42

  • Posts: 4834
True, as there is even another glitch, as in my tests I was setting
Code: [Select]
BassTags.EvalNativeTAGs = false;With this set to FALSE it works fine; but when you leave the default to TRUE it fails as you explained.

I'll posted a new v2.4.17.4. in which this glitch is now also fixed!
« Last Edit: 3 Oct '23 - 18:59 by radio42 »

GTHvidsten

  • Posts: 29
Thanks. Now the entire tag is ready, but the two backslashes are replaced with a semicolon and a space. I can work with that, but why does it transform them like that?

I can see that Windows also displays them as a semicolon (when looking at the properties of the music file), but in Mp3tag they are listed as two backslashes, so you're consistent with Windows, at least.

radio42

  • Posts: 4834
The native TAGs do NOT contain any backslashes!
FLAC is using OGG comments, like referenced in my previous post. Other TAG formats do use other formats. FLAC is not using ID3.

The backslashes are used only in the application MP3Tag, which you might be using?

Bass.Net however separates multiple entries with a semicolon.

GTHvidsten

  • Posts: 29
I think I understand now:
I expected the tag in the file to be a single string, but it is instead a collection of multiple strings separated by "something".
Mp3tag separates them by two backslashes. Windows separates them by a semicolon + space. 2.4.17.4 also now separates them by a semicolon + space.

Thanks for the quick turnaround and explanations :)

radio42

  • Posts: 4834
Depending of the TAG format, it is not even a collection of strings, but rather a quite complex structure ;-)

Here is for example the ID3v2 structure: https://mutagen-specs.readthedocs.io/en/latest/id3/id3v2.2.html
The OGG structure I did already send around previously...