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
460 stars 61 forks source link

Strings in ID3v2.4 tags too long? #234

Closed kafffee closed 11 months ago

kafffee commented 11 months ago

Hello :-)

I ran into a little problem and hope you can help me:

my application does add and also read ID3v2.4 tags to mp3-files with z440.atl.core version 4.9.0 on Windows 10.

It seemed to be working at first, but when strings for artist and album are gettting too long, it seems to be returning empty strings for any "property" (artist, album, title, genre etc.) when trying to read.

Writing of the same files before seems to work properly though, I tested with the default music app on my android phone and with MP3Tag on Windows 10.

Is there something like a maximum string length or something like that?

Or do you need ATL.Logging.Log? Where can I find it?

I have tried this on about 500 files, and the issue happens only when strings for artist and album are pretty long.

This is my code (VB.Net Framework 4.8):

For i = 0 To ExistingFiles.Count - 1
    Dim FileMp3WithPath = ExistingFiles(i)

    Dim MyTrack As ATL.Track = New ATL.Track(FileMp3WithPath)

    Dim Artist As String = MeinTrack.Artist
    Dim Album As String = MeinTrack.Album
    Dim Title As String = MeinTrack.Title
    Dim Genre As String = MeinTrack.Genre

    If Artist = "" Then Artist = "[Unknown Artist]"
    If Album = "" Then Album = "[Unknown Album]"
    If Title = "" Then Title = "[" & System.IO.Path.GetFileName(ExistingFiles(i)) & "]"
    If Genre = "" Then Genre = "[Unknown Genre]"

    MainModule.Content.Add(New ViewModel.MP3FileInfoVM(ExistingFiles(i), Tracknumber, Artist, Album, Title, TimeSpan.FromSeconds(CDbl(MyTrack.Duration)), MyTrack.Year, False, Genre, False, "", 0, "", ""))
Next

Greetings, kafffee

nlogozzo commented 11 months ago

Did you mean Version 5.9.0 (the current stable)?

If not, version 4.9.0 is a very old release and a newer version may have fixed this issue with the reactors done since that version. I recommend updating and trying the latest release.

Zeugma440 commented 11 months ago

I agree with @nlogozzo : v4.9.0 is more than 12 months old and should be abandoned in favour of more recent releases.

If you do mean v5.9.0, I need one of these files with very very long strings to be able to test with it.

Could you send a link to [my github username] at not-cold mail dot com please?

kafffee commented 11 months ago

Hey guys,

thanks for the quick response.

I'm actually currently using version 4.9.0 of the nuget package.

The problem is that 5.9.0 will not work with .NET Framework 4.8, am I right?

So which version should I use (is there a rather current version that will work with 4.8?)

I tried to send you a download link, but the email returned saying that the domain "not-coldmail.com" does not exist, I guess I interpreted that wrong...

Zeugma440 commented 11 months ago

The problem is that 5.9.0 will not work with .NET Framework 4.8, am I right?

Absolutely

So which version should I use (is there a rather current version that will work with 4.8?)

You could at least try with the latest version of the v4.x series, i.e. v4.36

I'm quite surprised that you're actually constrainted by .NET 4.8, which is super old and now unsupported by Microsoft. Is there a specific reason why you cannot migrate to .NET 6?

I tried to send you a download link...

not-cold was supposed to mean hot πŸ˜…

kafffee commented 11 months ago

Okay version 4.36 does not work either.

I'm quite surprised that you're actually constrainted by .NET 4.8, which is super old and now unsupported by Microsoft. Is there a specific reason why you cannot migrate to .NET 6?

Yes I am only programming in my spare time, and it is a huge project (I have started about 28 months ago), so this took me some time. I was already at a point where I wanted to switch to a newer framework, and I actually tried that but I got like a thousand errors. So I asked in a VB.NET forum for some help but I was told to keep my hands of such actions as a beginner...

not-cold was supposed to mean hot πŸ˜…

Okay for the slow ones haha lol... Now I got it...

I just sent you a link to file where the "error" happpens...

Zeugma440 commented 11 months ago

I tried to read the file you sent with ATL v4.36. Got as much information as Mp3tag and MediaInfo found :

image

I fear I'm gonna need a bit more details from you. What exactly should I be doing to trigger the bug you reported?

Zeugma440 commented 11 months ago

I was already at a point where I wanted to switch to a newer framework, and I actually tried that but I got like a thousand errors

