DeFlaaj Posted April 22, 2024 Posted April 22, 2024 Hello, 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 expandcollapse popupFunc ReadID3Tags() $sFileTagInfo = _ID3ReadTag($sAudioFilePath) ;MsgBox(0,"$sFileTagInfo",$sFileTagInfo) $sTrackTitle = _ID3GetTagField("TIT2") If StringLen($sTrackTitle) = 0 Then $sTrackTitle = _ID3GetTagField("Title") EndIf $sTrackArtist = _ID3GetTagField("TPE1") If StringLen($sTrackArtist) = 0 Then $sTrackArtist = _ID3GetTagField("Artist") EndIf $sTrackAlbum = _ID3GetTagField("TALB") If StringLen($sTrackAlbum) = 0 Then $sTrackAlbum = _ID3GetTagField("Album") EndIf $sTrackYear = _ID3GetTagField("TYER") If StringLen($sTrackYear) = 0 Then $sTrackYear = _ID3GetTagField("Year") EndIf Sleep(20) 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) EndFunc 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) EndFunc Func AddToPlaylist() MsgBox(0, "id3", $aAudioFile[3][$nAudioFilePosY] & " - " & $aAudioFile[2][$nAudioFilePosY] & "|" & $nTrackLengthSecondsRound) Local $sPlaylistItem = $sTrackArtist & " - " & $sTrackTitle & "|" & $nTrackLengthSecondsRound Local $Item1 = GUICtrlCreateListViewItem($sPlaylistItem, $idListView_Playlist) EndFunc
KaFu Posted April 22, 2024 Posted April 22, 2024 I'd like to take a look, but please provide a running reproducer with includes and a sample mp3 you have problems with. ioa747 1 OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2025-May-18) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
DeFlaaj Posted April 23, 2024 Author Posted April 23, 2024 Indeed. It also uses ffmpeg.exe but it's not relevant for this issue. The issue happens with basically all files from bandcamp. Thank you! The Future Sound Of London - Environment 6.5 - 01 Axis of Rotation.mp3 chaika.zip
Solution Andreik Posted April 23, 2024 Solution Posted April 23, 2024 It looks like you have a null char at the end of the string. You can do something like this to delete all trailing null chars: $sTrackArtist = BinaryToString(StringRegExpReplace(StringToBinary($sTrackArtist), '(00)+$', '')) MsgBox(0, "id3", $sTrackArtist & " - " & $sTrackTitle)
DeFlaaj Posted April 23, 2024 Author Posted April 23, 2024 That's right Didn't know this exists. Thank you so much!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now