garry
Anmeldedatum: 25.10.2005 Beiträge: 422 Wohnort: switzerland
|
Verfasst am: Do Dez 29, 2005 9:55 am Titel: PlayerM3U |
|
|
Music Suche und Abspielen (mp3/wav)
Beim Settings kann ein Ordner definiert werden (suche von hier und Subfolder)
oder leer C:\ (bzw.: alle)
Buttons:
create playlist =Ordner auswählen, create xy.m3u
LastPlayList =beim start Anzeige letzter ausgewählter Ordner, alle Titel einzeln
FolderM3U = Doppelclick startet M3U (alle Lieder)
oder RightClick = Anzeige aller Titel, Start mit Doppelclick
Search(leeres Feld)= suche nach Music Titel (* wieder alle)
Beispiel, search aller Titel auf dem Harddisk:
mit CreatePlaylist einen Ordner auswählen z.B.: C:\ (oder MyMusic), bei C:\ dauert es eine Weile, warten bis roter Balken (start ) verschwindet
alle Dateien werden angezeigt, sortieren nach Name oder Datum
spätere Suche:
Button FolderM3U anklicken
Datei .m3u mit rechte Maus öffnen
alle Dateien werden angezeigt, sortieren nach Name oder Datum
Abspielen mit Doppelclick oder Pfeil up/down
| Code: | /*
......name = PlaylistM3U.ahk garry
......date = 2005-12-27
......modified = 2005-12-29 add search and date column
...... 2005-12-30 when splashimage red, wait
...... 2005-12-30 search counter
*/
menu,S1,Add,&Set a predefined Folder,MH1
menu,S1,Add,&How to use,MH2
menu,S1,Add,&About,MH3
menu,myMenuBar,Add,Settings,:S1
gui,menu,MyMenuBar
setformat,float,3.0
soundset, 0,master,mute ;SPEAKER=MASTER ON
SoundSet,100,master ;SPEAKER=MASTER volume
soundset, 0,WAVE,mute ;WAVE ON
SoundSet,100,WAVE ;WAVE
SoundGet,MAS,Master
RU1=%A_SCRIPTDIR%\_M3U
ifnotexist,%RU1%
FileCreateDir,%RU1%
R3K=%A_SCRIPTDIR%\_M3U\lastm3u.txt
DFT=%A_SCRIPTDIR%\_M3U\define.txt
Gui, Color, 000000
Gui, Show, x0 y0 w720 h420,PlayerM3U
Gui,Font, S10 CDefault , FixedSys
Gui,Add, ListView,grid y17 r17 w700 altsubmit gMLV,Name|PROGRAM|DATE
;Gui,Font,S13 CDefault,Lucida Console
;Gui,Add, ListView,backgroundteal csilver grid r15 w700 altsubmit gMLV,Name|PROGRAM|DATE
Gui,1:Font, S8 cwhite, Verdana
Gui,1:Add,Edit, x12 y320 w700 h40 ReadOnly vH2,
Gui,Add,Text,x20 y2 vTotal1 w100,%I%
Gui,Add,Text,x140 y2 vFolder1 w500,%FA%
Gui,1:Font, S8 cblack, Verdana
Gui,Add,Button, x280 y365 w130 h20,FolderM3U
Gui,Add,Button, x430 y365 w130 h20,LastCreated
Gui,Add,Button, x580 y365 w130 h20,CreatePlayList
Gui,Add,Edit, x280 y390 w430 h20 vAL
Gui,Add,Button, default x620 y390 w0 h0 gSearch,
Gui,Add,Button, x168 y365 w60 h46,ON/OFF
Gui,Add,Slider, x10 y365 w150 h20 vVolume Range0-100 gVolumeX,100
Gui,Add,Edit, x10 y390 w150 h20 vEditText3 gEdit3,
LB:
Gui,1:Default
Gui,1:Submit,nohide
FileReadLine,LP,%R3K%,1
GuiControl,,Folder1,%LP%
R3X=%A_SCRIPTDIR%\_M3U\%LP%
LB2:
LV_Delete()
LV_ModifyCol(1,560)
LV_ModifyCol(2,0)
LV_ModifyCol(3,110)
Splashimage,,b1 x140 y5 w500 h30 CWred zh0,START READ
I:=0
loop,read,%R3X%
{
BX1=
stringsplit,BX,A_LoopReadLine,`;,
ifnotexist,%BX1%
continue
I++
Filegettime,T1,%BX1%,C
stringleft,T1,T1,12
stringright,P2,BX1,3
stringlen, LenLine,BX1
StringGetPos,C,BX1,\,R1
If Errorlevel <> 0
C = 0
else
C := LenLine-C
stringright,SR,BX1,C-1
if P2=MP3
LV_Add("",SR,BX1,T1)
if P2=WAV
LV_Add("",SR,BX1,T1)
if P2=M3U
LV_Add("",SR,BX1,T1)
else
Continue
}
Splashimage,off
GuiControl,,total1,%I%
GuiControl,Focus,AL
return
;===================================
buttonLastCreated:
FileReadLine,LP,%R3K%,1
GuiControl,,H2,PLAYLIST= %LP%
GuiControl,,Folder1,%LP%
R3X=%A_SCRIPTDIR%\_M3U\%LP%
Goto,LB
;------------------
buttonFolderM3U:
GuiControl,,H2,
GuiControl,,H2,---- OPEN FILE M3U with RightClick --- or -- DoubleClick to play all
FA=%RU1%\allm3u.txt
Filedelete,%FA%
Loop,%RU1%\*.M3U, 0,1
{
Fileappend,%A_LoopFileFullPath%`r`n,%FA%
}
R3X=%FA%
Goto,LB2
;-----------------------------
VolumeX:
Gui, Submit, NoHide
SoundSet,%volume%,master
SoundGet,MAS,Master
GuiControl,, EditText3,%volume%
Return
Edit3:
Gui, Submit, Nohide
GuiControl,,volume,%EditText3%
Return
;-----------------------------------------
buttonON/OFF:
soundset,+1,master,mute
K++
transform,MD1,MOD,K,2
transform,pr,chr,37
if MD1=0
MD2=%MAS%%PR%
else
MD2=SPEAKER OFF
Gui,Add,Edit, cred x10 y390 w120 h20 ,%MD2%
return
;------------- search --------------------
search:
Gui,submit,nohide
LV_Delete()
LV_ModifyCol(1,560)
LV_ModifyCol(2,0)
LV_ModifyCol(3,110)
Splashimage,,b1 x140 y0 w500 h30 CWred zh0,START READ
if AL=*
{
I:=0
loop,read,%R3X%
{
BX1=
stringsplit,BX,A_LoopReadLine,`;,
ifnotexist,%BX1%
continue
Filegettime,T1,%BX1%,C ;M A
stringleft,T1,T1,12
I++
stringlen, LenLine,BX1
StringGetPos,C,BX1,\,R1
If Errorlevel <> 0
C = 0
else
C := LenLine-C
stringright,SR,BX1,C-1
LV_Add("",SR,BX1,T1)
}
Splashimage,off
GuiControl,,total1,%I%
GUIControl,,Edit2,
return
}
I:=0
loop,read,%R3X%
{
BX1=
stringsplit,BX,A_LoopReadLine,`;,
ifnotexist,%BX1%
continue
Filegettime,T1,%BX1%,C ;M A
stringleft,T1,T1,12
ifinstring,BX1,%AL%
{
I++
stringlen, LenLine,BX1
StringGetPos,C,BX1,\,R1
If Errorlevel <> 0
C = 0
else
C := LenLine-C
stringright,SR,BX1,C-1
LV_Add("",SR,BX1,T1)
}
else
Continue
}
Splashimage,off
GuiControl,,total1,%I%
GUIControl,,Edit2,
return
;-----------------------------------------
MLV:
Gui,submit,nohide
if A_GuiEvent=Normal
{
LV_GetText(C1,A_EventInfo,1)
LV_GetText(C2,A_EventInfo,2)
C1=%C1%
stringright,C1R,C1,3
if C1R=M3U
{
GuiControl,,H2,---- OPEN FILE M3U with RightClick --- or -- DoubleClick to play all
Goto,NX1
}
if C2=
GuiControl,,H2,%C1%
else
GuiControl,,H2,%C2%
}
NX1:
if A_GuiEvent=K
{
GetKeyState,state,UP
if state=D
{
RF:=LV_GetNext("F")
LV_GetText(C2,RF,2)
ifnotexist,%C2%
{
RF:=RF-1
LV_GetText(C2,RF,2)
}
GuiControl,,H2,%C2%
run,%C2%
}
GetKeyState,state,DOWN
if state=D
{
RF:=LV_GetNext("F")
LV_GetText(C2,RF,2)
ifnotexist,%C2%
{
RF:=RF+1
LV_GetText(C2,RF,2)
}
GuiControl,,H2,%C2%
run,%C2%
}
}
;------ RightClick -----------------
if A_GuiEvent = RightClick
{
LV_GetText(C1,A_EventInfo,1)
C1=%C1%
stringright,C1R,C1,3
if C1R=M3U
{
GuiControl,,H2,%C5%`r`n%C2%
RN:=LV_GetNext("C") ;2 selected checked
RF:=LV_GetNext("F") ;2 selected focused
GC:=LV_GetCount() ;4 total
LV_GetText(C1,A_EventInfo,1)
GuiControl,,H2,%C1%
GuiControl,,Folder1,%C1%
R3X=%RU1%\%C1%
LV_Delete()
LV_ModifyCol(1,560)
LV_ModifyCol(2,0)
LV_ModifyCol(3,110)
Splashimage,,b1 x140 y0 w500 h30 CWred zh0,START READ
I:=0
loop,read,%R3X%
{
BX1=
stringsplit,BX,A_LoopReadLine,`;,
ifnotexist,%BX1%
continue
I++
stringright,P2,BX1,3
stringlen, LenLine,BX1
StringGetPos,C,BX1,\,R1
If Errorlevel <> 0
C = 0
else
C := LenLine-C
stringright,SR,BX1,C-1
Filegettime,T1,%BX1%,C ;M A
stringleft,T1,T1,12
if P2=MP3
LV_Add("",SR,BX1,T1)
if P2=WAV
LV_Add("",SR,BX1,T1)
else
Continue
}
Splashimage,off
GuiControl,,total1,%I%
return
}
}
;------------------------
if A_GuiEvent=DoubleClick
{
LV_GetText(C2,A_EventInfo,2)
RF:=LV_GetNext("F")
if RF=0
{
msgbox,Select a row
return
}
if C2=
{
msgbox,Column2 is empty
return
}
Splashimage,,b1 x140 y0 w500 h30 CWred zh0,START
Sleep,1500
GuiControl,,H2,%C2%
ifnotexist,%C2%
{
msgbox,%C2% < no more exist on this place
Goto,EX4
}
run,%C2%
Splashimage, off
return
}
EX4:
Splashimage, off
return
;==============================
MH3:
msgbox,PlayerM3U.ahk 2005-12-27-- garry`r`nhttp://www.autohotkey.com
return
MH2:
msgbox,Start: shows last created`r`nFile M3U:open with right click or double click to play`r`nSearch:xy or * for all again
return
MH1:
GuiControl,,H2,
MF=
FileSelectFolder,MF,,3
if MF=
return
Filedelete,%DFT%
GuiControl,,H2,Defined Folder= %MF%
fileappend,%MF%,%DFT%
return
;---------------------
buttonCreatePlayList:
GuiControl,,H2,
FileReadLine,DF,%DFT%,1
MF=
FileSelectFolder,MF,%DF%,3
if MF=
return
stringlen, LenLine, MF
StringGetPos,C, MF,\,R1
If Errorlevel <> 0
C = 0
else
C := LenLine-C
stringleft,MFL,MF,1
stringright,SR,MF,C-1
R3F=_M3U\HD_%MFL%_%SR%.m3u
runwait,%comspec% /C del _M3U\HD_%MFL%_%SR%.m3u,,hide
sleep,200
Splashimage,,b1 x140 y0 w500 h30 CWred zh0,START >> %SR%
mx:=0
Loop, %MF%\*.MP3, 0,1
{
Fileappend,%A_LoopFileFullPath%`r`n,%R3F%
mx++
}
Loop, %MF%\*.WAV, 0,1
{
Fileappend,%A_LoopFileFullPath%`r`n,%R3F%
mx++
}
Filedelete,%R3K%
Fileappend,HD_%MFL%_%SR%.m3u`r`n,%R3K%
Splashimage, off
GuiControl,,H2,--PLAYLIST= %MF%
if MX=0
{
msgbox,Not found MP3 or WAV
return
}
GuiControl,,Folder1,%SR%
Goto,LB
;---------
GuiClose:
ExitApp
|
Zuletzt bearbeitet von garry am Fr Dez 30, 2005 11:03 pm, insgesamt 4-mal bearbeitet |
|