mit dem folgenden Code kann man unter MacOS Catalina eine einfache M3U Play Liste erstellen. Der überwiegende Teil ist aus einem Beispiel und ich habe es nur angepasst
, damit es für den zugedachten Zweck passt.
Nach dem Aufruf kann man ein Verzeichnis mit Media Dateien (PathRequester) wählen in dem dann eine einfache M3U Playlist Datei erstellt wird. Danach beendet sich das Programm von selbst.
Ich "füttere" damit meinen Elmedia Player oder den VLC auf meinem Mac, aber vermutlich klappen auch alle anderen Programme. Es ist nichts besonders komplexes aber wer es brauchen kann und noch nicht so fortgeschritten ist hat vielleicht Verwendung.
Gruß Christian
Code: Alles auswählen
;English forum: http://www.purebasic.fr/english/viewtopic.php?t=8998&highlight=
; As template and adapted for M3U playlists 06.2020 ChristianH
IncludeDirectoriesInListings.l = #False
DirectoryName.s
FileType.l
;Create a new LinkedList that will hold the results of our directory 'scan'
Global NewList Listings.s()
;Choose a directory
DirectoryName = PathRequester("Please choose a folder to create playlist from...", "")
;Examine that directory
If ExamineDirectory(1, DirectoryName, "") ; If directory can be read...
Repeat
FileType = NextDirectoryEntry(1)
If FileType = 1 ; 1 = File
;Add the file name to the listings
AddElement(Listings())
Listings() = DirectoryEntryName(1)
EndIf
Until FileType = 0
EndIf
;write the listings to a file
If OpenFile(1, DirectoryName+"Playlist.M3U") ; If file can be created...
ForEach Listings()
If Len(Listings()) >3
If (Right(Listings(),4) ="flac") Or (Right(Listings(),3) ="mp3") Or (Right(Listings(),3) ="wav")
WriteStringN(1,DirectoryName + Listings())
EndIf
EndIf
Next
CloseFile(1)
EndIf