Jump to content

Play list Help plZ


DanBoy
 Share

Recommended Posts

Hi,

something like this?

#Include <File.au3>
#Include <Array.au3>

Global $SongLength = 85, $songCounted=0
Global $directory = FileSelectFolder("Ordner auswählen aus dem die MP3-Dateien zu einer Playlist umgewandelt werden sollen: ", "", 4, "d:") & "\"

Global $FileList = _FileListToArray($directory, '*.mp3')

If (Not IsArray($FileList)) and (@error = 1) Then
    MsgBox(0, "", "No Files\Folders Found.")
    Exit
EndIf
$file = FileOpen(@DesktopDir & '\Playlist_' & @MDAY & '_' & @MON & '_' & @YEAR & '.txt', 2 + 8)

If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

; Headline
FileWriteLine($file, 'Nr.' & " | " & 'Song                                                                                                                                                                  ' & "| " & 'Duration')
FileWriteLine($file, '-------------------------------------------------------------------------------------------------------')

For $i = 1 To UBound($FileList) - 1
    If StringLen($FileList[$i]) >= $SongLength Then
        $songCounted = StringLeft($FileList[$i], $SongLength)
        FileWriteLine($file, StringFormat('%0.3d' ,$i) & " | " & $FileList[$i] & " | " & _GetExtProperty($directory & $FileList[$i], 21))
    Else
        $FileList[$i] = fullfill($SongLength, $FileList[$i], ' ')
        FileWriteLine($file, StringFormat('%0.3d' ,$i) & " | " & $FileList[$i]  & " | " & _GetExtProperty($directory & $FileList[$i], 21))
    EndIf   
Next
FileWriteLine($file, '-------------------------------------------------------------------------------------------------------')
MsgBox(64, 'Info', 'Die Playlist wurde in' & @CRLF & @CRLF & _ 
@DesktopDir & '\Playlist_' & @MDAY & '_' & @MON & '_' & @YEAR & '.txt' & @CRLF & @CRLF & "gespeichert.")
FileClose($file)

Func _GetExtProperty($sPath, $iProp)
    Local $iExist, $sFile, $sDir, $oShellApp, $oDir, $oFile, $aProperty, $sProperty
    $iExist = FileExists($sPath)
    If $iExist = 0 Then
        SetError(1)
        Return 0
    Else
        $sFile = StringTrimLeft($sPath, StringInStr($sPath, "\", 0, -1))
        $sDir = StringTrimRight($sPath, (StringLen($sPath) - StringInStr($sPath, "\", 0, -1)))
        $oShellApp = ObjCreate("shell.application")
        $oDir = $oShellApp.NameSpace ($sDir)
        $oFile = $oDir.Parsename ($sFile)
        If $iProp = -1 Then
            Local $aProperty[35]
            For $i = 0 To 34
                $aProperty[$i] = $oDir.GetDetailsOf ($oFile, $i)
            Next
            Return $aProperty
        Else
            $sProperty = $oDir.GetDetailsOf ($oFile, $iProp)
            If $sProperty = "" Then
                Return 0
            Else
                Return $sProperty
            EndIf
        EndIf
    EndIf
EndFunc   ;==>_GetExtProperty

; ----------------------------------------------------------------------------
; Author:         Thorsten Meger
; Script Function: Func fullfill
; ----------------------------------------------------------------------------

Func fullfill($maxLength, $string, $fullFillChar)
    ; $maxLength    = maximum string size
    ; $fullFillChar = char to fullfill the string
    While 1
        If StringLen($string) < $maxLength Then
            $string &= $fullFillChar
            ContinueLoop
        EndIf
        ExitLoop
    WEnd
    Return $string
EndFunc   ;==>fullfill

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...