ouch... now I understand πŸ˜… Good luck with that. I'll publish a special release for you when we manage to pinpoint and fix what you reported.

kafffee commented 11 months ago

Awesome :-)

There*s another issue, too, maybe this has to do with it, maybe not, but this might help you figure out whats wrong:

My app won't start playback of these files either. I get the error that the file does not exist (System.IO.File.Exists). So I told my debugger to write a line in the debugger output with the file name, copied and pasted that file name into the textbox up top in Windows Explorer and: Its being found and played with the default Windows 10 media player...

Weird, isnt it? I'll let you know whats wrong with that in case I can figure that out...

Zeugma440 commented 11 months ago

What you're describing is super weird, indeed, but it's not a problem from the library. Sounds like a credentials issue.

kafffee commented 11 months ago

Okay, good to know. What extactly do you mean by credentials? I'm not a native English speaker and the google translator won't return a usable translation...

What exactly should I be doing to trigger the bug you reported?

Try to read the tags of the file I sent you with the z440.atl.core library. I only get empty strings for artist, album, etc. ...

Zeugma440 commented 11 months ago

Try to read the tags of the file I sent you with the z440.atl.core library. I only get empty strings for artist, album, etc. ...

I just created a brand new .NET 4.8 console project, added the ATL v4.36 NuGet dependency, then ran the following code

using System;

namespace ConsoleApp1
{
    internal class Program
    {
        static void Main(string[] args)
        {
            var track = new ATL.Track(@"D:\temp\id3v2\234\01GENT_1.MP3");
            Console.WriteLine("title : " + track.Title);
            Console.WriteLine("artist : " + track.Artist);
            Console.WriteLine("album : " + track.Album);
            Console.WriteLine("genre : " + track.Genre);
            Console.ReadLine();
        }
    }
}

image

=> I'm less and less sure the problem comes from the library. Have you checked if your UI has display issues when data gets too long?

You should also try to display the ATL log, if may help. On v4.x :

new ConsoleLogger();

What exactly do you mean by credentials? I'm not a native English speaker and the google translator won't return a usable translation...

Credentials are access rights. Maybe your issue has something to do with the rights your app has over the folders you're using.

kafffee commented 11 months ago

I had anoher idea and looks like this was the right one:

The path name is too long. I also checked for the file name, but it's the path name. I wrote a little test program:

Option Strict On
Module Module1

    Sub Main()
        Dim FileName = "β€ͺC:\Users\admin\Music\reggae\Gentleman\Gentleman And The Far East Band - The Cologne Session 2003 Live\Gentleman And The Far East Band - The Cologne Session 2003 Live (CD 2) - 01 Gentleman And The Far East Band feat. Tamika And Mamadee - The Cologne Session 2003 Live (CD 2) - Good Days.mp3"
        Dim PathNameLength = FileName.Length
        Dim FileNameLength = System.IO.Path.GetFileName(FileName).Length
        Dim FileNameExists = System.IO.File.Exists(FileName)
        Console.WriteLine("File exists: " & FileNameExists)
        Console.WriteLine("Length of file name: " & FileNameLength)
        Console.WriteLine("Length if path name: " & PathNameLength)
        Dim MyTrack = New ATL.Track(FileName)
        Console.WriteLine("Artist: " & MyTrack.Artist)
        Console.WriteLine("Album: " & MyTrack.Album)
        Console.WriteLine("Title: " & MyTrack.Title)
        Console.WriteLine("Genre: " & MyTrack.Genre)
        Console.ReadLine()
    End Sub

End Module

So what can we do to fix this? Can we do something at all? The weird thing is that creating/ tagging the file was not a problem...

nlogozzo commented 11 months ago

So what can we do to fix this? Can we do something at all? The weird thing is that creating/ tagging the file was not a problem...

There's nothing ATL can do since it's a file system/path issue...It is too long

Take a look at this to see how you can handle it in your project: https://stackoverflow.com/a/5188559

.NET Core fixes this issue...only affects .NET Framework ... might be time to look into upgrading lol

kafffee commented 11 months ago

Okay, so that's still good news for both of us πŸ˜„

You dont have to fix anything and I know what's up πŸ˜‚

Thanks for the support anyways guys, have a nice week πŸ˜€

Zeugma440 commented 11 months ago

Thanks @nlogozzo for handling this ;)

Thanks for the support anyways guys, have a nice week

You're welcome !