Jump to content

ID3 tags act weird

Go to solution Solved by Andreik,

Recommended Posts


Experiencing strange behavior when I get ID3 tags from certain files. (using ID3_v3.4.au3)
It works fine with most of the files but in certain repeatable cases, it loads only the artist tag... But not really:

In MsgBox, it only shows artist tag and no title tag. Not even the " - " text (weird!) nor total time
In Playlist, it does the same thing.
In Label, it shows both artist and title tag and current/total time correctly.
In ConsoleWrite, all values are also shown correctly. Although, in 'Solid Earth' case and similar, it writes the tags in the same row:

$sTrackArtist: The Future Sound Of London$sTrackTitle: Solid Earth$sTrackArtist: Ty Segall
$sTrackTitle: Imaginary Person

Cannot wrap my head around it...

Thanks for your help

Func ReadID3Tags()
    $sFileTagInfo = _ID3ReadTag($sAudioFilePath)
    $sTrackTitle = _ID3GetTagField("TIT2")
        If StringLen($sTrackTitle) = 0 Then
            $sTrackTitle = _ID3GetTagField("Title")
    $sTrackArtist = _ID3GetTagField("TPE1")
        If StringLen($sTrackArtist) = 0 Then
            $sTrackArtist = _ID3GetTagField("Artist")
    $sTrackAlbum = _ID3GetTagField("TALB")
        If StringLen($sTrackAlbum) = 0 Then
            $sTrackAlbum = _ID3GetTagField("Album")
    $sTrackYear = _ID3GetTagField("TYER")
        If StringLen($sTrackYear) = 0 Then
            $sTrackYear = _ID3GetTagField("Year")
    GUICtrlSetData($idLabel_ArtistName, StringUpper($sTrackArtist))
    GUICtrlSetData($idLabel_TrackName, StringUpper($sTrackTitle))
        ; Debugging messages
    ConsoleWrite("$sTrackArtist: " & $sTrackArtist & @CRLF)
    ConsoleWrite("$sTrackTitle: " & $sTrackTitle & @CRLF)
    MsgBox(0, "id3", $sTrackArtist & " - " & $sTrackTitle)

Func GetTrackProperties()
    $nTrackLengthBytes   = _BASS_ChannelGetLength($hAudioFile, $BASS_POS_BYTE)
    $nTrackLengthSeconds = _BASS_ChannelBytes2Seconds($hAudioFile, $nTrackLengthBytes)
    $nTrackLengthSecondsRound = Round($nTrackLengthSeconds, 0)
    GUICtrlSetData($idLabel_TrackPosAndLength, $nTrackCurrPosSecondsRound & " / " & $nTrackLengthSecondsRound)
    GUICtrlSetData($idLabel_TrackPosAndLengthBytes, $nTrackCurrPosBytes & " / " & $nTrackLengthBytes)

Func AddToPlaylist()
    MsgBox(0, "id3", $aAudioFile[3][$nAudioFilePosY] & " - " & $aAudioFile[2][$nAudioFilePosY] & "|" & $nTrackLengthSecondsRound)
    Local $sPlaylistItem = $sTrackArtist & " - " & $sTrackTitle & "|" & $nTrackLengthSecondsRound
    Local $Item1 = GUICtrlCreateListViewItem($sPlaylistItem, $idListView_Playlist)




Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...