Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;#warn
- #NoEnv
- #SingleInstance, Force
- Process, Priority, , A
- SendMode, Input
- SetBatchLines, -1
- ;#NoTrayIcon
- SetWorkingDir %A_ScriptDir%
- VLC = %A_programfiles%\VideoLAN\VLC\vlc.exe
- Gui, Add, Edit, w900 h600 vPlaylist
- ; Add Search Field
- Gui, Add, Edit, x5 y620 w300 vSearch gSearchPlaylist, Search...
- ; Set button layout to horizontal
- Gui, Add, Button, x310 y620 w100 gLoadPlaylist, Load Playlist
- Gui, Add, Button, x+5 y620 w100 gSaveAllURLs, Save All URLs
- Gui, Add, Button, x+5 y620 w100 gOpenInVLC, Open VLC
- Gui, Add, Button, x+5 y620 w100 gExitScript, Exit
- Gui, Show, , Playlist Viewer
- return
- LoadPlaylist:
- FileSelectFile, PlaylistFile, 3, , Select a playlist file (*.m3u;*.m3u8)
- if (ErrorLevel || PlaylistFile = "")
- {
- MsgBox, 16, Error, Unable to load the playlist file.
- return
- }
- FileRead, PlaylistContent, %PlaylistFile%
- if ErrorLevel
- {
- MsgBox, 16, Error, Unable to read the contents of the playlist file.
- return
- }
- GuiControl,, Playlist, ; Clear existing playlist
- URLList := "" ; Initialize an empty string to hold the URLs
- Loop, Parse, PlaylistContent, `n
- {
- if (RegExMatch(A_LoopField, "^(?!#EXTM3U|#EXTINF:-1|#.*\.(png|jpg|bmp)).*$", URL))
- {
- URLList .= URL "`n" ; Append the URL to the list
- }
- }
- GuiControl,, Playlist, %URLList% ; Display the list of URLs
- return
- SearchPlaylist:
- GuiControlGet, SearchText,, Search
- GuiControl,, Playlist, ; Clear existing playlist
- if (SearchText = "") ; If no search text is entered, display the original playlist
- {
- GuiControl,, Playlist, %URLList%
- return
- }
- FilteredList := "" ; Initialize an empty string to hold the filtered URLs
- Loop, Parse, URLList, `n
- {
- if (InStr(A_LoopField, SearchText))
- {
- FilteredList .= A_LoopField "`n" ; Append the URL to the filtered list
- }
- }
- GuiControl,, Playlist, %FilteredList% ; Display the filtered list of URLs
- return
- ExitScript:
- ExitApp
- return
- OpenInVLC:
- ControlGet, outputvar, Selected,,Edit1,
- Run, %VLC% "%outputvar%"
- ;Sleep, 5000 ; 5-second delay
- ;Send, ^v
- return
- SaveAllURLs:
- GuiControlGet, PlaylistContent,, Playlist
- FileDelete, Playlist.txt
- FileAppend, %PlaylistContent%, Playlist.txt
- MsgBox, Playlist URLs saved to Playlist.txt
- return
- GuiContextMenu(playlist) {
- Menu, ContextMenu, Add, Save Selected URL, SaveSelectedURL
- Menu, ContextMenu, Show
- return
- }
- SaveSelectedURL:
- GuiControlGet, SelectedItem,, Playlist
- FileAppend, %SelectedItem%, Playlist.txt
- MsgBox, Selected URL saved to Playlist.txt
- return
Add Comment
Please, Sign In to add comment