Sign in to follow this  
Followers 0
grasshopper3

MP3 Tagging

3 posts in this topic

I am trying to create a script that auto moves an album based on the ID3 Tags. I tried using the ID3 UDF but it inconsistent. What is the best Tagging program that can be automated in the background. I like command line the best. So one has to have done this. Please help. Thanks.

Share this post


Link to post
Share on other sites



Try this: http://www.autoitscript.com/forum/index.php?showtopic=25859


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

This worked great for reading the tag information, but I want to be able to edit the ID3 tags. I tried using the ID3.au3 but I couldn't get it to write the ID3 tags. I even copied some code out of the ID3_Example_GUI.au3 that I found in the forums. Can someone please tell me how they have successfully been able to read and write ID3 tags. Someone has to have been able to successfully and reliably read and write ID3 tags.

Here is what I have tried, but doesn't seem to work...

;MP3 Tagging
#include "ID3.au3"
#include "ExtProp.au3"


Local $Source = @ScriptDir & '\Test_Files'

Local $BaseMusicArr[1][2], $BaseArrSize=0
Local $MusicInfoArr[1][8]
Local $TagMod=False
     
__FolderScan_Mp3($Source,$BaseMusicArr,$BaseArrSize)
_ArrayDisplay($BaseMusicArr)

;Retrieve TAG Information From MP3 Files
For $iCount=0 to UBound($BaseMusicArr)-1
    
;~  _ArrayDisplay(_GetExtProperty($BaseMusicArr[$iCount][1],-1),'extended properties')
    $ExtPropArr = _GetExtProperty($BaseMusicArr[$iCount][1],-1)
    $MP3Tags = _ID3ReadTag($BaseMusicArr[$iCount][1])
    
    ;Resize and Populate Music Track Information Array
    ReDim $MusicInfoArr[$iCount+1][8]
    $MusicInfoArr[$iCount][0] = _ID3GetTagField("TPE1") ;Artist
    $MusicInfoArr[$iCount][1] = _ID3GetTagField("TALB") ;Album
    $MusicInfoArr[$iCount][2] = _ID3GetTagField("TYER") ;Year
    $MusicInfoArr[$iCount][3] = _ID3GetTagField("COMM") ;Comment
    $MusicInfoArr[$iCount][4] = _ID3GetTagField("TIT2") ;Track Title
    $MusicInfoArr[$iCount][5] = _ID3GetTagField("TCON") ;Genre
    $MusicInfoArr[$iCount][6] = $BaseMusicArr[$iCount][1] ;Full File Path
    
    ;Artist
    If $MusicInfoArr[$iCount][0]<>'' And $MusicInfoArr[$iCount][0]<>$ExtPropArr[16] Then
        _ID3SetTagField("TPE1",$MusicInfoArr[$iCount][0])
        _ID3SetTagField("Artist",$MusicInfoArr[$iCount][0])
        $TagMod=True
    EndIf
    
    ;Album
    If $MusicInfoArr[$iCount][1]<>'' And $MusicInfoArr[$iCount][1]<>$ExtPropArr[17] Then
        _ID3SetTagField("TALB",$MusicInfoArr[$iCount][1])
        _ID3SetTagField("Album",$MusicInfoArr[$iCount][1])
        $TagMod=True
    EndIf
    
    ;Track Title
    If $MusicInfoArr[$iCount][4]<>'' And $MusicInfoArr[$iCount][4]<>$ExtPropArr[10] Then
        _ID3SetTagField("TIT2",$MusicInfoArr[$iCount][4])
        _ID3SetTagField("Track",$MusicInfoArr[$iCount][4])
        $TagMod=True
    EndIf
    
    If $TagMod=True Then
        _ID3WriteTag($MusicInfoArr[$iCount][6])
        $TagMod=False
    EndIf
Next
    _ArrayDisplay($MusicInfoArr)

Func __FolderScan_Mp3($SourceDir,ByRef $BaseMusicArr, ByRef $BaseArrSize)
    Local $Search,$File,$FileAttributes,$SourceFolder,$FullFilePath
    
    $SourceFolder = $SourceDir ;********************************************************* Search Folder
    $Search = FileFindFirstFile($SourceFolder & "\*.*")  ;  ***************** Search Filter
    
    $FullFilePath = $SourceFolder & "\" & $File
    
    While 1
        If $Search = -1 Then
            ExitLoop
        EndIf
        
        $File = FileFindNextFile($Search)
        If @error Then ExitLoop
        
        $FullFilePath = $SourceFolder & "\" & $File
        $FileAttributes = FileGetAttrib($FullFilePath)
        
        If StringInStr($FileAttributes,"D") Then
            __FolderScan_Mp3($FullFilePath,$BaseMusicArr,$BaseArrSize)
        Else
            If StringRight($File,4)=".mp3" Then
                ;Set Time Stamp To Current Time
                FileSetTime($FullFilePath,'')
                
                ;Resize and Add File to Array
                ReDim $BaseMusicArr[$BaseArrSize+1][2]
                $BaseMusicArr[$BaseArrSize][0] = $File
                $BaseMusicArr[$BaseArrSize][1] = $FullFilePath
                $BaseArrSize+=1
            EndIf
        EndIf
    WEnd
    FileClose($Search)
    Return
EndFunc

Share this post


Link to post
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
Sign in to follow this  
Followers 0