MODIFIED=20080801
newer script here:
http://www.autohotkey.com/forum/viewtopic.php?t=27264
Quote:
=========================================================================================
.......
http://www.autohotkey.net/~garry/200808 ... BE_M3U.ahkUploaded TOOLS to this script .......
http://www.autohotkey.net/~garry/200808 ... OUTUBE.zipDescription.....................
-YOUTUBE watch in GUI when rightclick url (save link) in youtube
-YOUTUBE download and keep a logfile (can also download when no more exist)
-RECORD record what you hear with mixmp3
-RADIO record with streamripper multiple radio stations
-TELEVISION see embedded
-SEARCH type in search word and start links
-MP3GAIN set level from MP3 files
LISTVIEW select predefined folder to search from here
( edit /delete / addnew )
-FOTO slide show
-VIDEO see with predefined size and black background
-MUSIC M3UPlayer
========================================================================================
2005-05-03
1-select Folder (example:mp3/wav selected), creates a playlist SelectedFolder.m3u in folder PLAYLIST
2-ButtonPlay or doubleClick > music plays with selected player
or Button LastCreaALL > listen Playlist last created SelectedFolder.m3u
create folders:PLAYLIST,STREAM,PRESET
control in the program the path from the players
record with streamripper.exe and tre.dll
streamripper home page =
http://streamripper.sourceforge.net/
Create for test 6 preset-buttons:
button AddUrl (Name and Url)
USA
http://130.166.72.1:8008
SWEDEN
http://213.112.20.65:8100
ANGOLA
http://67.15.82.69:8092
MONTREAL
http://213.251.134.62:5000
JAPAN
http://www.nhk.or.jp/rj/ram/en/live.ram
TV-FINLAND
http://ra.yle.fi/ramgen/yle24/video/uusin_rk.rm
creates 4 pls (open with any player) and 2 ram (open only with realplayer)
move these to folder PRESET
move your own *.pls *.ram to folder PLAYLIST
when you are listening xy.pls:
button RECORD > record radio to folder STREAM with streamripper.exe
button URL-info > see information in showcast about this radio station
can search any file (example: *.ahk)
*.pls *.ram and *.m3u search in the default folder PLAYLIST
or type in *.pls > search in any folder
Code:
;PLAYMUSIC.ahk 2005-05-03 garry V1.2
;search for music or files, listen selected music or playlist
;preset buttons listen and record radio,watch TV
;=============================================================================
;record radio with streamripper.exe and tre.dll
;version streamripper = 1.61.4
;streamripper home page = http://streamripper.sourceforge.net/
;=============================================================================
;from MP3-player project=http://www.scottserver.net/forum/viewtopic.php?t=1924
;-------------------------------------------------------------------------------
VERSION=V1.2-20050503
;-----PRESET 1-6 (in Folder Preset )-------------------------
P1=USA.PLS
P2=SWEDEN.PLS
P3=ANGOLA.PLS
P4=MONTREAL.PLS
P5=JAPAN.ram
P6=TV-FINLAND.ram
;---------------------------------------------
#NoTrayIcon
soundset,99
soundset,0,master,mute
run,%COMSPEC% /C if not exist \STREAM\NUL MD STREAM,,hide
run,%COMSPEC% /C if not exist \PLAYLIST\NUL MD PLAYLIST,,hide
run,%COMSPEC% /C if not exist \PRESET\NUL MD PRESET,,hide
setworkingdir,%A_SCRIPTDIR%
Gui, Font, S8 , Verdana
Gui, Color, 000000
Gui,Add,ListBox, x10 y10 w580 h360 +HScroll AltSubmit vMyListBox gMyListBox
Gui,Font,S8 cwhite, Verdana
Gui,Add,Button, x370 y419 w82 h20,SelectFolder
Gui,Add,Button, x460 y419 w50 h20,COPY
Gui,Add,Text, x525 y419,to C:\AAA
Gui,Add,Button, x515 y450 w80 h20,PLAY/OPEN
Gui,Add,Button, x515 y473 w80 h20,RECORD
Gui,Add,Button, x515 y497 w80 h20,URL-INFO
Gui,Add,Button, x370 y450 w82 h20,LastCreaALL
Gui,Add,Button, x5 y368 w82 h20,WinAmp
Gui,Add,Button, x100 y368 w82 h20,ShoutCast
Gui,Add,Button, x420 y368 w82 h20,MIXER
Gui,Add,Button, x515 y368 w70 h20,AddUrl
Gui,Add,Button, x5 y490 w55 h20,1
Gui,Add,Button, x65 y490 w55 h20,2
Gui,Add,Button, x125 y490 w55 h20,3
Gui,Add,Button, x185 y490 w55 h20,4
Gui,Add,Button, x245 y490 w55 h20,5
Gui,Add,Button, x305 y490 w55 h20,6
Gui,Add,Text, x15 y513,USA
Gui,Add,Text, x65 y513,SVERIGE
Gui,Add,Text, x125 y513,ANGOLA
Gui,Add,Text, x180 y513,MONTREAL
Gui,Add,Text, x251 y513,JAPAN
Gui,Add,Text, x299 y513,TV-FINLAND
Gui, Add, Edit, x5 y390 w580 h20 ReadOnly vC,
Gui, Font, S4 cblack, Verdana
Gui, Add, GroupBox, x5 y412 w355 h30,A
Gui, Font, S8 cwhite, Verdana
Gui, Add, Radio,x8 y422 vC4, MP3
Gui, Add, Radio,x60 y422 , WAV
Gui, Add, Radio,x115 y422 , PLS
Gui, Add, Radio,x165 y422 , RAM
Gui, Add, Radio,x220 y422 , M3U
Gui, Font, S4 cblack, Verdana
Gui, Add, GroupBox,x5 y450 w355 h30,F
Gui, Font, S8 cwhite, Verdana
Gui, Add, Radio,x8 y460 vC5, REALPL
Gui, Add, Radio,x80 y460 , WINAMP
Gui, Add, Radio,x155 y460 , MSPLAY
Gui, Add, Radio,x230 y460 , MSPL2
Gui, Add, Radio,x295 y460 , QUICK
GuiControl,, C4, 1
GuiControl,, C5, 1
Gui, Font, S8 cblack, Verdana
Gui, Add, Edit, x275 y419 w80 h20 vAL
Gui, Show, x2 y0 w600 h530,PLAYMUSIC %VERSION%
;---------------------------------------------
maxxpic := 0
Loop, read, %A_SCRIPTDIR%\PLAYLIST\lastm3u.txt
{
Loop, parse, A_LoopReadLine, CSV
{
if a_index = 1
F1 = %a_loopfield%
}
}
;----------a clock ----------------
{
Gui, Font, S8 cwhite, Verdana
Gui, Add, Text, x200 Y370 vD , %A_DDDD% %A_YYYY%-%A_MM%-%A_DD% %a_hour%:%a_min%:%a_sec%
SetTimer, RefreshD, 1000
RefreshD:
GuiControl, , D, %A_DDDD% %A_YYYY%-%A_MM%-%A_DD% %a_hour%:%a_min%:%a_sec%
return
}
Return
;===============================================================================================
buttonAddUrl:
LM1=20 ;lenght NAME
Gui,2:Font, S10 CDefault , FixedSys
Gui,2:Add,Text, x1 y5 w80 h20, NAME
Gui,2:Add,Edit, limit%LM1% x80 y5 w170 h20 vA31, %A31%
Gui,2:Add,Text, x1 y35 w80 h20, URL
Gui,2:Add,Edit, x80 y35 w420 h20 vA35, %A35%
Gui,2:Add, Button, x550 y32 w40 h25, OK
Gui,2:Show, x2 y385 w600 h60, URL-INPUT
return
;--------------------------------------------------------------
2ButtonOK:
2GuiClose:
2GuiEscape:
Gui,2:submit
if A31=
{
A31=_unknown
}
if A35=
{
GUI destroy
return
}
stringlen,L,A35
stringmid,A36,A35,8,L
Loop, parse,A36, `
{
Transform,D1,ASC,%A_LOOPFIELD%
if D1 >64
I+=1
}
if I>0
{
G=%A31%.ram
FILEDELETE %A_ScriptDir%\PLAYLIST\%G%
ifNotExist, %A_ScriptDir%\PLAYLIST\%G%
FILEAPPEND,%A35% `n,%A_ScriptDir%\PLAYLIST\%G%
}
else
{
G=%A31%.PLS
FILEDELETE %A_ScriptDir%\PLAYLIST\%G%
ifNotExist, %A_ScriptDir%\PLAYLIST\%G%
FILEAPPEND, [playlist]`r`nnumberofentries=1`r`nFile1=%A35%`r`nTitle1=`r`nLength1=`r`nVersion=2`r`n,%A_ScriptDir%\PLAYLIST\%G%
}
A31=
A35=
Gui destroy
return
;================================================================================================
;------Search Function------
buttonSelectFolder:
Gui, Submit, NoHide
C=
M=
SF=
E=
GuiControl, , C, %C%
GUIControl,, ListBox1, ||
if AL=
{
GOTO GS11
}
else
{
A=%AL%
GOTO GS12
}
GS11:
if C4=1
{
A=*.mp3
}
if C4=2
{
A=*.wav
}
if C4=3
{
A=*.pls
}
if C4=4
{
A=*.ram
}
if C4=5
{
A=*.m3u
}
;GS12:
if c4=3
{
FileSelectFolder, MusicFolder,%A_SCRIPTDIR%\PLAYLIST
GOTO GS13
}
if c4=4
{
FileSelectFolder, MusicFolder,%A_SCRIPTDIR%\PLAYLIST
GOTO GS13
}
if c4=5
{
FileSelectFolder, MusicFolder,%A_SCRIPTDIR%\PLAYLIST
GOTO GS13
}
GS12:
SetBatchLines, 5ms
FileSelectFolder, MusicFolder
GS13:
If MusicFolder=
{
return
}
Else
{
;search for selected FolderName
MF=%MUSICFOLDER%
stringlen, LenLine, MF
StringGetPos,C, MF,\,R1
If Errorlevel <> 0
C = 0
else
C := LenLine-C
stringright,SR,MF,C-1
if a=*.mp3
{
filedelete %A_SCRIPTDIR%\PLAYLIST\lastm3u.txt
F1=%SR%mp3.m3u
filedelete %A_SCRIPTDIR%\PLAYLIST\%F1%
goto GS4
}
if a=*.wav
{
filedelete %A_SCRIPTDIR%\PLAYLIST\lastm3u.txt
F1=%SR%wav.m3u
filedelete %A_SCRIPTDIR%\PLAYLIST\%F1%
goto GS4
}
else
{
goto GS5
}
GS4:
{
fileappend,%F1%`r`n,%A_SCRIPTDIR%\PLAYLIST\lastm3u.txt
}
}
GS5:
{
IfGreater, maxxpic, 1
{
Loop, %maxxpic%
{
Pic%A_Index%=
}
PicSorted=
}
Loop, %MusicFolder%\%A%, 0,1
{
PicSorted = %PicSorted%%A_LoopFileFullPath%|
maxxpic := A_Index
}
Sort, PicSorted, D| \
Loop, Parse, PicSorted, |
{
Pic%A_Index% = %A_LoopField%
xstep = %A_Index%
Loop, %A_LoopField%
{
If xstep = 1
GUIControl,, ListBox1, |%A_LoopFileName%|
Else
GUIControl,, ListBox1, %A_LoopFileName%
if a=*.mp3
{
goto GS2
}
if a=*.wav
{
goto GS2
}
else
{
goto GS3
}
GS2:
{
M=1
fileappend,%A_LoopFileFullPath%`r`n,%A_SCRIPTDIR%\PLAYLIST\%F1%
}
}
GS3:
xstep=
PicSorted=
}
}
Return
;----------
MyListBox:
GuiControlGet, MyListBox
if A_GuiControlEvent = Normal
{
StringTrimLeft, FullPath, Pic%MyListBox%, 0
GuiControl, , C, "%FullPath%"
E=
FP=%FullPath%
stringright,E,FP,3
SF=1
}
if A_GuiControlEvent = DoubleClick
{
StringTrimLeft, FullPath, Pic%MyListBox%, 0
Cursel := MyListBox
CurList = Pic
E=
FP=%FullPath%
stringright,E,FP,3
Goto,GS1
}
return
;================================================================
ButtonPlay/Open:
GS1:
Gui, Submit, NoHide
GuiControl, , C, "%FullPath%"
if SF=
{
Msgbox,Select first a File
return
}
if E=MP3
{
GOTO GS6
}
if E=WAV
{
GOTO GS6
}
if E=PLS
{
GOTO GS6
}
if E=M3U
{
run,notepad %FullPath%
GOTO GS6
}
if M=
{
run,%FullPath%
return
}
GS6:
if C5=1
{
CSX=REALPL
}
if C5=2
{
CSX=WINAMP
}
if C5=3
{
CSX=MSPLAY
}
if C5=4
{
CSX=MSPL2
}
if C5=5
{
CSX=QUICKT
}
GOTO %CSX%
;-------------------------------
REALPL:
;run,"%A_ProgramFiles%\REAL10-5GOLD\realplay.exe" "%FullPath%"
run,"%A_ProgramFiles%\REALPLAYER\realplay.exe" "%FullPath%"
return
;-------------------------------
WINAMP:
run,"%A_ProgramFiles%\Winamp\winamp.exe" "%FullPath%"
return
;-------------------------------
QUICKT:
run,"%A_ProgramFiles%\TOOLS\QUICKTIME\QUICKTIMEPLAYER.exe" "%FullPath%"
return
;-------------------------------------------------------------------------
MSPLAY:
run,"%A_ProgramFiles%\Windows Media Player\wmplayer.exe" "%FullPath%"
return
;-------------------------------------------------------------------------
MSPL2:
run,"%A_ProgramFiles%\Windows Media Player\mplayer2.exe" "%FullPath%"
return
;================================================================
buttonLastCreaALL:
;-----------------
;m3u
Gui, Submit, NoHide
ifNotExist, %A_SCRIPTDIR%\PLAYLIST\%F1%
{
MsgBox, The file: SelectedFolder.m3u does not exist yet.`r`nSelect *.mp3 or *.wav files first
return
}
run,notepad %A_SCRIPTDIR%\PLAYLIST\%F1%
;CSX=REALPL2
;GOTO %CSX%
if C5=1
{
CSX=REALPL2
}
if C5=2
{
CSX=WINAMP2
}
if C5=3
{
CSX=MSPLAY2
}
if C5=4
{
CSX=MSPL22
}
if C5=5
{
CSX=QUICKT2
}
GOTO %CSX%
;-------------------------------
REALPL2:
;run,"%A_ProgramFiles%\REAL10-5GOLD\realplay.exe" "%A_SCRIPTDIR%\PLAYLIST\%F1%"
run,"%A_ProgramFiles%\REALPLAYER\realplay.exe" "%A_SCRIPTDIR%\PLAYLIST\%F1%"
return
;-------------------------------
WINAMP2:
run,"%A_ProgramFiles%\Winamp\winamp.exe" "%A_SCRIPTDIR%\PLAYLIST\%F1%"
return
;--------------------------------------------------------------------
MSPLAY2:
run,"%A_ProgramFiles%\Windows Media Player\wmplayer.exe" "%A_SCRIPTDIR%\PLAYLIST\%F1%"
return
;--------------------------------------------------------------------
MSPL22:
run,"C:\Programme\Windows Media Player\mplayer2.exe" "%A_SCRIPTDIR%\PLAYLIST\%F1%"
return
;------------------------------------------------------------------------------------------
QUICKT2:
run,"%A_ProgramFiles%\TOOLS\QUICKTIME\QUICKTIMEPLAYER.exe" "%A_SCRIPTDIR%\PLAYLIST\%F1%"
return
;================================================================
;---------------PRESET 1-5---------------------------------------
Button1:
Gui, Submit, NoHide
E=PLS ;record possible
FP=%A_SCRIPTDIR%\PRESET\%P1%
GOTO GS15
;------------------------------------
Button2:
Gui, Submit, NoHide
E=PLS ;record possible
FP=%A_SCRIPTDIR%\PRESET\%P2%
GOTO GS15
;------------------------------------
Button3:
Gui, Submit, NoHide
E=PLS ;record possible
FP=%A_SCRIPTDIR%\PRESET\%P3%
GOTO GS15
;------------------------------------
Button4:
Gui, Submit, NoHide
E=PLS ;record possible
FP=%A_SCRIPTDIR%\PRESET\%P4%
GOTO GS15
;------------------------------------
Button5:
Gui, Submit, NoHide
E= ;record not possible
FP=%A_SCRIPTDIR%\PRESET\%P5%
GOTO REALPL3
;------------------------------------
Button6:
Gui, Submit, NoHide
E= ;record not possible
FP=%A_SCRIPTDIR%\PRESET\%P6%
GOTO REALPL3
;============================================================
;Austria Steiermark,example for day calculation
;http://vid01.wkstmk.at:8080/ramgen/orf2/st/st050501l.rm
E=
{
EnvAdd, bd1,0,days
stringleft,bd2,bd1,8 ;bd2 20050409
stringmid,yr4,bd2,1,4
stringmid,yr2,bd2,3,2
stringmid,mn2,bd2,5,2
stringmid,dy2,bd2,7,2
SD1=%YR2%%MN2%%DY2%
FP=http://vid01.wkstmk.at:8080/ramgen/orf2/st/st%SD1%l.rm
bd1=
GOTO REALPL3
}
;------------------------------------
GS15:
if C5=1
CSX=REALPL3
if C5=2
CSX=WINAMP3
if C5=3
CSX=MSPLAY3
if C5=4
CSX=MSPL23
if C5=5
CSX=QUICKT3
GOTO %CSX%
;-------------------------------
REALPL3:
;run,"%A_ProgramFiles%\REAL10-5GOLD\realplay.exe" "%FP%"
run,"%A_ProgramFiles%\REALPLAYER\realplay.exe" "%FP%"
return
;-------------------------------
WINAMP3:
run,"%A_ProgramFiles%\Winamp\winamp.exe" "%FP%"
return
;-------------------------------
QUICKT3:
run,"%A_ProgramFiles%\TOOLS\QUICKTIME\QUICKTIMEPLAYER.exe" "%FP%"
return
;-------------------------------------------------------------------------
MSPLAY3:
run,"%A_ProgramFiles%\Windows Media Player\wmplayer.exe" "%FP%"
return
;-------------------------------------------------------------------------
MSPL23:
run,"%A_ProgramFiles%\Windows Media Player\mplayer2.exe" "%FP%"
return
;----------------------------------------------------------------
buttonCopy:
IF MF=
{
Msgbox,Select first a Folder
return
}
run,%COMSPEC% /K xcopy "%MF%\%a%" /S /I /Y C:\AAA\*.*
return
;----------------------------
buttonMixer:
run,sndvol32.exe
return
;----------------------------
buttonShoutcast:
run,http://www.shoutcast.com
return
;----------------------------
buttonWinAmp:
run,%A_ProgramFiles%\Winamp\winamp.exe
return
;----------------------------
buttonrecord:
if E=PLS
{
GOTO GS7
}
else
{
msgbox,Select first a *.PLS File
return
}
GS7:
;[playlist]
;numberofentries=1
;File1=http://130.166.82.14:8006
;Title1=
;Length1=
;Version=2
{
i = 0
Loop
{
I += 1
FileReadLine, line, %FP%, %i%
if ErrorLevel <> 0
{
Msgbox,Wrong PLS-File not found Text: File1=
return
}
IfInString, line,FILE1=
{
stringmid,A4,LINE,7,40
GOTO A2
}
}
A2:
IfNotExist streamripper.exe
{
MsgBox streamripper.exe does not exist!
return
}
run,%COMSPEC% /K streamripper.exe %A4% --xs_offset=-5000 -t -d STREAM
}
return
;-------------------------------------------------------------
ButtonUrl-Info:
if E=PLS
{
GOTO GS8
}
else
{
msgbox,Select first a *.PLS File
return
}
GS8:
{
i = 0
Loop
{
I += 1
FileReadLine, line, %FP%, %i%
if ErrorLevel <> 0
{
Msgbox,Wrong PLS-File not found Text: File1=
return
}
IfInString, line,FILE1=
{
stringmid,A4,LINE,7,40
GOTO A7
}
}
A7:
run,%A4%
}
return
;-------------------------------------------------------------
GuiClose:
ExitApp
;------example MP3PLAYLIST.BAT-------------------------------------------
;dir C:\*.mp3 /OD /B /S >_ALLMP3.m3u
;pause
;------------------------------------------------------------------------
;run,%COMSPEC% /K dir C:\*.mp3 /OD /B /S >_ALLMP3.m3u
;------------------------------------------------------------------------