Rahul Soni's blog

Never assume the obvious is true!

Copying Winamp's playlist songs to any other folder for copying to CD etc

Copying Winamp's playlist songs to any other folder for copying to CD etc

  • Comments 1

Well, to begin with... let me tell you my problem which led me to create this very simple application. Actually, I have quite a lot of songs on my Hard Drives (who doesn't ;o) ???) and used to create organized playlists for all those songs littered across my hard-drive partitions. Now one fine day, I wanted to copy songs in my different playlists and burn CDs so that I could mark them accordingly. Yeah.... very simple requirement, but when I thought of all those thousands of files needed to be copied manually, I started getting goosebumps and wrote this Application for a simple objective...

"Parse my m3u files (Winamp Playlists) and copy all the MP3s to any folder which I specify, so that I could burn a CD based on my Playlist!"

Okay, lets get started.
1)
Create a blank Project in VB6 and delete the Form1.vb
2) Create a new text file with an name "frmMain.frm" in the Folder where you want to save your project.
3) Now, open the frmMain.frm in Notepad, paste the following code, save the file and add this form in your VB Project.
4) The logic to parsed might not be perfect but works well for me. I was able to see all the files in the playlist collected at the destination folder. I have fixed the code for some of the files which were located in "My Documents" folder. For some reason Winamp does not adds "C:\" to the files in the playlist. Open any *.M3U file in Notepad and you will come to know about it. 
5) Let me know if you need any help.

VERSION 5.00
Begin VB.Form frmMain
   Caption         =   "Winamp Playlist Copier"
   ClientHeight    =   8550
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   9810
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   ScaleHeight     =   8550
   ScaleWidth      =   9810
   StartUpPosition =   3  'Windows Default
   Begin VB.TextBox txtOutPut
      Height          =   3345
      Left            =   180
      Locked          =   -1  'True
      MultiLine       =   -1  'True
      ScrollBars      =   3  'Both
      TabIndex        =   10
      Top             =   5130
      Width           =   9465
   End
   Begin VB.CommandButton cmdTo
      Caption         =   "Select &Destination"
      Height          =   435
      Left            =   8100
      TabIndex        =   9
      Top             =   660
      Width           =   1545
   End
   Begin VB.CommandButton cmdPlayList
      Caption         =   "&Select Playlist"
      Height          =   435
      Left            =   8100
      TabIndex        =   8
      Top             =   150
      Width           =   1545
   End
   Begin VB.FileListBox File1
      Height          =   4185
      Left            =   4740
      TabIndex        =   7
      Top             =   120
      Width           =   3255
   End
   Begin VB.DirListBox Dir1
      Height          =   3690
      Left            =   930
      TabIndex        =   6
      Top             =   570
      Width           =   3705
   End
   Begin VB.DriveListBox Drive1
      Height          =   315
      Left            =   930
      TabIndex        =   5
      Top             =   120
      Width           =   3735
   End
   Begin VB.CommandButton cmdCopy
      Caption         =   "&Copy MP3s"
      Height          =   435
      Left            =   8100
      TabIndex        =   4
      Top             =   1170
      Width           =   1545
   End
   Begin VB.TextBox txtTo
      Height          =   345
      Left            =   900
      Locked          =   -1  'True
      TabIndex        =   3
      Top             =   4740
      Width           =   8715
   End
   Begin VB.TextBox txtFrom
      Height          =   345
      Left            =   900
      Locked          =   -1  'True
      TabIndex        =   0
      Top             =   4350
      Width           =   8685
   End
   Begin VB.Label Label2
      Alignment       =   1  'Right Justify
      Caption         =   "To"
      Height          =   225
      Left            =   150
      TabIndex        =   2
      Top             =   4740
      Width           =   525
   End
   Begin VB.Label lblPlaylist
      Alignment       =   1  'Right Justify
      Caption         =   "Playlist"
      Height          =   225
      Left            =   150
      TabIndex        =   1
      Top             =   4410
      Width           =   525
   End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False


Private Sub cmdCopy_Click()

Dim LineFromFile As String
Dim CommandLine As String
Dim NumberOfFiles As Integer


On Error GoTo ErrorHandler
   
    If Trim(txtFrom.Text) = "" Then
        MsgBox "Please select a Playlist from the list...", vbCritical, "Error"
        Exit Sub
    End If
    NumberOfFiles = 0
    txtOutPut.Text = ""
    Open txtFrom.Text For Input As #1
    While Not EOF(1)
        Line Input #1, LineFromFile
        If Mid(LineFromFile, 1, 9) = "Documents" Then
            LineFromFile = "C:\" + LineFromFile
        End If
        If Mid(LineFromFile, 2, 1) = ":" Then
            CommandLine = "Xcopy " + Chr(34) + LineFromFile + Chr(34) + " " + Chr(34) + txtTo.Text + Chr(34)
            txtOutPut = txtOutPut + vbCrLf + CommandLine
            Shell CommandLine, vbHide
            NumberOfFiles = NumberOfFiles + 1
            DoEvents
        End If
    Wend
    Close #1
    MsgBox NumberOfFiles & " Files Copied Successfully"
    Exit Sub
ErrorHandler:
    MsgBox Err.Description, vbCritical, "Error"
End Sub


Private Sub cmdPlayList_Click()
   
    txtFrom.Text = File1.Path + "\" + File1.FileName
End Sub


Private Sub cmdTo_Click()
   
    txtTo.Text = File1.Path
End Sub


Private Sub Dir1_Change()
   
    File1.Path = Dir1.Path
End Sub


Private Sub Drive1_Change()
   
    Dir1.Path = Drive1.Drive
End Sub
 

  • It's a great media player, as long as you don't use it in 64-bit Windows (XP or Vista). Fantastic selection of skins and plug-ins.

Page 1 of 1 (1 items)
Leave a Comment
  • Please add 6 and 3 and type the answer here:
  • Post