Qid3Tag Component

With this component you can read / write id3 tags ver 1.x . It offers a combobox for genre selection too.

Qid3Tag Methods

Field Type R/W Notes Support





Filename STRING RW W
Title STRING RW   W
Artist STRING RW W
Album STRING RW W
Year STRING RW W
Comment STRING RW   W
Track BYTE RW   W
Genre STRING RW   W
Genreid BYTE RW W
GenresList QSTRINGLIST R Used internally (do not touch if you don't know what you're doing) W
GenresCB QCOMBOBOX RW Be sure it has a parent before any action !! W

 

Qid3Tag Methods

Method Type Description Params Support





ReadTags SUB Reads id3 Tags 0 W
WriteTags SUB Writes id3 Tags 0 W
Loadlist SUB Loads genres list into GenresCB. Be careful... you MUST assign a parent to GenresCB before you use this function.    
Fitlength FUNCTION (FitTag$, FitLen%) External. Adds null characters to a text string until it reaches specified length. Cuts the string if the string length exceeds the specified length. 2 W

 

Qid3Tag Events

Event Type Occurs when... Params Support





 None        

 

Qid3Tag Examples

$include "Qid3tag.inc"

declare sub ReadClickedFile
declare sub UpdateTags

CREATE Form AS QFORM
    Caption = "Qid3Tag example"
    Width = 381
    Height = 244
    Center
    CREATE Label1 AS QLABEL
        Caption = "Title"
        Left = 176
        Top = 24
        Transparent = 1
    END CREATE
    CREATE Label2 AS QLABEL
        Caption = "Artist"
        Left = 176
        Top = 56
        Transparent = 1
    END CREATE
    CREATE Label3 AS QLABEL
        Caption = "Album"
        Left = 176
        Top = 88
        Transparent = 1
    END CREATE
    CREATE Label4 AS QLABEL
        Caption = "Year"
        Left = 176
        Top = 120
        Transparent = 1
    END CREATE
    create tnlabel as qlabel
        caption = "Track"
        left = 292
        top = 120
        transparent = 1
    end create
    CREATE Label5 AS QLABEL
        Caption = "Comment"
        Left = 176
        Top = 152
        Width = 48
        Transparent = 1
    END CREATE
    CREATE Label6 AS QLABEL
        Caption = "Genre"
        Left = 176
        Top = 184
        Transparent = 1
    END CREATE
    CREATE FileListBox AS QFILELISTBOX
        Left = 6
        Top = 13
        Height = 137
        Directory = ".\"
        onclick = ReadClickedFile
    END CREATE
    CREATE ed_title AS QEDIT
        Left = 232
        Top = 16
    END CREATE
    CREATE ed_artist AS QEDIT
        Left = 232
        Top = 48
    END CREATE
    CREATE ed_album AS QEDIT
        Left = 232
        Top = 80
    END CREATE
    CREATE ed_year AS QEDIT
        Left = 232
        Top = 112
        width = 40
    END CREATE
    create ed_track as qedit
        left = 332
        top = 112
        width = 20
    end create
    CREATE ed_comment AS QEDIT
        Left = 232
        Top = 144
    END CREATE
    CREATE ed_genre AS QEDIT
        Left = 232
        Top = 176
    END CREATE
    CREATE Button1 AS QBUTTON
        Caption = "Write"
        Left = 5
        Top = 160
        Width = 147
       onclick = UpdateTags
    END CREATE
END CREATE

dim mp3 as qid3tag
'The following code adds the GenresCB. It's optional
mp3.genrescb.parent = form
mp3.genrescb.top = 190
mp3.genrescb.left = 6
mp3.loadlist               'use this one to load genres list into GenresCB


Form.ShowModal


sub ReadClickedFile
mp3.filename = Filelistbox.filename
mp3.readtags
mp3.genrescb.itemindex = mp3.genreid
ed_title.text = mp3.title
ed_artist.text = mp3.artist
ed_album.text = mp3.album
ed_year.text = mp3.year
ed_comment.text = mp3.comment
ed_track.text = str$(mp3.track)
ed_genre.text = mp3.genre
end sub

Sub UpdateTags
mp3.title = ed_title.text
mp3.artist = ed_artist.text
mp3.album = ed_album.text
mp3.year = ed_year.text
mp3.comment = ed_comment.text
mp3.track = val(ed_track.text)
mp3.genreid = mp3.genrescb.itemindex     'Pay attention, you have to give a valid genre id (BYTE),
                                         'so you cannot pass mp3.genre (which is a STRING)
mp3.writetags
end sub

Hosted by uCoz