mp3-ausgabe

  • Allgemein

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • servus,
    hab da ne frage.
    hab mir mit folgendem befehl in cmd eine liste gemacht, mit allen mp3 die auf meinem laufwerk sind:
    d:
    cd\
    dir /s *.mp3 >> c:\mp3.txt

    allerdeinf will ich in dieser liste jetzt auch noch tag-infos wie zum bespiel jahr, dauer größe oder sowas haben.
    was muss ich da machen?
    kennst sich da jemand aus?
    danke im voraus,
    mfg,
    saubens
  • VB.NET Beispiel für einen Tag Editor

    Erstelle eine Visual Basic.NET 2005 Anwendung und ersetzt den Standard Code mit dem hier

    Public Class Form1
    Inherits System.Windows.Forms.Form
    Private TE As New Tag_Editor
    #Region " Windows Form Designer generated code "

    Public Sub New()
    MyBase.New()

    'This call is required by the Windows Form Designer.
    InitializeComponent()

    'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
    If disposing Then
    If Not (components Is Nothing) Then
    components.Dispose()
    End If
    End If
    MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    Friend WithEvents Artist As System.Windows.Forms.TextBox
    Friend WithEvents Album As System.Windows.Forms.TextBox
    Friend WithEvents Year As System.Windows.Forms.TextBox
    Friend WithEvents Genre As System.Windows.Forms.ComboBox
    Friend WithEvents Comments As System.Windows.Forms.TextBox
    Friend WithEvents Save As System.Windows.Forms.Button
    Friend WithEvents OFD As System.Windows.Forms.OpenFileDialog
    Friend WithEvents TName As System.Windows.Forms.TextBox
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents SFD As System.Windows.Forms.SaveFileDialog
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
    Me.TName = New System.Windows.Forms.TextBox
    Me.Artist = New System.Windows.Forms.TextBox
    Me.Album = New System.Windows.Forms.TextBox
    Me.Year = New System.Windows.Forms.TextBox
    Me.Genre = New System.Windows.Forms.ComboBox
    Me.Comments = New System.Windows.Forms.TextBox
    Me.Save = New System.Windows.Forms.Button
    Me.OFD = New System.Windows.Forms.OpenFileDialog
    Me.Button1 = New System.Windows.Forms.Button
    Me.SFD = New System.Windows.Forms.SaveFileDialog
    Me.SuspendLayout()
    '
    'TName
    '
    Me.TName.Location = New System.Drawing.Point(16, 8)
    Me.TName.MaxLength = 30
    Me.TName.Name = "TName"
    Me.TName.Size = New System.Drawing.Size(184, 20)
    Me.TName.TabIndex = 0
    Me.TName.Text = "Name"
    '
    'Artist
    '
    Me.Artist.Location = New System.Drawing.Point(16, 40)
    Me.Artist.MaxLength = 30
    Me.Artist.Name = "Artist"
    Me.Artist.Size = New System.Drawing.Size(184, 20)
    Me.Artist.TabIndex = 1
    Me.Artist.Text = "Artist"
    '
    'Album
    '
    Me.Album.Location = New System.Drawing.Point(16, 72)
    Me.Album.MaxLength = 30
    Me.Album.Name = "Album"
    Me.Album.Size = New System.Drawing.Size(184, 20)
    Me.Album.TabIndex = 2
    Me.Album.Text = "Album"
    '
    'Year
    '
    Me.Year.Location = New System.Drawing.Point(16, 104)
    Me.Year.MaxLength = 4
    Me.Year.Name = "Year"
    Me.Year.Size = New System.Drawing.Size(184, 20)
    Me.Year.TabIndex = 3
    Me.Year.Text = "Year"
    '
    'Genre
    '
    Me.Genre.Location = New System.Drawing.Point(16, 136)
    Me.Genre.Name = "Genre"
    Me.Genre.Size = New System.Drawing.Size(184, 21)
    Me.Genre.TabIndex = 4
    Me.Genre.Text = "Genre"
    '
    'Comments
    '
    Me.Comments.Location = New System.Drawing.Point(16, 168)
    Me.Comments.MaxLength = 30
    Me.Comments.Name = "Comments"
    Me.Comments.Size = New System.Drawing.Size(184, 20)
    Me.Comments.TabIndex = 5
    Me.Comments.Text = "Comments"
    '
    'Save
    '
    Me.Save.Location = New System.Drawing.Point(16, 200)
    Me.Save.Name = "Save"
    Me.Save.Size = New System.Drawing.Size(184, 24)
    Me.Save.TabIndex = 6
    Me.Save.Text = "Save Tag"
    '
    'Button1
    '
    Me.Button1.Location = New System.Drawing.Point(16, 232)
    Me.Button1.Name = "Button1"
    Me.Button1.Size = New System.Drawing.Size(184, 24)
    Me.Button1.TabIndex = 7
    Me.Button1.Text = "Open Tag"
    '
    'Form1
    '
    Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
    Me.ClientSize = New System.Drawing.Size(216, 262)
    Me.Controls.Add(Me.Button1)
    Me.Controls.Add(Me.Save)
    Me.Controls.Add(Me.Comments)
    Me.Controls.Add(Me.Genre)
    Me.Controls.Add(Me.Year)
    Me.Controls.Add(Me.Album)
    Me.Controls.Add(Me.Artist)
    Me.Controls.Add(Me.TName)
    Me.Name = "Form1"
    Me.Text = "Tag Editor"
    Me.ResumeLayout(False)

    End Sub

    #End Region


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim i As Byte
    For i = 0 To TE.Genres.GetUpperBound(0)
    Genre.Items.Add(TE.Genres(i))
    Next
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim Result As DialogResult
    OFD.Filter = "MP3`s (*.mp3)|*.mp3"
    result = OFD.ShowDialog()
    If Result = Windows.Forms.DialogResult.OK Then
    TE.FileName = OFD.FileName
    TE.GetTag()
    TName.Text = TE.TrackName
    Artist.Text = TE.Artist
    Album.Text = TE.Album
    Year.Text = TE.Year
    Comments.Text = TE.Comments
    Genre.SelectedIndex = TE.Style
    End If
    End Sub

    Private Sub Save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Save.Click
    TE.TrackName = TName.Text
    TE.Artist = Artist.Text
    TE.Album = Album.Text
    TE.Year = Year.Text
    TE.Comments = Comments.Text
    TE.Style = Genre.SelectedIndex
    Try
    TE.SaveTag()
    Catch ex As Exception
    MsgBox("Unable To Save Tag")
    End Try

    End Sub

    End Class

    -CLASS2-HIER

    Imports System.IO
    Imports System.Text
    Imports System.Text.ASCIIEncoding
    Public Class Tag_Editor

    #Region " Decs "
    Private PFileName As String
    Private Name(30) As Byte
    Private Art(30) As Byte
    Private Alb(30) As Byte
    Private Yea(4) As Byte
    Private Genre(1) As Byte
    Private Comms(30) As Byte
    Private Tag() As Byte = {84, 65, 71}
    Private FS As FileStream
    Private RT(127) As Byte
    Private Open As Boolean = False
    Private I As Byte
    Public Genres As String() = {"Blues", "Classic Rock", "Country", "Dance", "Disco", "Funk", "Grunge", _
    "Hip-Hop", "Jazz", "Metal", "New Age", "Oldies", "Other", "Pop", "R&B", "Rap", "Reggae", "Rock", "Techno", "Industrial", _
    "Alternative", "Ska", "Death Metal", "Pranks", "Soundtrack", "Euro-Techno", "Ambient", "Trip-Hop", "Vocal", "Jazz+Funk", _
    "Fusion", "Trance", "Classical", "Instrumental", "Acid", "House", "Game", "Sound Clip", "Gospel", "Noise", _
    "AlternRock", "Bass", "Soul", "Punk", "Space", "Meditative", "Instrumental Pop", "Instrumental Rock", "Ethnic", "Gothic", _
    "Darkwave", "Techno-Industrial", "Electronic", "Pop-Folk", "Eurodance", "Dream", "Southern Rock", "Comedy", "Cult", "Gangsta", _
    "Top 40", "Christian Rap", "Pop/Funk", "Jungle", "Native American", "Cabaret", "New Wave", "Psychadelic", "Rave", "Showtunes", _
    "Trailer", "Lo-Fi", "Tribal", "Acid Punk", "Acid Jazz", "Polka", "Retro", "Musical", "Rock & Roll", "Hard Rock", _
    "Folk", "Folk-Rock", "National Folk", "Swing", "Fast Fusion", "Bebob", "Latin", "Revival", "Celtic", "Bluegrass", _
    "Avantgarde", "Gothic Rock", "Progressive Rock", "Psychedelic Rock", "Symphonic Rock", "Slow Rock", "Big Band", "Chorus", "Easy Listening", "Acoustic", _
    "Humour", "Speech", "Chanson", "Opera", "Chamber Music", "Sonata", "Symphony", "Booty Bass", "Primus", "Porn Groove", _
    "Satire", "Slow Jam", "Club", "Tango", "Samba", "Folklore", "Ballad", "Power Ballad", "Rhythmic Soul", "Freestyle", _
    "Duet", "Punk Rock", "Drum Solo", "A capella", "Euro-House", "Dance Hall"}
    #End Region


    Public Property FileName()
    Get
    Return PFileName
    End Get
    Set(ByVal value)
    PFileName = value

    End Set
    End Property

    Sub GetTag()
    Try
    If PFileName = vbNullString Then
    MsgBox("File Name Must Be Set First")
    Exit Sub
    End If
    FS = New FileStream(PFileName, FileMode.Open, FileAccess.Read)
    FS.Seek(-128, SeekOrigin.End)
    FS.Read(RT, 0, 128)
    If ASCII.GetString(RT, 0, 3) = "TAG" Then
    Open = True
    Else
    Open = False
    MsgBox("No Tag Info Available", MsgBoxStyle.OkOnly, "No Info")
    End If
    Catch ex As Exception
    Open = False
    MsgBox(Err.Description)
    Finally
    FS.Close()
    End Try
    End Sub

    Public Property TrackName() As String
    Get
    If Open Then
    Return ASCII.GetString(RT, 3, 30).Trim
    Else
    Return ""
    End If

    End Get
    Set(ByVal Value As String)
    If Value = "" Then Value = " "
    For I = 0 To Value.Length - 1
    Name(I) = Asc(Value.Substring(I, 1))
    Next
    End Set
    End Property

    Public Property Artist() As String
    Get
    If Open Then
    Return ASCII.GetString(RT, 33, 30).Trim
    Else
    Return ""
    End If
    End Get
    Set(ByVal value As String)
    If value = "" Then value = " "
    For I = 0 To value.Length - 1
    Art(I) = Asc(value.Substring(I, 1))
    Next

    End Set
    End Property

    Public Property Album() As String
    Get
    If Open Then
    Return ASCII.GetString(RT, 63, 30).Trim
    Else
    Return ""
    End If
    End Get
    Set(ByVal value As String)
    If value = "" Then value = " "
    For I = 0 To value.Length - 1
    Alb(I) = Asc(value.Substring(I, 1))
    Next
    End Set
    End Property

    Public Property Year() As String
    Get
    If Open Then
    Return ASCII.GetString(RT, 93, 4).Trim
    Else
    Return ""
    End If
    End Get
    Set(ByVal value As String)
    If value = "" Then value = " "
    For I = 0 To value.Length - 1
    Yea(I) = Asc(value.Substring(I, 1))
    Next
    End Set

    End Property

    Public Property Comments() As String
    Get
    If Open Then
    Return ASCII.GetString(RT, 97, 30).Trim
    Else
    Return ""
    End If
    End Get
    Set(ByVal value As String)
    If value = "" Then value = " "
    For I = 0 To value.Length - 1
    Comms(I) = Asc(value.Substring(I, 1))
    Next
    End Set

    End Property

    Public Property Style()
    Get
    If Open Then
    Return RT(127)
    Else
    Return ""
    End If
    End Get
    Set(ByVal value)
    If value = -1 Then value = 0
    Genre(1) = value
    End Set
    End Property

    Function SaveTag() As Boolean
    FS = New FileStream(PFileName, FileMode.Open, FileAccess.ReadWrite)
    FS.Seek(-128, SeekOrigin.End)
    FS.Read(RT, 0, 3)
    If ASCII.GetString(RT, 0, 3) = "TAG" Then
    FS.Seek(-125, SeekOrigin.End)
    FS.Write(Name, 0, UBound(Name))
    FS.Write(Art, 0, UBound(Art))
    FS.Write(Alb, 0, UBound(Alb))
    FS.Write(Yea, 0, 4)
    FS.Write(Comms, 0, UBound(Comms))
    FS.Write(Genre, 0, 1)

    Else
    FS.Write(Tag, 0, 3)
    FS.Write(Name, 0, UBound(Name))
    FS.Write(Art, 0, UBound(Art))
    FS.Write(Alb, 0, UBound(Alb))
    FS.Write(Yea, 0, 4)
    FS.Write(Comms, 0, UBound(Comms))
    FS.Write(Genre, 0, 1)
    End If
    FS.Close()
    End Function
    End Class