FastJMAN1 Posted June 17, 2013 Posted June 17, 2013 (edited) Mp3SearchEngine v1.0.3.9 I really love this search engine.. I can only think of two things that would make this engine absolutely perfect. Can you look into adding http://www.mp3raid.com and youtube..... Also I found a few issues that was not working out for me and they were.. I couldn't search for the group "Solution .45" because first it did not show a period and after i fixed the expression then the period kept disappearing on me every time I moved the mouse over it.. Small bug but I corrected it.. You are outstanding on the Inet and HTLM reading into the sites.. That was done up real good and works with ease... Oh yah, I added a skin to it.. Hope you like that add on You will need these for the skin Find the Fileinstall on lines 49 and 50 and just change it to your directory SkinH.rar Here is my modified version expandcollapse popup#NoTrayIcon #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=C:\Windows\Loupe2.ico #AutoIt3Wrapper_Outfile_x64=Mp3DownloadEngine v1.0.3.9.exe #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_Res_Comment=Tested on Xp sp3, Vista and Seven 32 bit #AutoIt3Wrapper_Res_Description=Mp3 Search Engine, Search and Get mp3 from Internet. #AutoIt3Wrapper_Res_Fileversion=1.0.3.16 #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=P #AutoIt3Wrapper_Res_LegalCopyright=Copyright @ wakillon 2012 #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker ://////=__= ://////=__= #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #Region ;************ Includes ************ #Include <WindowsConstants.au3> #include <GuiConstantsEx.au3> #Include <ComboConstants.au3> #Include <GuiStatusBar.au3> #include <GuiListView.au3> #Include <Constants.au3> #Include <GDIPlus.au3> #include <WinHTTP.au3> #Include <String.au3> #include <Color.au3> #Include <File.au3> #Include <Math.au3> #Include <Date.au3> #include <Bass.au3> #Include <WinAPI.au3> #Include <Misc.au3> #include <ScreenCapture.au3> #include <Array.au3> #include <GUIFade.au3> #Include <GuiMonthCal.au3> #include <IE.au3> #include <GuiImageList.au3> #include <Icons.au3> #include <Process.au3> #Include <Clipboard.au3> #EndRegion ;************ Includes ************ Opt ( 'GuiCloseOnESC', 0 ) DirCreate ( @TempDir & "\TST\skin" ) FileInstall ("Your directory goes here\SkinH_EL.dll", @TempDir & "\TST\skin\SkinH_EL.dll") FileInstall ("Your directory goes here\whitefire.she", @TempDir & "\TST\skin\whitefire.she") Global $_TempDir = @TempDir & '\MSE' If $CMDLine[0] < 1 Then Opt ( 'GuiOnEventMode', 1 ) Opt ( 'TrayOnEventMode', 1 ) Opt ( 'TrayMenuMode', 1 ) #Region ------ Global Variables 1 ------------------------------ Global Const $STM_SETIMAGE = 0x0172 Global Const $SS_CENTER = 0x1 Global Const $BN_CLICKED = 0 Global $oMyError = ObjEvent ( 'AutoIt.Error', '_ErrFunc' ) Global $_Gui, $_Adjust, $_SearchButton, $_Animated_Gif, $oGifArray, $_ComboLinesArray[1], $_LimitCombo, $_Checkbox[10], $_Details, $_EditTitle Global $hListView, $_QueryInput, $_StatusBar, $_TopicLabel, $_EditItem = -1 Global $_RegKeySettings = 'HKCU\Software\Mp3SearchEngine\Settings' Global $_SoftTitle = 'Mp3SearchEngine' & ' v' & _GetScriptVersion ( ) & ' © wakillon 2013' Global $hGraphic1, $hImage1, $hImage3, $hImage4, $hImage5, $hImage6, $hImage7, $hImage8 Global $_BitmapHandle4, $_BitmapHandle5, $_BitmapHandle6, $_BitmapHandle7, $_BitmapHandle8 Global $_TimerInitSearch, $iLastItem = -1, $_Links, $sToolTipData, $_OverItem, $_ListViewPos, $_ItemRect, $iItem Global $_ToolTip, $_InetGet, $_InfoData, $_DownloadStart, $_ProgressCtrl, $_LabelResults, $_Mp3Title Global $_DownloadPercent, $_DownloadPercentOld, $_DownloadInfo, $_DownloadItem, $_EnableToolTips, $_AntiFlickeringTimerInit, $_SplashGui, $_EnableCheckForUpdates Global $_OutputDirPath = RegRead ( $_RegKeySettings, 'OutputDir' ), $_MaxResults = RegRead ( $_RegKeySettings, 'MaxResults' ), $_DisableInfos = RegRead ( $_RegKeySettings, 'DisableInfos' ) Global $_AboutItem, $_OutputDirItem, $_OnTopItem, $_TopicItem, $_MuteItem, $_Mute, $_TipItem, $_ExitItem, $_Mp3JuicesItem, $_BaseofmpItem, $_MpleerItem, $_TracktubeItem Global $_Mp3skullItem, $_SosoItem, $_YahooItem, $_DilandauItem, $_AudiodumpItem, $_MinimizeItem, $_ChangeDirItem, $_UpdateItem Global $_Timer1 = _NowCalc ( ) Global $_HttpOpenRequest, $_HttpConnect, $_HttpOpen, $_FileSize, $_Progression, $_HttpData, $_Data, $hSearchWnd, $_Search = -1, $_RegPreviousSound Global $_SearchExe = _GetOutFileName ( ), $_SearchExePath = @ScriptDir & '\' & $_SearchExe Global $_WinChildTitle = 'Search part of Mp3SearchEngine' Global $_SosoCookie, $_Mp3Handle, $_Mp3Url, $sBuffer, $_PlayButton, $_StopButton, $_PlayItem, $_Playing, $_Mp3Download, $_PlayText, $_UpdateLink Global $_PlayingStream, $_DownloadingStream, $_StreamHttpOpenRequest, $_StreamHttpConnect, $_StreamHttpOpen Global $_FileTemp = $_TempDir & '\StreamTmp.mp3', $_TmpFileOpen, $_StreamFileSize, $_Stop, $_DownloadText #EndRegion --- Global Variables 1 ------------------------------ #Region ------ Init 1 ------------------------------ If WinExists ( ' ' & $_SoftTitle ) Then Exit OnAutoItExitRegister ( '_OnAutoItExit' ) _StopSearching ( ) If Not _IsConnected ( ) Then Exit MsgBox ( 262144+16, 'Error', 'Exiting' & @CRLF & 'You are not Connected !', 5 ) _SetTrayMenu ( ) If $_EnableCheckForUpdates Then _LookForUpdate ( ) If _FileMissing ( ) Then _FileInstall ( ) _BASS_Startup ( @SystemDir & '\Bass.dll' ) _BASS_Init ( $BASS_DEVICE_MONO, -1, 44100, 0 ) ; $BASS_DEVICE_MONO uses less CPU than stereo. If @error Then Exit MsgBox ( 262144+16, 'Error', 'Could not initialize audio', 5 ) _BASS_SetConfig ( $BASS_CONFIG_NET_PREBUF, 10 ) ; Amount (percentage) to pre-buffer. _BASS_SetConfig ( $BASS_CONFIG_NET_BUFFER, 1000 ) ; buffer length in milliseconds. _BASS_SetConfig ( $BASS_CONFIG_GVOL_STREAM, 3000 ) ; 0 to 10000 _Gui ( ) _GetSosoCookie ( ) #EndRegion --- Init 1 ------------------------------ _WinAPI_RedrawWindow ( $_Gui ) #Region ------ Main Loop ------------------------------ While 1 #Region ------ ListViewTooltip ------------------------------ If $_ToolTip Then If IsArray ( $_ListViewPos ) And IsArray ( $_ItemRect ) Then ToolTip ( _StringToMultiLines ( $sToolTipData, 50 ), $_ListViewPos[0]+$_ItemRect[0]+50+420, $_ListViewPos[1]+$_ItemRect[1]+10, 'Mp3 Download Link', 1, 1+4 ) AdlibRegister ( '_ToolTipTimer', 2500 ) $_ToolTip = 0 EndIf EndIf #EndRegion --- ListViewTooltip ------------------------------ #Region ------ Start Download ------------------------------ If $_DownloadStart And IsArray ( $_Links ) Then If $_DownloadItem >= 0 And $_DownloadItem <= UBound ( $_Links ) -1 Then $_DownloadInfo = StringSplit ( $_Links[$_DownloadItem], '|' ) $_DownloadText = $_DownloadItem & ' ' & StringLeft ( $_DownloadInfo[1], 50 ) $_DownloadedFilePath = _GetFreePath ( $_OutputDirPath & '\' & $_DownloadInfo[1] & '.mp3' ) $_Mp3Download = $_DownloadInfo[1] If Not StringInStr ( $_DownloadInfo[2], 'qqmusic.qq.com' ) And Not StringInStr ( $_DownloadInfo[2], 'www.audiodump.com/download.php' ) And Not StringInStr ( $_DownloadInfo[2], 'Mp3Juices.info/download' ) Then $_GetSize = _InetGetSizeEx ( $_DownloadInfo[2], 6000 ) If $_GetSize Then $_InetGet = InetGet ( $_DownloadInfo[2], $_DownloadedFilePath, 1+2+8, 1 ) GUICtrlSetState ( $_ProgressCtrl, $GUI_SHOW ) Else If $_Details Then MsgBox ( 262144+16, 'Error', 'Sorry' & @CRLF & 'Server takes too long time to respond.' & @CRLF & 'Retry in a momment.' & @CRLF, 3 ) Else MsgBox ( 262144+16, 'Error', 'Sorry' & @CRLF & 'This Mp3 Link seems to be dead' & @CRLF & 'or the server takes too long time to respond.' & @CRLF, 3 ) EndIf EndIf Else If StringInStr ( $_DownloadInfo[2], 'qqmusic.qq.com' ) Then $_GetSize = _WinHttpGetFileSize ( $_DownloadInfo[2], $_SosoCookie ) Else $_GetSize = _WinHttpGetFileSize ( $_DownloadInfo[2] ) EndIf If $_GetSize Then If StringInStr ( $_DownloadInfo[2], 'qqmusic.qq.com' ) Then _WinHttpDownload ( $_DownloadInfo[2], $_SosoCookie ) Else _WinHttpDownload ( $_DownloadInfo[2], '' ) EndIf GUICtrlSetState ( $_ProgressCtrl, $GUI_SHOW ) Else If $_Details Then MsgBox ( 262144+16, 'Error', 'Sorry' & @CRLF & 'Server takes too long time to respond.' & @CRLF & 'Retry in a momment.' & @CRLF, 3 ) Else MsgBox ( 262144+16, 'Error', 'Sorry' & @CRLF & 'This Mp3 Link seems to be dead' & @CRLF & 'or the server takes too long time to respond.' & @CRLF, 3 ) EndIf EndIf EndIf $_DownloadStart = 0 EndIf EndIf #EndRegion --- Start Download ------------------------------ #Region ------ Progress download management ------------------------------ ; by Inetget for classic download If $_InetGet <> 0 Then $_InfoData = InetGetInfo ( $_InetGet ) If Not @error And $_InfoData <> '' Then $_DownloadPercent = Round ( ( 100 * $_InfoData[0] ) / $_InfoData[1] ) $_DownloadPercent = _Min ( _Max ( 1, $_DownloadPercent ), 100 ) If $_DownloadPercent <> $_DownloadPercentOld Then If TimerDiff ( $_AntiFlickeringTimerInit ) > 500 Then _GUICtrlStatusBar_SetText ( $_StatusBar, ' Downloading Sel : ' & $_DownloadText & ' - ' & $_DownloadPercent & '%' ) $_Mp3Download = $_DownloadInfo[1] GUICtrlSetData ( $_ProgressCtrl, $_DownloadPercent ) $_AntiFlickeringTimerInit = TimerInit ( ) EndIf $_DownloadPercentOld = $_DownloadPercent EndIf If InetGetInfo ( $_InetGet, 2 ) Then GUICtrlSetState ( $_ProgressCtrl, $GUI_HIDE ) GUICtrlSetData ( $_ProgressCtrl, 0 ) InetClose ( $_InetGet ) $_InetGet = 0 If $_Playing Or $_PlayingStream Then _GUICtrlStatusBar_SetText ( $_StatusBar, ' Playing Selection ' & $_PlayText ) Else If $_Search = 1 Then _GUICtrlStatusBar_SetText ( $_StatusBar, ' Searching Mp3 Songs' ) Else _GUICtrlStatusBar_SetText ( $_StatusBar, ' Waiting for Query...' ) EndIf EndIf If Not $_Mute Then SoundPlay ( @WindowsDir & '\Media\finish.wav' ) _ReduceMemory ( ) EndIf EndIf EndIf ; by WinHttp for download with cookie as soso.com or download with restriction ( wait 30sec between downloads) as audiodump.com or download from Mp3Juices with slow servers. If $_Progression <> 0 Then If TimerDiff ( $_AntiFlickeringTimerInit ) > 500 Then GUICtrlSetData ( $_ProgressCtrl, $_Progression ) _GUICtrlStatusBar_SetText ( $_StatusBar, ' Downloading Sel : ' & $_DownloadText & ' - ' & Round ( $_Progression, 1 ) & '%' ) $_AntiFlickeringTimerInit = TimerInit ( ) EndIf $_HttpData &= _WinHttpReadData ( $_HttpOpenRequest, 2, Round ( $_FileSize/1000, 0 ) ) If Not @extended Then $_Progression = 0 $_FileOpen = FileOpen ( $_DownloadedFilePath, 26 ) FileWrite ( $_FileOpen, $_HttpData ) FileClose ( $_FileOpen ) _WinHttpCloseHandle ( $_HttpOpenRequest ) _WinHttpCloseHandle ( $_HttpConnect ) _WinHttpCloseHandle ( $_HttpOpen ) $_HttpData=0 GUICtrlSetState ( $_ProgressCtrl, $GUI_HIDE ) GUICtrlSetData ( $_ProgressCtrl, 0 ) If $_Playing Or $_PlayingStream Then _GUICtrlStatusBar_SetText ( $_StatusBar, ' Playing Selection ' & $_PlayText ) Else If $_Search = 1 Then _GUICtrlStatusBar_SetText ( $_StatusBar, ' Searching Mp3 Songs' ) Else _GUICtrlStatusBar_SetText ( $_StatusBar, ' Waiting for Query...' ) EndIf EndIf If Not $_Mute Then SoundPlay ( @WindowsDir & '\Media\finish.wav' ) _ReduceMemory ( ) Else $_Progression += 0.1 $_Progression = _Min ( _Max ( 1, $_Progression ), 100 ) EndIf EndIf #EndRegion --- Progress download management ------------------------------ #Region ------ End of Search ------------------------------ If $_Search = 0 Then ; 1: searching , 0 end of search, -1 no search. Local $_Result = UBound ( $_Links ) -1 GUICtrlSetState ( $_LabelResults, $GUI_SHOW ) If $_Result Then GUICtrlSetData ( $_LabelResults, ' ' & $_Result & ' Download Links were found in ' & _TimeToString ( Round ( TimerDiff ( $_TimerInitSearch ), 0 ) ) ) If Not $_Mute Then SoundPlay ( @WindowsDir & '\media\done.wav' ) Else If Not ( $_InetGet Or $_Progression ) Then GUICtrlSetData ( $_LabelResults, ' No Results were found...' ) EndIf GUICtrlSetState ( $_Animated_Gif, $GUI_HIDE ) GUICtrlSetTip ( $_SearchButton, 'Launch the Search', ' ', 1, 1 ) GUICtrlSendMsg ( $_SearchButton, $STM_SETIMAGE, 0, $_BitmapHandle4 ) _GUICtrlListView_RedrawItems ( $hListView, 0, _GUICtrlListView_GetItemCount ( $hListView )-1 ) $_Search = -1 _ReduceMemory ( ) If $_InetGet + $_Progression <> 0 Then If $_InetGet Then _GUICtrlStatusBar_SetText ( $_StatusBar, ' Downloading Sel : ' & $_DownloadText & ' - ' & $_DownloadPercent & '%' ) If $_Progression Then _GUICtrlStatusBar_SetText ( $_StatusBar, ' Downloading Sel : ' & $_DownloadText & ' - ' & Round ( $_Progression, 1 ) & '%' ) Else If $_Playing Or $_PlayingStream Then _GUICtrlStatusBar_SetText ( $_StatusBar, ' Playing Selection ' & $_PlayText ) Else _GUICtrlStatusBar_SetText ( $_StatusBar, ' Waiting for Query...' ) EndIf EndIf EndIf #EndRegion --- End of Search ------------------------------ #Region ------ Playing Stream ------------------------------ If $_DownloadingStream Then $_ReadData = _WinHttpReadData ( $_StreamHttpOpenRequest, 2, Round ( $_StreamFileSize/100, 0 ) ) If Not @extended Then If FileGetSize ( $_FileTemp ) = $_StreamFileSize Then $_DownloadingStream = 0 Else $_TmpFileOpen = FileOpen ( $_FileTemp, 1+8+16 ) FileWrite ( $_TmpFileOpen, $_ReadData ) FileClose ( $_TmpFileOpen ) EndIf $_LoadPercent = FileGetSize ( $_FileTemp )*100/$_StreamFileSize If Not $_Mp3Handle And Not $_Stop And $_LoadPercent >= 5 Then $_Mp3Handle = _BASS_StreamCreateFile ( False, $_FileTemp, 0, 0, BitOR ( $BASS_STREAM_PRESCAN, $BASS_STREAM_AUTOFREE ) ) ; wait for 5% of download before start to play. _BASS_ChannelSetAttribute ( $_Mp3Handle, $BASS_ATTRIB_MUSIC_VOL_GLOBAL, 32 ) EndIf If $_Mp3Handle And Not _BASS_ChannelIsActive ( $_Mp3Handle ) And Not $_PlayingStream And _BASS_ChannelPlay ( $_Mp3Handle, True ) Then $_PlayingStream = 1 EndIf #EndRegion --- Playing Stream ------------------------------ $_NowCalc = _NowCalc ( ) If _DateDiff ( 's', $_Timer1, $_NowCalc ) >= 1 Then #Region ------ TrayItem Minimize Text Management ------------------------------ If _IsMinimized ( $_Gui ) Then TrayItemSetText ( $_MinimizeItem, 'Restore Window' ) GUISetState ( @SW_HIDE, $_Gui ) EndIf #EndRegion --- TrayItem Minimize Text Management ------------------------------ #Region ------ Search Process Management ------------------------------ If $_Search = 1 Then $_ProcessList = ProcessList ( $_SearchExe ) If Not @error And UBound ( $_ProcessList ) = 1 + @Compiled Then $_Search = 0 EndIf #EndRegion --- Search Process Management ------------------------------ #Region ------ Reset Play Button Management ------------------------------ If ( $_Playing Or $_PlayingStream ) And $_Mp3Handle And Not _BASS_ChannelIsActive ( $_Mp3Handle ) Then _StopPlaying ( ) #EndRegion --- Reset Play Button Management ------------------------------ $_Timer1 = $_NowCalc EndIf Sleep ( 10 ) WEnd #EndRegion --- Main Loop ------------------------------ Else OnAutoItExitRegister ( '_Exit2' ) #Region ------ Global Variables 2 ------------------------------ Global Const $SMTO_ABORTIFHUNG = 0x0002 Global Const $SMTO_NOTIMEOUTIFNOTHUNG = 0x0008 Global $_RegKeySettings = 'HKCU\Software\Mp3SearchEngine\Settings' Global $_SearchGui, $_Links, $_MainGuiHwnd, $_MainGuiTitle, $_InetGet, $_SosoCookie Global $_Bitrate, $_MediaInfoDll, $_SizeEx, $_Title2, $_MaxTimeOut = 3000 ;1500 Global $_TempFile = _GenerateRandomFileName ( $_TempDir, 'tmp' ) Global $_DilandauSrc = _GenerateRandomFileName ( $_TempDir, 'src' ), $hDownload2, $_DilandauUrl Global $_YahooSrc = _GenerateRandomFileName ( $_TempDir, 'src' ), $hDownload3, $_YahooUrl Global $_SosoSrc = _GenerateRandomFileName ( $_TempDir, 'src' ), $hDownload4, $_SosoUrl Global $_MpleerSrc = _GenerateRandomFileName ( $_TempDir, 'src' ), $hDownload6, $_MpleerUrl Global $_TracktubeSrc = _GenerateRandomFileName ( $_TempDir, 'src' ), $hDownload5, $_TracktubeUrl, $_DataBases[6] $_DataBases[1] = 'src=seekasong' $_DataBases[2] = 'src=mp3realm' $_DataBases[3] = 'src=musicmaza' $_DataBases[4] = 'src=dilandau' Global $_Mp3JuicesSrc = _GenerateRandomFileName ( $_TempDir, 'src' ), $hDownload7 Global $_Baseofmp3Src = _GenerateRandomFileName ( $_TempDir, 'src' ), $hDownload8, $_Baseofmp3Url Global $_AudiodumpSrc = _GenerateRandomFileName ( $_TempDir, 'src' ), $hDownload9, $_AudiodumpUrl #EndRegion --- Global Variables 2 ------------------------------ #Region ------ Init 2 ------------------------------ $_SearchGui = GUICreate ( 'Search part of Mp3SearchEngine' ) my_GuiSkin ($_SearchGui, @TempDir & '\TST\skin\darkroyale.she' ) GUISetState ( @SW_HIDE ) $_MediaInfoDll = DllOpen ( @SystemDir & '\MediaInfo.dll' ) Dim $_Links[1] $_Messages = StringSplit ( $CmdLineRaw, '|' ) ; split search engines Websites, Query, Details and Main gui hwnd. $_Messages[2] = StringStripWS ( StringLower ( $_Messages[2] ), 7 ) $_Details = $_Messages[3] $_MainGuiHwnd = $_Messages[4] $_MainGuiTitle = _GetWinTitleByHandle ( $_MainGuiHwnd ) If @Compiled Then AdlibRegister ( '_CheckMainGui', 3000 ) #EndRegion --- Init 2 ------------------------------ Switch $_Messages[1] Case 1 _Mp3Search_Skull ( $_Messages[2] ) Case 2 $_DilandauUrl = 'http://en.dilandau.eu/download_music/' & StringReplace ( $_Messages[2], ' ', '-' ) $hDownload2 = InetGet ( $_DilandauUrl & '-1.html', $_DilandauSrc, 1+2+8, 1 ) _Mp3Search_DilAndau ( $_Messages[2] ) Case 3 $_YahooUrl = 'http://music.yahoo.cn/s?q=' & StringReplace ( $_Messages[2], ' ', '%20' ) & '&m=5' $hDownload3 = InetGet ( $_YahooUrl & '&page=1', $_YahooSrc, 1+2+8, 1 ) _Mp3Search_Yahoo ( $_Messages[2] ) Case 4 $_SosoCookie = RegRead ( $_RegKeySettings, 'LastCookie' ) $_SosoUrl = 'http://cgi.music.soso.com/fcgi-bin/m.q?w=' & StringReplace ( $_Messages[2], ' ', '+' ) $hDownload4 = InetGet ( $_SosoUrl & '&p=1&source=1&t=1', $_SosoSrc, 1+2+8, 1 ) _Mp3Search_Soso ( $_Messages[2] ) Case 5 $_TracktubeUrl = 'http://tracktube.net/search.php?search=' & StringReplace ( $_Messages[2], ' ', '+' ) $hDownload5 = InetGet ( $_TracktubeUrl & '&type=mp3&' & $_DataBases[1] & '&page=1', $_TracktubeSrc, 1+2+8, 1 ) _Mp3Search_Tracktube ( $_Messages[2] ) Case 6 $_MpleerUrl = 'http://mpleer.ru/index.php?sea=' & StringReplace ( $_Messages[2], ' ', '%20' ) $hDownload6 = InetGet ( $_MpleerUrl & '&p=1', $_MpleerSrc, 1+2+8, 1 ) _Mp3Search_Mpleer ( $_Messages[2] ) Case 7 $_Mp3JuicesUrl = 'http://mp3juices.com/search/' & StringReplace ( StringStripWS ( StringLower ( $_Messages[2] ), 7 ), ' ', '-' ) & '/1' $hDownload7 = InetGet ( $_Mp3JuicesUrl, $_Mp3JuicesSrc, 1+2+8, 1 ) _Mp3Search_Mp3Juices ( $_Messages[2] ) Case 8 $_Baseofmp3Url = 'http://baseofmp3.com/?q=' & StringReplace ( StringStripWS ( StringLower ( $_Messages[2] ), 7 ), ' ', '+' ) & '&st=1' $hDownload8 = InetGet ( $_Baseofmp3Url, $_Baseofmp3Src, 1+2+8, 1 ) _Mp3Search_Baseofmp3 ( $_Messages[2] ) Case 9 $_AudiodumpUrl = 'http://www.audiodump.com/search.php?p=1&q=' & StringReplace ( $_Messages[2], ' ', '+' ) $hDownload9 = InetGet ( $_AudiodumpUrl, $_AudiodumpSrc, 1+2+8, 1 ) _Mp3Search_Audiodump ( $_Messages[2] ) Case Else EndSwitch _Exit2 ( ) EndIf Func my_GuiSkin ($hwnd, $_SheFilePath ) $Dll = DllOpen ( @TempDir & '\TST\skin\SkinH_EL.dll' ) DllCall ( $Dll, "int", "SkinH_AttachEx", "str", @TempDir & "\TST\skin\whitefire.she", "str", "mhgd" ) DllCall ( $Dll, "int", "SkinH_SetAero", "int", 1 ) EndFunc ;==> _GuiSkin ( ) $dll = DllOpen("user32.dll") Func _StartSearch ( ) GUICtrlSetPos ( $_SearchButton, 461, 130, 118, 24 ) Sleep ( 50 ) GUICtrlSetPos ( $_SearchButton, 460, 129, 120, 26 ) ToolTip ( '' ) If $_Search = 1 Then Sleep ( 50 ) _StopSearching ( ) $_Search = 0 Return Else Sleep ( 50 ) GUICtrlSetTip ( $_SearchButton, 'Stop the Search', ' ', 1, 1 ) GUICtrlSendMsg ( $_SearchButton, $STM_SETIMAGE, 0, $_BitmapHandle5 ) EndIf Local $_QueryWords = GUICtrlRead ( $_QueryInput ) If $_QueryWords And $_QueryWords <> 'Type a Song or Artist' Then If Not _AlreadyInArray ( $_ComboLinesArray, $_QueryWords, 1 ) Then _ArrayAdd ( $_ComboLinesArray, $_QueryWords ) _ArraySort ( $_ComboLinesArray, 0, 1 ) $_Data = _ArrayToString ( $_ComboLinesArray, '|', 1 ) GUICtrlSetData ( $_QueryInput, '', '' ) GUICtrlSetData ( $_QueryInput, $_Data, $_QueryWords ) EndIf _GUICtrlStatusBar_SetText ( $_StatusBar, ' Checking Connection...' ) AdlibRegister ( '_StatusBarTextTimer', 3000 ) If Not _IsConnected ( ) Then MsgBox ( 262144+16, 'Error', 'You are not Connected to Internet !', 4, $_Gui ) If $_InetGet + $_Progression + $_PlayingStream + $_Playing =0 Then _GUICtrlStatusBar_SetText ( $_StatusBar, ' Waiting for Query...' ) Sleep ( 50 ) _StopSearching ( ) Return EndIf $_Message=0 For $_I = 0 To UBound ( $_Checkbox ) -2 If _IsChecked ( $_Checkbox[$_I] ) Then $_Message += 1 Next $hSearchWnd = WinGetHandle ( $_WinChildTitle, '' ) If $_Message Then _GUICtrlListView_SetColumn ( $hListView, 1, 'Mp3', 40, 2 ) Sleep ( 20 ) _GUICtrlListView_DeleteAllItems ( $hListView ) If _IsChecked ( $_Checkbox[UBound ( $_Checkbox ) -1] ) Then _GUICtrlListView_HideColumn ( $hListView, 2 ) _GUICtrlListView_HideColumn ( $hListView, 3 ) _GUICtrlListView_HideColumn ( $hListView, 4 ) _GUICtrlListView_SetColumnWidth ( $hListView, 5, 80 ) _GUICtrlListView_SetColumnWidth ( $hListView, 0, 440 ) Else _GUICtrlListView_SetColumnWidth ( $hListView, 2, 50 ) _GUICtrlListView_SetColumnWidth ( $hListView, 3, 50 ) _GUICtrlListView_SetColumnWidth ( $hListView, 4, 45 ) _GUICtrlListView_SetColumnWidth ( $hListView, 5, 60 ) _GUICtrlListView_SetColumnWidth ( $hListView, 0, 315 ) EndIf Dim $_Links[1] GUICtrlSetState ( $_LabelResults, $GUI_HIDE ) $_TimerInitSearch = TimerInit ( ) GUICtrlSetState ( $_Animated_Gif, $GUI_SHOW ) If _IsChecked ( $_Checkbox[UBound ( $_Checkbox ) -1] ) Then $_Details = 0 Else $_Details = 1 EndIf $_QueryWords = StringStripWS ( StringRegExpReplace ( _StringReplaceAccent ( $_QueryWords ), '(?i)[^a-z0-9_\-\.]', ' ' ), 7 ) For $_I = 0 To UBound ( $_Checkbox ) -2 If _IsChecked ( $_Checkbox[$_I] ) Then If Not FileExists ( $_SearchExePath ) Then Exit MsgBox ( 262144+4096+16, 'Exiting on Error', @CRLF & $_SearchExe & ' is missing in ' & @ScriptDir & ' !' & @CRLF & @CRLF & 'Sorry but' & @CRLF & _ 'This script to run properly' & @CRLF & 'must be located next' & @CRLF & 'to this already COMPILED script !' & @CRLF & @CRLF, 15 ) Run ( '"' & $_SearchExePath & '" ' & $_I+1 & '|' & $_QueryWords & '|' & $_Details & '|' & $_Gui ) $_Search = 1 EndIf Next Else Sleep ( 50 ) _StopSearching ( ) MsgBox ( 262144+16, "Error", "No Search Engine is Selected" & @CRLF, 3 ) EndIf Else Sleep ( 50 ) _StopSearching ( ) EndIf EndFunc ;==> _StartSearch ( ) Func _StopSearching ( ) GUICtrlSetTip ( $_SearchButton, 'Launch the Search', ' ', 1, 1 ) GUICtrlSendMsg ( $_SearchButton, $STM_SETIMAGE, 0, $_BitmapHandle4 ) Local $_ProcessList = ProcessList ( $_SearchExe ) For $_I = 1 To UBound ( $_ProcessList ) -1 If $_ProcessList[$_I][1] <> @AutoItPID Then Do ProcessClose ( $_ProcessList[$_I][1] ) Until Not ProcessExists ( $_ProcessList[$_I][1] ) EndIf Next FileDelete ( $_TempDir & '\*.src' ) FileDelete ( $_TempDir & '\*.tmp' ) If $_Search = 1 Then $_Search = 0 EndFunc ;==> _StopSearching ( ) Func _Play ( ) GUICtrlSetPos ( $_PlayButton, 21, 570 - $_Adjust, 264, 18 ) _BASS_SetConfig ( $BASS_CONFIG_UPDATEPERIOD, 100 ) Sleep ( 100 ) GUICtrlSetPos ( $_PlayButton, 20, 569 - $_Adjust, 266, 20 ) If IsArray ( $_Links ) And $_PlayItem Then If $_Playing = 0 Then GUICtrlSendMsg ( $_PlayButton, $STM_SETIMAGE, 0, $_BitmapHandle7 ) GUICtrlSetTip ( $_PlayButton, 'Pause Playing Current Mp3', ' ', 1, 1 ) If _BASS_ChannelIsActive ( $_Mp3Handle ) Then _BASS_ChannelPlay ( $_Mp3Handle, False ) Else If $_PlayItem <= UBound ( $_Links ) -1 Then $_DownloadInfo = StringSplit ( $_Links[$_PlayItem], '|' ) $_Mp3Title = $_DownloadInfo[1] $_PlayText = $_PlayItem & ' ' & $_Mp3Title $_Mp3Url = $_DownloadInfo[2] If StringInStr ( $_Mp3Url, 'qqmusic.qq.com' ) = 0 And StringInStr ( $_Mp3Url, 'www.audiodump.com/download.php' ) = 0 And StringInStr ( $_Mp3Url, 'Mp3Juices.info/download' ) = 0 Then $_GetSize = _InetGetSizeEx ( $_Mp3Url, 6000 ) ;ConsoleWrite ( '-->-- [' & @ScriptLineNumber & '][' & @HOUR & @MIN & @SEC & '] $_GetSize : ' & $_GetSize & @Crlf ) If $_GetSize < 1024 Then _StopPlaying ( ) If $_Search = 1 Then MsgBox ( 262144+16, 'Error', 'Sorry' & @CRLF & 'Server takes too long time to respond' & @CRLF & 'Retry when Search is finished.' & @CRLF, 3 ) Else If $_Details Then MsgBox ( 262144+16, 'Error', 'Sorry' & @CRLF & 'Server takes too long time to respond.' & @CRLF & 'Retry in a momment.' & @CRLF, 3 ) Else MsgBox ( 262144+16, 'Error', 'Sorry' & @CRLF & 'This Mp3 Link seems to be dead' & @CRLF & 'or the server takes too long time to respond.' & @CRLF, 3 ) EndIf EndIf Return EndIf If StringInStr ( $_DownloadInfo[2], '%' ) Then $_Mp3Url = _UriDecode ( $_DownloadInfo[2] ) If $_Mp3Handle Then _BASS_StreamFree ( $_Mp3Handle ) $_Mp3Handle = _BASS_StreamCreateURL ( $_Mp3Url, 0, BitOR ( $BASS_STREAM_STATUS, $BASS_STREAM_AUTOFREE ) ) If @error Then $_Mp3Url = $_DownloadInfo[2] If $_Mp3Handle Then _BASS_StreamFree ( $_Mp3Handle ) $_Mp3Handle = _BASS_StreamCreateURL ( $_Mp3Url, 0, BitOR ( $BASS_STREAM_STATUS, $BASS_STREAM_AUTOFREE ) ) If @error Then _StopPlaying ( ) MsgBox ( 262144+16, 'Error', 'Can not load audio file' & @CRLF & 'Error = ' & @error, 3 ) Return EndIf Else If ( $_InetGet Or $_Progression ) Then _TrayTip ( $_SoftTitle, 'Actually Playing Selection ' & $_PlayText, 1 ) AdlibRegister ( '_TrayTipTimer', 5000 ) EndIf EndIf _BASS_ChannelPlay ( $_Mp3Handle, True ) Else FileDelete ( $_FileTemp ) $_StreamHttpOpen = _WinHttpOpen ( 'User-Agent:AutoIt3/' & @AutoItVersion ) Local $_HostName = _GetHostNameByUrl ( $_Mp3Url ) $_StreamHttpConnect = _WinHttpConnect ( $_StreamHttpOpen, $_HostName ) $_FileName = StringReplace ( StringReplace ( $_Mp3Url, 'http://', '' ), $_HostName, '' ) $_StreamHttpOpenRequest = _WinHttpOpenRequest ( $_StreamHttpConnect, 'GET', $_FileName, 'HTTP/1.1', $_HostName ) If StringInStr ( $_Mp3Url, 'www.audiodump.com/download.php' ) = 0 And $_SosoCookie <> '' Then _WinHttpAddRequestHeaders ( $_StreamHttpOpenRequest, 'Cookie:' & $_SosoCookie ) _WinHttpSendRequest ( $_StreamHttpOpenRequest ) _WinHttpReceiveResponse ( $_StreamHttpOpenRequest ) $_StreamFileSize = _WinHttpQueryHeaders ( $_StreamHttpOpenRequest, $WINHTTP_QUERY_CONTENT_LENGTH ) ;ConsoleWrite ( '-->-- [' & @ScriptLineNumber & '][' & @HOUR & @MIN & @SEC & '] $_StreamFileSize : ' & $_StreamFileSize & @Crlf ) If $_StreamFileSize < 1024 Then _StopPlaying ( ) If $_Search = 1 Then MsgBox ( 262144+16, 'Error', 'Sorry' & @CRLF & 'Server takes too long time to respond' & @CRLF & 'Retry when Search is finished.' & @CRLF, 3 ) Else MsgBox ( 262144+16, 'Error', 'Sorry' & @CRLF & "This Mp3 can't be read !" & @CRLF & 'Retry later...', 5 ) EndIf Return EndIf If $_Mp3Handle Then _BASS_StreamFree ( $_Mp3Handle ) $_Mp3Handle = 0 $_DownloadingStream = 1 $_TmpFileOpen = 0 If ( $_InetGet Or $_Progression ) Then _TrayTip ( $_SoftTitle, 'Actually Playing Selection ' & $_PlayText, 1 ) AdlibRegister ( '_TrayTipTimer', 5000 ) EndIf EndIf EndIf EndIf $_Playing=1 If Not ( $_InetGet Or $_Progression ) Then _GUICtrlStatusBar_SetText ( $_StatusBar, ' Playing Selection ' & $_PlayText ) $_Stop = 0 Else GUICtrlSetTip ( $_PlayButton, 'Play Last Selected Mp3', ' ', 1, 1 ) GUICtrlSendMsg ( $_PlayButton, $STM_SETIMAGE, 0, $_BitmapHandle6 ) _BASS_ChannelPause ( $_Mp3Handle ) $_Playing=0 If Not ( $_InetGet Or $_Progression ) Then _GUICtrlStatusBar_SetText ( $_StatusBar, ' Pausing ' & $_PlayText ) EndIf EndIf EndFunc ;==> _Play ( ) Func _StopPlaying ( ) _BASS_SetConfig ( $BASS_CONFIG_UPDATEPERIOD, 0 ) $_Stop = 1 $_Playing = 0 $_PlayText = '' $_PlayingStream = 0 $_DownloadingStream = 0 GUICtrlSetPos ( $_StopButton, 315, 570 - $_Adjust, 264, 18 ) Sleep ( 50 ) GUICtrlSetPos ( $_StopButton, 314, 569 - $_Adjust, 266, 20 ) GUICtrlSendMsg ( $_PlayButton, $STM_SETIMAGE, 0, $_BitmapHandle6 ) GUICtrlSetTip ( $_PlayButton, 'Play Last Selected Mp3', ' ', 1, 1 ) If _BASS_ChannelIsActive ( $_Mp3Handle ) Then _BASS_ChannelStop ( $_Mp3Handle ) If $_StreamHttpOpenRequest Then _WinHttpCloseHandle ( $_StreamHttpOpenRequest ) If $_StreamHttpConnect Then _WinHttpCloseHandle ( $_StreamHttpConnect ) If $_StreamHttpOpen Then _WinHttpCloseHandle ( $_StreamHttpOpen ) $_StreamHttpOpenRequest=0 $_StreamHttpConnect=0 $_StreamHttpOpen=0 If $_Mp3Handle Then _BASS_StreamFree ( $_Mp3Handle ) $_Mp3Handle = 0 _ReduceMemory ( ) If $_TmpFileOpen Then FileClose ( $_TmpFileOpen ) $_TmpFileOpen = 0 FileDelete ( $_FileTemp ) If $_InetGet + $_Progression <> 0 Then If $_InetGet Then _GUICtrlStatusBar_SetText ( $_StatusBar, ' Downloading Sel : ' & $_DownloadText & ' - ' & $_DownloadPercent & '%' ) If $_Progression Then _GUICtrlStatusBar_SetText ( $_StatusBar, ' Downloading Sel : ' & $_DownloadText & ' - ' & Round ( $_Progression, 1 ) & '%' ) Else If $_Search = 1 Then _GUICtrlStatusBar_SetText ( $_StatusBar, ' Searching Mp3 Songs' ) Else _GUICtrlStatusBar_SetText ( $_StatusBar, ' Waiting for Query...' ) EndIf EndIf EndFunc ;==> _StopPlaying ( ) Func _InetGetSizeEx ( $_FileUrl, $_TimeOut ) Local $_TempFile = $_TempDir & '\tmp2.tmp', $_IsMp3, $_Size If FileExists ( $_TempFile ) Then FileDelete ( $_TempFile ) Local $_InetTimerInit = TimerInit ( ) Local $_InetGetEx = InetGet ( $_FileUrl, $_TempFile, 11, 1 ) $_Bitrate='' Do $_Size = InetGetInfo ( $_InetGetEx, 1 ) If $_Size > 0 Then $_IsMp3 = _IsMp3 ( $_TempFile ) If $_IsMp3 Then InetClose ( $_InetGetEx ) $_InetGetEx = 0 FileDelete ( $_TempFile ) Return $_Size EndIf EndIf Sleep ( 250 ) Until TimerDiff ( $_InetTimerInit ) > $_TimeOut InetClose ( $_InetGetEx ) $_InetGetEx = 0 If Not $_IsMp3 Then $_Size = 0 FileDelete ( $_TempFile ) Return $_Size EndFunc ;==> _InetGetSizeEx ( ) Func _IsMp3 ( $_Mp3FilePath ) Local $_Header = StringToBinary ( FileRead ( $_Mp3FilePath ) ) $_Header = StringReplace ( StringTrimLeft ( $_Header, 2 ), '00', '' ) If StringLeft ( $_Header, 6 ) = '494433' Or StringLeft ( $_Header, 2 ) = 'FF' Then Return True EndFunc ;==> _IsMp3 ( ) #Region ------ Gui Management ------------------------------ Func _Gui ( ) $_Adjust = 0 If @DesktopHeight < 605 Then $_Adjust = 140 ; for netbook display. $_Gui = GUICreate ( ' ' & $_SoftTitle, 600, 680 - $_Adjust ) my_GuiSkin ($_Gui, @TempDir & '\TST\skin\whitefire.she' ) GUISetOnEvent ( $GUI_EVENT_CLOSE, '_Exit', $_Gui ) _GDIPlus_StartUp ( ) $_TopicLabel = GUICtrlCreateLabel ( '', 75, 21, 450, 58, 0x0100 ) GUICtrlSetCursor ( -1, 0 ) GUICtrlSetBkColor ( -1, $GUI_BKCOLOR_TRANSPARENT ) GUICtrlSetTip ( -1, 'Go to Mp3SearchEngine Topic' ) _GuiSetGradientBkColor ( $_Gui, 0xFE9900, 0xAB1700 ) $_CtrlBkColor1 = 0xE77600 $_CtrlBkColor2 = 0xE67300 GUISetIcon ( @WindowsDir & '\Loupe2.ico' ) $hImage1 = _GDIPlus_ImageLoadFromFile ( $_TempDir & '\MSE_Logo1.PNG' ) $hGraphic1 = _GDIPlus_GraphicsCreateFromHWND ( $_Gui ) _GDIPlus_GraphicsDrawImageRect ( $hGraphic1, $hImage1, 50, 20, 500, 100 ) $_QueryLabel = GUICtrlCreatePic ( '', 20, 129, 120, 26 ) $hImage3 = _GDIPlus_ImageLoadFromFile ( $_TempDir & '\QueryButton1.PNG' ) $_BitmapHandle3 = _GDIPlus_BitmapCreateHBITMAPFromBitmap ( $hImage3, 0xFF000000 ) GUICtrlSendMsg ( $_QueryLabel, $STM_SETIMAGE, 0, $_BitmapHandle3 ) $_QueryInput = GUICtrlCreateCombo ( 'Type a Song or Artist', 160, 130, 280, 23, BitOR ( $GUI_SS_DEFAULT_COMBO, $CBS_LOWERCASE ) ) GUICtrlSetFont ( -1, 10, 800 ) ;GUICtrlSetTip ( -1, 'Type a Song or Artist', ' ', 1, 1 ) $_SearchButton = GUICtrlCreatePic ( '', 460, 129, 120, 26 ) GUICtrlSetOnEvent ( -1, '_StartSearch' ) GUICtrlSetTip ( -1, 'Launch the Search', ' ', 1, 1 ) $hImage4 = _GDIPlus_ImageLoadFromFile ( $_TempDir & '\SearchButton1.PNG' ) $_BitmapHandle4 = _GDIPlus_BitmapCreateHBITMAPFromBitmap ( $hImage4, 0xFF000000 ) GUICtrlSendMsg ( $_SearchButton, $STM_SETIMAGE, 0, $_BitmapHandle4 ) $hImage5 = _GDIPlus_ImageLoadFromFile ( $_TempDir & '\StopButton1.png' ) $_BitmapHandle5 = _GDIPlus_BitmapCreateHBITMAPFromBitmap ( $hImage5, 0xFF000000 ) $_CheckBoxText = StringSplit ( 'mp3skull|dilandau|yahoo|soso|tracktube|mpleer|mp3juices|baseofmp3|audiodump|Disable Infos on Mp3', '|' ) $_CtrlBkColor = $_CtrlBkColor1 For $_I = 0 To UBound ( $_Checkbox ) -1 If $_I < UBound ( $_Checkbox ) -1 Then $_X= $_I $_Y = 165 If $_I > 4 Then $_Y = 185 $_X = $_I -5 $_CtrlBkColor = $_CtrlBkColor2 EndIf $_Checkbox[$_I] = GUICtrlCreateCheckbox ( $_CheckBoxText[$_I+1], 20 + $_X*84, $_Y, 80, 20 ) GUICtrlSetBkColor ( -1, $_CtrlBkColor ) GUICtrlSetState ( -1, $GUI_CHECKED ) GUICtrlSetTip ( -1, 'Select Search Engines Website', ' ', 1, 1 ) Else $_Checkbox[$_I] = GUICtrlCreateCheckbox ( $_CheckBoxText[$_I+1], 460, 165, 120, 20 ) GUICtrlSetOnEvent ( -1, '_HideColumns' ) GUICtrlSetBkColor ( -1, $_CtrlBkColor1 ) GUICtrlSetTip ( -1, 'Links are not checked and there is no Infos on Mp3' & @CRLF & "But it's really more fast !", 'Disable Infos on Mp3 :', 1, 1 ) If $_DisableInfos = 'True' Then GUICtrlSetState ( -1, $GUI_CHECKED ) EndIf Next GUICtrlCreateLabel ( 'Max results :', 460, 188, 100, 20 ) GUICtrlSetBkColor ( -1, $_CtrlBkColor2 ) $_LimitCombo = GUICtrlCreateCombo ( '', 530, 185, 50, 20 ) GUICtrlSetOnEvent ( -1, '_MaxResults' ) If $_MaxResults = '' Then $_MaxResults = 50 GUICtrlSetData ( -1, '30|50|100|200|300|400|500|All', $_MaxResults ) $hListView = _GUICtrlListView_Create ( $_Gui, '', 20, 210, 560, 350 - $_Adjust, BitOR ( $LVS_REPORT, $LVS_SINGLESEL, $LVS_SHOWSELALWAYS, $LVS_EDITLABELS ) ) _GUICtrlListView_RegisterSortCallBack ( $hListView ) _GUICtrlListView_SetExtendedListViewStyle ( $hListView, BitOR ( $LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_HEADERDRAGDROP, $LVS_EX_DOUBLEBUFFER ) ) _GUICtrlListView_AddColumn ( $hListView, 'Title', 315 ) _GUICtrlListView_AddColumn ( $hListView, 'Mp3', 40 ) _GUICtrlListView_AddColumn ( $hListView, 'Size', 50 ) _GUICtrlListView_AddColumn ( $hListView, 'Time', 50 ) _GUICtrlListView_AddColumn ( $hListView, 'Bitrate', 45 ) _GUICtrlListView_AddColumn ( $hListView, 'From', 60 ) _GUICtrlListView_SetBkColor ( $hListView, $CLR_BLACK ) _GUICtrlListView_SetTextColor ( $hListView, 0x55BBFF ) _GUICtrlListView_SetTextBkColor ( $hListView, $CLR_BLACK ) _GUICtrlListView_SetColumnOrder ( $hListView, '1|0|2|3|4|5' ) _GUICtrlListView_JustifyColumn ( $hListView, 1, 2 ) _GUICtrlListView_JustifyColumn ( $hListView, 2, 2 ) _GUICtrlListView_JustifyColumn ( $hListView, 3, 2 ) _GUICtrlListView_JustifyColumn ( $hListView, 4, 2 ) $_PlayButton = GUICtrlCreatePic ( '', 20, 569 - $_Adjust, 266, 20 ) GUICtrlSetOnEvent ( -1, '_Play' ) GUICtrlSetTip ( -1, 'Play Last Selected Mp3', ' ', 1, 1 ) $hImage6 = _GDIPlus_ImageLoadFromFile ( $_TempDir & '\PlayButton.png' ) $_BitmapHandle6 = _GDIPlus_BitmapCreateHBITMAPFromBitmap ( $hImage6, 0xFF000000 ) GUICtrlSendMsg ( $_PlayButton, $STM_SETIMAGE, 0, $_BitmapHandle6 ) $hImage7 = _GDIPlus_ImageLoadFromFile ( $_TempDir & '\PauseButton.png' ) $_BitmapHandle7 = _GDIPlus_BitmapCreateHBITMAPFromBitmap ( $hImage7, 0xFF000000 ) $_StopButton = GUICtrlCreatePic ( '', 314, 569 - $_Adjust, 266, 20 ) GUICtrlSetOnEvent ( -1, '_StopPlaying' ) GUICtrlSetTip ( -1, 'Stop To Play Current Mp3', ' ', 1, 1 ) $hImage8 = _GDIPlus_ImageLoadFromFile ( $_TempDir & '\StopPlayButton.png' ) $_BitmapHandle8 = _GDIPlus_BitmapCreateHBITMAPFromBitmap ( $hImage8, 0xFF000000 ) GUICtrlSendMsg ( $_StopButton, $STM_SETIMAGE, 0, $_BitmapHandle8 ) $_ProgressCtrl = GUICtrlCreateProgress ( 20, 605 - $_Adjust, 560, 20 ) GUICtrlSetState ( -1, $GUI_HIDE ) $_LabelResults = GUICtrlCreateLabel ( '', 20, 630 - $_Adjust, 560, 20, $SS_CENTER ) GUICtrlSetColor ( -1, 0x000000 ) GUICtrlSetFont ( -1, 11, 800 ) GUICtrlSetBkColor ( -1, $GUI_BKCOLOR_TRANSPARENT ) GUICtrlSetState ( -1, $GUI_HIDE ) $_StatusBar = _GUICtrlStatusBar_Create ( $_Gui ) _GUICtrlStatusBar_SetMinHeight ( $_StatusBar, 25 ) _GUICtrlStatusBar_SetFont ( $_StatusBar, 16, 800 ) _GUICtrlStatusBar_SetText ( $_StatusBar, ' Waiting for Query...' ) $_Animated_Gif = _GuiCreateAnimatedGifCtrl ( $_Gui, $_TempDir & '\PreLoader1.gif', 50, 50, 275, 80, 1 ) GUICtrlSetState ( $_Animated_Gif, $GUI_HIDE ) GUIRegisterMsg ( $WM_PAINT, '_WM_PAINT' ) GUIRegisterMsg ( $WM_NCPAINT, '_WM_PAINT' ) GUIRegisterMsg ( $WM_NOTIFY, '_WM_NOTIFY' ) GUIRegisterMsg ( $WM_COPYDATA, '_WM_ReceivedData' ) GUIRegisterMsg ( $WM_SETCURSOR, '_WM_SETCURSOR' ) GUIRegisterMsg ( $WM_COMMAND, '_WM_COMMAND' ) GUISetState ( ) _OnTop ( ) EndFunc ;==> _Gui ( ) Func _MaxResults ( ) RegWrite ( $_RegKeySettings, 'MaxResults', 'REG_SZ', GUICtrlRead ( $_LimitCombo ) ) EndFunc ;==> _MaxResults ( ) Func _HideColumns ( ) RegWrite ( $_RegKeySettings, 'DisableInfos', 'REG_SZ', _IsChecked ( $_Checkbox[UBound ( $_Checkbox ) -1] ) ) EndFunc ;==> _HideColumns ( ) Func _ListView_AddItems ( $_Index, $_Text, $_Mp3Size, $_Bitrate, $_From ) Local $iIndex = _GUICtrlListView_AddItem ( $hListView, $_Text, -1, _GUICtrlListView_GetItemCount ( $hListView ) ) If $iIndex <> -1 Then _GUICtrlListView_AddSubItem ( $hListView, $iIndex, StringFormat ( '%03d ', $_Index ), 1 ) _GUICtrlListView_AddSubItem ( $hListView, $iIndex, Round ( $_Mp3Size/1024/1024, 2 ), 2 ) _GUICtrlListView_AddSubItem ( $hListView, $iIndex, StringReplace ( StringReplace ( _TimeToString ( 8*$_Mp3Size / $_Bitrate, 1 ), 'min', ':' ), 'sec', '' ), 3 ) _GUICtrlListView_AddSubItem ( $hListView, $iIndex, $_Bitrate, 4 ) Local $_Total = StringFormat ( '%03d ', _GUICtrlListView_GetItemCount ( $hListView ) ) Switch StringLen ( $_Total ) Case 4 $_ColumnWidth = 40 Case Else $_ColumnWidth = 45 EndSwitch _GUICtrlListView_SetColumn ( $hListView, 1, $_Total, $_ColumnWidth, 2 ) _GUICtrlListView_AddSubItem ( $hListView, $iIndex, $_From, 5 ) EndIf EndFunc ;==> _ListView_AddItems ( ) Func _GUICtrlStatusBar_SetFont ( $hWnd, $iHeight=15, $iWeight=400, $iFontAtrributes=0, $sFontName='Arial' ) If Not IsHWnd ( $hWnd ) Then $hWnd = GUICtrlGetHandle ( $hWnd ) $hFont = _WinAPI_CreateFont ( $iHeight, 0, 0, 0, $iWeight, BitAND ( $iFontAtrributes, 2 ), BitAND ( $iFontAtrributes, 4 ), _ BitAND ( $iFontAtrributes, 8 ), $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, $sFontName ) _SendMessage ( $hWnd, $WM_SETFONT, $hFont, 1 ) EndFunc ;==> _GUICtrlStatusBar_SetFont ( ) Func _GuiCreateAnimatedGifCtrl ( $hwnd, $_GifPath, $_Width, $_Height, $_Left=0, $_Top=0, $_Glass=1 ) If Not FileExists ( $_GifPath ) Then Return SetError ( 1 ) $oGif = ObjCreate ( 'Gif89.Gif89.1' ) If @error Then Return SetError ( 2 ) $oGifCtrl = GUICtrlCreateObj ( $oGif, $_Left, $_Top, $_Width, $_Height ) If Not $oGifCtrl Then Return SetError ( 3 ) If $_Glass Then $oGif.glass = True If IsObj ( $oGif ) Then $oGif.filename = $_GifPath Return $oGifCtrl EndFunc ;==> _GuiCreateAnimatedGifCtrl ( ) Func _GuiSetGradientBkColor ( $nXSkinGUI, $nStartColor, $nEndColor ) ; by Valuater Local $nSize = WinGetClientSize ( $nXSkinGUI ) Local $nX=0, $nY=0, $nWidth=$nSize[0], $nHeight=$nSize[1] Local $color1R = _ColorGetRed ( $nStartColor ) Local $color1G = _ColorGetGreen ( $nStartColor ) Local $color1B = _ColorGetBlue ( $nStartColor ) Local $nStepR = ( _ColorGetRed ( $nEndColor ) - $color1R ) / $nHeight Local $nStepG = ( _ColorGetGreen ( $nEndColor ) - $color1G ) / $nHeight Local $nStepB = ( _ColorGetBlue ( $nEndColor ) - $color1B ) / $nHeight $nGraph = GuiCtrlCreateGraphic ( $nX, $nY, $nWidth, $nHeight ) For $i = 0 To $nHeight - $nY $sColor = '0x' & StringFormat ( '%02X%02X%02X', $color1R+$nStepR*$i, $color1G+$nStepG*$i, $color1B+$nStepB*$i ) GUICtrlSetGraphic ( -1, $GUI_GR_COLOR, $sColor, 0xffffff ) GUICtrlSetGraphic ( -1, $GUI_GR_MOVE, 0, $i ) GUICtrlSetGraphic ( -1, $GUI_GR_LINE, $nWidth, $i ) Next GUICtrlSetState ( $nGraph, $GUI_DISABLE ) Return $nGraph EndFunc ;==> _GuiSetGradientBkColor ( ) #EndRegion --- Gui Management ------------------------------ #Region ------ Messages Management ------------------------------ Func _WM_ReceivedData ( $hWnd, $msgID, $wParam, $lParam ) Switch $hWnd Case $_Gui Local $tCOPYDATA = DllStructCreate ( 'ulong_ptr;dword;ptr', $lParam ) Local $tMsg = DllStructCreate ( 'char[' & DllStructGetData ( $tCOPYDATA, 2 ) & ']', DllStructGetData ( $tCOPYDATA, 3 ) ) $_MsgFromSearch = DllStructGetData ( $tMsg, 1 ) ;ConsoleWrite ( '-->-- [' & @ScriptLineNumber & '][' & @HOUR & @MIN & @SEC & '] ' & UBound ( $_Links ) & ' MsgFromSearch : ' & $_MsgFromSearch & @Crlf ) If GUICtrlRead ( $_LimitCombo ) = 'All' Or UBound ( $_Links) -1 < GUICtrlRead ( $_LimitCombo ) Then $_Datas = StringSplit ( $_MsgFromSearch, '|' ) If UBound ( $_Datas ) < 6 Then Return $GUI_RUNDEFMSG If Not _AlreadyInArray ( $_Links, $_Datas[2], 1, 1 ) Then If StringInStr ( $_Datas[2], 'qqmusic.qq.com' ) And Not StringInStr ( $_SosoCookie, 'qqmusic_sosokey' ) Then Return 0 ; if not good cookie _ArrayAdd ( $_Links, $_Datas[1] & '|' & $_Datas[2] ) If Not @error Then _ListView_AddItems ( UBound ( $_Links )-1, $_Datas[1], $_Datas[3], $_Datas[4], $_Datas[5] ) EndIf Else _StopSearching ( ) EndIf Return 0 EndSwitch EndFunc ;==> _WM_ReceivedData ( ) Func _WM_SendData ( $hWnd, $sData ) Local $tCOPYDATA, $tMsg, $Ret $tMsg = DllStructCreate ( 'char[' & StringLen ( $sData ) + 1 & ']' ) DllStructSetData ( $tMsg, 1, $sData ) $tCOPYDATA = DllStructCreate ( 'ulong_ptr;dword;ptr' ) DllStructSetData ( $tCOPYDATA, 2, StringLen ( $sData ) + 1 ) DllStructSetData ( $tCOPYDATA, 3, DllStructGetPtr ( $tMsg ) ) While 1 $_Ret = DllCall ( 'user32.dll', 'int', 'IsHungAppWindow', 'hwnd', $_MainGuiHwnd ) If Not @error And Not $_Ret[0] Then ExitLoop Sleep ( 100 ) WEnd $Ret = DllCall ( 'user32.dll', 'lparam', 'SendMessageTimeout', 'hwnd', $hWnd, 'int', $WM_COPYDATA, 'wparam', 0, 'lparam', DllStructGetPtr ( $tCOPYDATA ), 'uint', BitOR ( $SMTO_ABORTIFHUNG, $SMTO_NOTIMEOUTIFNOTHUNG ), 'uint', 1000, 'dword_ptr*', 0 ) ; ok If @error Or $Ret[0] = -1 Then Return 0 Return 1 EndFunc ;==> _WM_SendData ( ) Func _WM_NOTIFY ( $hWnd, $Msg, $wParam, $lParam ) Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR $tNMHDR = DllStructCreate ( $tagNMHDR, $lParam ) $hWndFrom = HWnd ( DllStructGetData ( $tNMHDR, 'hWndFrom' ) ) $iIDFrom = DllStructGetData ( $tNMHDR, 'IDFrom' ) $iCode = DllStructGetData ( $tNMHDR, 'Code' ) Switch $hWndFrom Case $hListView Local $tInfo = DllStructCreate ( $tagNMLISTVIEW, $lParam ) $iItem = DllStructGetData ( $tInfo, 'Item' ) Switch $iCode Case $LVN_BEGINLABELEDITA, $LVN_BEGINLABELEDITW $_EditItem = _GUICtrlListView_GetItemText ( $hWndFrom, _GUICtrlListView_GetSelectedIndices ( $hWndFrom ), 1 ) $_EditTitle = _GUICtrlListView_GetItemText ( $hWndFrom, _GUICtrlListView_GetSelectedIndices ( $hWndFrom ), 0 ) Local $tInfo = DllStructCreate ( $tagNMLVDISPINFO, $lParam ) Return False Case $LVN_ENDLABELEDITA, $LVN_ENDLABELEDITW Local $tInfo = DllStructCreate ( $tagNMLVDISPINFO, $lParam ) Local $iTextMax = DllStructGetData ( $tInfo, 'TextMax' ) Local $pText = DllStructGetData ( $tInfo, 'Text' ) If $pText = 0 Then Return False Local $sBuffer = 'char Text[' & $iTextMax & ']' If $iCode = $LVN_ENDLABELEDITW Then $sBuffer = 'wchar Text[' & $iTextMax & ']' Local $tBuffer = DllStructCreate ( $sBuffer, $pText ) Local $sNewText = DllStructGetData ( $tBuffer, 'Text' ) If StringLen ( $sNewText ) Then $_Links[$_EditItem] = StringReplace ( $_Links[$_EditItem], $_EditTitle, $sNewText ) Return True EndIf Case $LVN_HOTTRACK If $iLastItem = $iItem Or $iItem = -1 Or $iItem +1 > UBound ( $_Links ) -1 Then Return $_OverItem = _GUICtrlListView_GetItemText ( $hWndFrom, $iItem, 1 ) If $_OverItem > UBound ( $_Links ) -1 Then Return $sToolTipData = StringSplit ( $_Links[$_OverItem], '|' ) If Not @error Then $_ItemRect = _GUICtrlListView_GetItemRect ( $hWndFrom, $iItem ) $_ListViewPos = WinGetPos ( $hWndFrom ) $iLastItem = $iItem $sToolTipData = $sToolTipData[2] _GUICtrlListView_SetItemSelected ( $hWndFrom, $iItem, True, False ) If $_EnableToolTips Then $_ToolTip = 1 EndIf Case $LVN_ENDSCROLL _GUICtrlListView_RedrawItems ( $hWndFrom, 0, _GUICtrlListView_GetItemCount ( $hWndFrom )-1 ) Case $LVN_COLUMNCLICK _GUICtrlListView_SortItems ( $hWndFrom, DllStructGetData ( DllStructCreate ( $tagNMLISTVIEW, $lParam ), "SubItem" ) ) Case $NM_DBLCLK If $iItem >= 0 And $_InetGet + $_Progression = 0 Then $_DownloadItem = _GUICtrlListView_GetItemText ( $hWndFrom, _GUICtrlListView_GetSelectedIndices ( $hWndFrom ), 1 ) $_DownloadStart = 1 EndIf Case $NM_CLICK ToolTip ( '' ) $_PlayItem = _GUICtrlListView_GetItemText ( $hWndFrom, _GUICtrlListView_GetSelectedIndices ( $hWndFrom ), 1 ) If $_PlayItem Then GUICtrlSetState ( $_LabelResults, $GUI_SHOW ) GUICtrlSetData ( $_LabelResults, 'Last Selection : ' & $_PlayItem & ' ' & StringLeft ( _GUICtrlListView_GetItemText ( $hWndFrom, _GUICtrlListView_GetSelectedIndices ( $hWndFrom ), 0 ), 50 ) ) EndIf $_Title = _GUICtrlListView_GetItemText ( $hWndFrom, _GUICtrlListView_GetSelectedIndices ( $hWndFrom ), 0 ) If _IsPressed ( '10' ) Then ; 10 Left SHIFT key ClipPut ( $_Title ) _TrayTip ( $_SoftTitle, 'Title : ' & $_Title & @CRLF & ' was copied to the Clipboard ', 1 ) AdlibRegister ( '_TrayTipTimer', 5000 ) EndIf If _IsPressed ( '11' ) Then ; 11 Left Ctrl key ClipPut ( $sToolTipData ) _TrayTip ( $_SoftTitle, 'Url : ' & $sToolTipData & @CRLF & ' was copied to the Clipboard ', 1 ) AdlibRegister ( '_TrayTipTimer', 5000 ) EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==> _WM_NOTIFY ( ) Func _WM_COMMAND ( $hWnd, $Msg, $wParam, $lParam ) Switch $hWnd Case $_Gui Local $_QueryInputRead = GUICtrlRead ( $_QueryInput ) Local $_QueryInputReplace = StringRegExpReplace ( _StringReplaceAccent ( $_QueryInputRead ), '(?i)[^a-z0-9_\-\.]', ' ' ) ;All possible expressions; ^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$ If $_QueryInputReplace <> $_QueryInputRead Then GUICtrlSetData ( $_QueryInput, StringStripWS ( $_QueryInputReplace, 5 ) ) ControlSend ( $_Gui, '', $_QueryInput, '{END}' ) EndIf Local $nNotifyCode = BitShift ( $wParam, 16 ) Switch $nNotifyCode Case $BN_CLICKED GUICtrlSetState ( $_QueryInput, $GUI_FOCUS ) EndSwitch Local $nID = BitAND ( $wParam, 0x0000FFFF ) Switch $nID Case 1 ; Enter key _StartSearch ( ) Case 2 ; Esc key GUICtrlSetData ( $_QueryInput, '' ) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==> _WM_COMMAND ( ) Func _WM_PAINT ( $hWnd, $Msg, $wParam, $lParam ) Switch $hWnd Case $_Gui _WinAPI_RedrawWindow ( $_Gui, 0, 0, $RDW_UPDATENOW ) _GUICtrlListView_RedrawItems ( $hListView, 0, _GUICtrlListView_GetItemCount ( $hListView )-1 ) _GDIPlus_GraphicsDrawImageRect ( $hGraphic1, $hImage1, 50, 20, 500, 100 ) _WinAPI_RedrawWindow ( $_Gui, 0, 0, $RDW_VALIDATE ) EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==> _WM_PAINT ( ) Func _WM_SETCURSOR ( $hWnd, $Msg, $wParam, $lParam ) Switch $hWnd Case $_SplashGui If BitAND ( $lparam, 0x10000 ) Then GUIDelete ( $_SplashGui ) TrayItemSetState ( $_AboutItem, $TRAY_ENABLE ) EndIf Case $_Gui Local $_CursorInfo = GUIGetCursorInfo ( $_Gui ) If Not @error Then Switch $_CursorInfo[4] Case $_QueryInput Local $_QueryInputRead = GUICtrlRead ( $_QueryInput ) If $_QueryInputRead = 'type a song or artist' Then GUICtrlSetData ( $_QueryInput, '' ) Local $_QueryInputReplace = StringRegExpReplace ( _StringReplaceAccent ( $_QueryInputRead ), '(?i)[^a-z0-9_\-\.]', ' ' ) If $_QueryInputReplace <> $_QueryInputRead Then GUICtrlSetData ( $_QueryInput, StringStripWS ( $_QueryInputReplace, 5 ) ) ControlSend ( $_Gui, '', $_QueryInput, '{END}' ) EndIf Case $_TopicLabel If BitAND ( $lparam, 0x10000 ) Then _OpenTopic ( ) EndSwitch EndIf EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==> _WM_SETCURSOR ( ) #EndRegion --- Messages Management ------------------------------ #Region ------ Download management ------------------------------ Func _WinHttpDownload ( $_DownloadFileUrl, $_Cookie='' ) $_HttpOpen = _WinHttpOpen ( 'User-Agent:AutoIt/' & @AutoItVersion ) Local $_HostName = _GetHostNameByUrl ( $_DownloadFileUrl ) $_HttpConnect = _WinHttpConnect ( $_HttpOpen, $_HostName ) $_FileName = StringReplace ( StringReplace ( $_DownloadFileUrl, 'http://', '' ), $_HostName, '' ) $_HttpOpenRequest = _WinHttpOpenRequest ( $_HttpConnect, 'GET', $_FileName, 'HTTP/1.1', $_HostName ) If $_Cookie <> '' Then _WinHttpAddRequestHeaders ( $_HttpOpenRequest, 'Cookie:' & $_Cookie ) _WinHttpSendRequest ( $_HttpOpenRequest ) _WinHttpReceiveResponse ( $_HttpOpenRequest ) If _WinHttpQueryDataAvailable ( $_HttpOpenRequest ) Then $_FileSize = _WinHttpQueryHeaders ( $_HttpOpenRequest, $WINHTTP_QUERY_CONTENT_LENGTH ) $_HttpData = Binary ( '' ) $_Progression = 1 EndIf EndFunc ;==> _WinHttpDownload ( ) Func _WinHttpGetFileSize ( $_DownloadFileUrl, $_Cookie='' ) $_Http_Open = _WinHttpOpen ( 'User-Agent:AutoIt/' & @AutoItVersion ) Local $_HostName = _GetHostNameByUrl ( $_DownloadFileUrl ) $_Http_Connect = _WinHttpConnect ( $_Http_Open, $_HostName ) $_FileName = StringReplace ( StringReplace ( StringReplace ( $_DownloadFileUrl, 'https://', '' ), 'http://', '' ), $_HostName, '' ) $_Http_OpenRequest = _WinHttpOpenRequest ( $_Http_Connect, 'GET', $_FileName, 'HTTP/1.1', $_HostName ) If $_Cookie <> '' Then _WinHttpAddRequestHeaders ( $_Http_OpenRequest, 'Cookie:' & $_Cookie ) _WinHttpSendRequest ( $_Http_OpenRequest ) _WinHttpReceiveResponse ( $_Http_OpenRequest ) $_FileSize = _WinHttpQueryHeaders ( $_Http_OpenRequest, $WINHTTP_QUERY_CONTENT_LENGTH ) _WinHttpCloseHandle ( $_Http_OpenRequest ) _WinHttpCloseHandle ( $_Http_Connect ) _WinHttpCloseHandle ( $_Http_Open ) Return $_FileSize EndFunc ;==> _WinHttpGetFileSize ( ) Func _GetSosoCookie ( ) Local $_CheckCookie $_RegRead = RegRead ( $_RegKeySettings, 'LastCookie' ) If $_RegRead <> '' Then $_CheckCookie = _WinHttpGetFileSize ( 'http://upload20.music.qzone.soso.com/30715706.mp3', $_SosoCookie ) ; test cookie http://stream11.qqmusic.qq.com/30318810.mp3 If $_CheckCookie Then $_SosoCookie = $_RegRead Else ToolTip ( @CRLF & _StringRepeat ( ' ', 6 ) & 'Please Wait while getting Recent Soso.com Cookie' & @Crlf, @DesktopWidth/2-165, @DesktopHeight/3-40, $_SoftTitle, 1, 4 ) _IEClickSound ( 0 ) _IEDisablePromptPopUp ( ) $_SosoCookie = _IEGetCookie ( 'http://music.soso.com/index.html' ) _IEClickSound ( 1 ) If Not @error And StringInStr ( $_SosoCookie, 'qqmusic_sosokey' ) Then $_CheckCookie = _WinHttpGetFileSize ( 'http://upload20.music.qzone.soso.com/30715706.mp3', $_SosoCookie ); test cookie http://stream11.qqmusic.qq.com/30318810.mp3 If $_CheckCookie Then RegWrite ( $_RegKeySettings, 'LastCookie', 'REG_EXPAND_SZ', $_SosoCookie ) Else $_SosoCookie = 0 EndIf Else $_SosoCookie = 0 EndIf EndIf ToolTip ( '' ) EndFunc ;==> _GetSosoCookie ( ) Func _IEGetCookie ( $_Url ) Local $oIE = ObjCreate ( 'InternetExplorer.Application' ) If Not IsObj ( $oIE ) Then Return SetError ( 1, 0, 0 ) $oIE.Visible = 0 Local $_IETimerInit = TimerInit ( ) $oIE.Navigate ( $_Url ) Do Sleep ( 100 ) If TimerDiff ( $_IETimerInit ) > 6000 Then $oIE.quit Return SetError ( 2, 0, 0 ) EndIf Until Not $oIE.Busy Local $_Cookie = $oIE.document.cookie $oIE.quit Return $_Cookie EndFunc ;==> _IEGetCookie ( ) Func _IEDisablePromptPopUp ( ) ; Disable IE prompt Pop-up window when open it. RegWrite ( 'HKCU\Software\Microsoft\Internet Explorer\Main', 'RunOnceHasShown', 'REG_DWORD', 0x00000001 ) ; Disable IE Prompt for Save Config RegWrite ( 'HKCU\Software\Microsoft\Internet Explorer\Main', 'RunOnceComplete', 'REG_DWORD', 0x00000001 ) RegWrite ( 'HKCU\Software\Microsoft\Internet Explorer\Main', 'Check_Associations', 'REG_SZ', 'no' ) ; Disable IE Prompt for being Default Browser RegWrite ( 'HKCU\Software\Microsoft\Internet Explorer\International', 'W2KLpk', 'REG_DWORD', 0x00000000 ) ; Disable IE Prompt for install language Pack EndFunc ;==> _IEDisablePromptPopUp ( ) Func _IEClickSound ( $_ClickSound=1 ) If Not $_RegPreviousSound Then $_RegPreviousSound = RegRead ( $_RegKeySettings, 'PreviousSound' ) If Not $_RegPreviousSound Then $_RegPreviousSound = RegRead ( 'HKCU\AppEvents\Schemes\Apps\Explorer\Navigating\.Current', '' ) RegWrite ( $_RegKeySettings, 'PreviousSound', 'REG_EXPAND_SZ', $_RegPreviousSound ) EndIf If $_ClickSound Then If $_RegPreviousSound Then RegWrite ( 'HKCU\AppEvents\Schemes\Apps\Explorer\Navigating\.Current', '', 'REG_EXPAND_SZ', $_RegPreviousSound ) Else If $_RegPreviousSound Then RegWrite ( 'HKCU\AppEvents\Schemes\Apps\Explorer\Navigating\.Current', '', 'REG_EXPAND_SZ', 'Disable' ) EndIf EndFunc ;==> _IEClickSound ( ) #EndRegion --- Download management ------------------------------ #Region ------ Window Management ------------------------------ Func _IsVisible ( $_Hwnd ) If BitAnd ( WinGetState ( $_Hwnd ), 2 ) Then Return 1 EndFunc ;==> _IsVisible ( ) Func _IsMinimized ( $_Hwnd ) If BitAnd ( WinGetState ( $_Hwnd ), 16 ) Then Return 1 EndFunc ;==> _IsMinimized ( ) Func _Minimize ( ) TrayItemSetState ( $_MinimizeItem, $TRAY_UNCHECKED ) If _IsVisible ( $_Gui ) Then $_IsWindowOverlapped = _IsWindowOverlapped ( $_Gui ) If Not IsArray ( $_IsWindowOverlapped ) Then TrayItemSetText ( $_MinimizeItem, 'Restore Window' ) GUISetState ( @SW_HIDE, $_Gui ) Else WinActivate ( $_Gui ) TrayItemSetText ( $_MinimizeItem, 'Minimize To Tray' ) EndIf Else TrayItemSetText ( $_MinimizeItem, 'Minimize To Tray' ) GUISetState ( @SW_SHOW, $_Gui ) GUISetState ( @SW_RESTORE, $_Gui ) WinActivate ( $_Gui ) EndIf EndFunc ;==> _Minimize ( ) Func _IsWindowOverlapped ( $hWnd ) ; return an array of windows If Not _IsVisible ( $hWnd ) Or _IsMinimized ( $hWnd ) Then Return Local $_WinList1 = WinList ( ), $_Overlap[1] For $_I = 1 To $_WinList1[0][0] If $_WinList1[$_I][0] <> '' And $hWnd <> $_WinList1[$_I][1] And _IsVisible ( $_WinList1[$_I][1] ) And Not _IsMinimized ( $_WinList1[$_I][1] ) Then If _CheckCollision ( $hWnd, $_WinList1[$_I][1] ) Then Local $_WinList2 = WinList ( ) For $_J = 1 To $_WinList2[0][0] If $_WinList2[$_J][0] <> '' And _IsVisible ( $_WinList2[$_J][1] ) And Not _IsMinimized ( $_WinList2[$_J][1] ) Then Switch $_WinList2[$_J][1] Case $hWnd ExitLoop Case $_WinList1[$_I][1] _ArrayAdd ( $_Overlap, $_WinList2[$_J][1] ) EndSwitch EndIf Next EndIf EndIf Next If UBound ( $_Overlap ) -1 Then Return $_Overlap EndFunc ;==> _IsWindowOverlapped ( ) Func _CheckCollision ( $_Win1, $_Win2 ) $_Win1Pos = WinGetPos ( $_Win1 ) If @error Then Return $_Win2Pos = WinGetPos ( $_Win2 ) If @error Then Return If _CheckOverlap ( $_Win1Pos, $_Win2Pos ) Then Return True If _CheckOverlap ( $_Win2Pos, $_Win1Pos ) Then Return True EndFunc ;==> _CheckCollision ( ) Func _CheckOverlap ( $_WinPos1, $_WinPos2 ) If _WinAPI_PtInRectEx ( $_WinPos1[0], $_WinPos1[1], $_WinPos2[0], $_WinPos2[1], $_WinPos2[2], $_WinPos2[3] ) Then Return True If _WinAPI_PtInRectEx ( $_WinPos1[0] + $_WinPos1[2], $_WinPos1[1], $_WinPos2[0], $_WinPos2[1], $_WinPos2[2], $_WinPos2[3] ) Then Return True If _WinAPI_PtInRectEx ( $_WinPos1[0] + $_WinPos1[2], $_WinPos1[1] + $_WinPos1[3], $_WinPos2[0], $_WinPos2[1], $_WinPos2[2], $_WinPos2[3] ) Then Return True If _WinAPI_PtInRectEx ( $_WinPos1[0], $_WinPos1[1] + $_WinPos1[3], $_WinPos2[0], $_WinPos2[1], $_WinPos2[2], $_WinPos2[3] ) Then Return True If _WinAPI_PtInRectEx ( $_WinPos1[0] + $_WinPos1[2]/2, $_WinPos1[1] + $_WinPos1[3]/2, $_WinPos2[0], $_WinPos2[1], $_WinPos2[2], $_WinPos2[3] ) Then Return True EndFunc ;==> _CheckOverlap ( ) Func _WinAPI_PtInRectEx ( $iX, $iY, $iLeft, $iTop, $iWidth, $iHeight ) Local $aResult, $tagREC = 'int Left;int Top;int Right;int Bottom' Local $tRect = DllStructCreate ( $tagREC ) DllStructSetData ( $tRect, 'Left', $iLeft ) DllStructSetData ( $tRect, 'Top', $iTop ) DllStructSetData ( $tRect, 'Right', $iLeft + $iWidth ) DllStructSetData ( $tRect, 'Bottom', $iTop + $iHeight ) $aResult = DllCall ( 'User32.dll', 'int', 'PtInRect', 'ptr', DllStructGetPtr ( $tRect ), 'int', $iX, 'int', $iY ) Return $aResult[0] <> 0 EndFunc ;==> _WinAPI_PtInRectEx ( ) Func _OnTop ( ) $_State = _IsTrayItemChecked ( $_OnTopItem ) RegWrite ( $_RegKeySettings, 'OnTop', 'REG_SZ', $_State ) WinSetOnTop ( $_Gui, '', $_State ) EndFunc ;==> _OnTop ( ) Func _IsChecked ( $_Ctrl ) Return BitAND ( GUICtrlRead ( $_Ctrl ), $GUI_CHECKED ) = $GUI_CHECKED EndFunc ;==> _IsChecked ( ) #EndRegion --- Window Management ------------------------------ #Region ------ Miscellaneous ------------------------------ Func _StringReplaceAccent ( $_String ) $_String = StringReplace ( $_String, '°', '°' ) $_String = StringReplace ( $_String, 'ç', 'c' ) $_String = StringReplace ( $_String, 'ß', 'ss' ) $_String = StringReplace ( $_String, "’", "'" ) $_String = StringReplace ( $_String, '€', '€' ) $_String = StringRegExpReplace ( $_String, '(Ú|ê|é|è|ë|«|©|ã©|ãš|ãª|ã¨|ã«|â«|â©|è|é|ê)', 'e' ) $_String = StringRegExpReplace ( $_String, '(ç|Ç)', 'c' ) $_String = StringRegExpReplace ( $_String, '(ÃŽ|ö|ó|ô|ãŽ|ã¶|ã³|ã´|ô)', 'o' ) $_String = StringRegExpReplace ( $_String, '(û|ü|ù|ÃŒ|ú|ã»|ã¼|ã¹|ãŒ|ãº|û|ù)', 'u' ) $_String = StringRegExpReplace ( $_String, '(ï|î|Ã|ã¯|ã®|ã|î)', 'i' ) $_String = StringRegExpReplace ( $_String, '(à |â|ä|À|ã|á|Ã¥|ã |ã¢|ã¤|ã€|ã£|ã¡|ã¥|â|ÃÂ|ãƒâ)', 'a' ) $_String = StringReplace ( $_String, 'Ã', 'a' ) Local $_Pattern[7][2] = [['[àáãâáäåÁÀÄÂÅœŒÆ]', 'a'], ['[éêèéëÉÈËÊ]', 'e'], ['[íîïìÍÌÏÎ]', 'i'], ['[óõôòöÓÒÖÔøØ]', 'o'], ['[úûùüÚÙÜÛ]', 'u'], ['[ýÿÝ]', 'y'], ['[çÇ]', 'c']] For $_I = 0 To 6 $_String = StringRegExpReplace ( $_String, $_Pattern[$_I][0], $_Pattern[$_I][1] ) Next Return $_String EndFunc ;==> _StringReplaceAccent ( ) Func _DeleteArrayElementWithoutStrings ( $_Array, $_String1, $_String2, $_Base=0 ) Local $_ArrayAdd[1] For $_Element In $_Array If StringInStr ( $_Element, $_String1 ) And StringInStr ( $_Element, $_String2 ) Then _ArrayAdd ( $_ArrayAdd, $_Element ) Next If Not $_Base Then _ArrayDelete ( $_ArrayAdd, 0 ) Return $_ArrayAdd EndFunc ;==> _DeleteArrayElementWithoutStrings ( ) Func _OneOfThisStringInStr ( $_InStr, $_String ) Local $_StringArray = StringSplit ( $_String, '|' ) If @error Then Return For $_I = 1 To UBound ( $_StringArray ) -1 If StringInStr ( $_InStr, $_StringArray[$_I] ) Then Return 1 Next EndFunc ;==> _OneOfThisStringInStr ( ) Func _StringToMultiLines ( $_String, $_MaxCharPerLine ) Local $_I Do $_I += 1 $_String = _StringInsert ( $_String, @CRLF, $_MaxCharPerLine*$_I ) Until @error Return $_String EndFunc ;==> _StringToMultiLines ( ) Func _AlreadyInArray ( $_SearchArray, $_Item, $_Start=0, $_Partial=0 ) _ArraySearch ( $_SearchArray, $_Item, $_Start, 0, 0, $_Partial ) If Not @error Then Return 1 EndFunc ;==> _AlreadyInArray ( ) Func _GetFreePath ( $_FilePath ) Local $_I, $_NewPath Do $_NewPath = _InsertStringBetweenNameAndExt ( $_FilePath, $_I ) $_I += 1 Until Not FileExists ( $_NewPath ) Return $_NewPath EndFunc ;==> _GetFreePath ( ) Func _InsertStringBetweenNameAndExt ( $_FullPath, $_InsertString ) Local $szDrive, $szDir, $szFName, $szExt _PathSplit ( $_FullPath, $szDrive, $szDir, $szFName, $szExt ) Return $szDrive & $szDir & $szFName & $_InsertString & $szExt EndFunc ;==> _InsertStringBetweenNameAndExt ( ) Func _GetDefaultBrowser ( ) Local $_DefautBrowser = StringRegExp ( RegRead ( 'HKCR\http\shell\open\command', '' ), '(?s)(?i)"(.*?)"', 3 ) If Not @error And FileExists ( $_DefautBrowser[0] ) Then Return $_DefautBrowser[0] Local $_UserChoice = RegRead ( 'HKCU\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice', 'Progid' ) If Not @error Then $_DefautBrowser = StringRegExp ( RegRead ( 'HKLM\Software\Classes\' & $_UserChoice & '\shell\open\command', '' ), '(?s)(?i)"(.*?)"', 3 ) If Not @error And FileExists ( $_DefautBrowser[0] ) Then Return $_DefautBrowser[0] EndIf Return 'iexplore.exe' EndFunc ;==> _GetDefaultBrowser ( ) Func _OpenInDefaultBrowser ( $_Url ) Local $_DefaultBrowser = _GetDefaultBrowser ( ) If FileExists ( $_DefaultBrowser ) Then ShellExecute ( $_Url ) Else ShellExecute ( 'iexplore.exe', $_Url ) EndIf EndFunc ;==> _OpenInDefaultBrowser ( ) Func _GetSourceCode ( $_Url ) Return BinaryToString ( InetRead ( $_Url ) ) EndFunc ;==> _GetSourceCode ( ) Func _UriDecode ( $sEncUrl ) Local $aEncUrl = StringSplit ( StringReplace ( $sEncUrl, '+', ' ', 0, 1 ), '%' ) For $_I = 2 To $aEncUrl[0] $aEncUrl[1] &= Chr ( Dec ( StringLeft ( $aEncUrl[$_I], 2 ) ) ) & StringTrimLeft ( $aEncUrl[$_I], 2 ) Next Return BinaryToString ( StringToBinary ( $aEncUrl[1], 1 ), 4 ) EndFunc ;==> _UriDecode ( ) Func _IsConnected ( ) If Ping ( 'www.bing.com', 1 ) _ Or InetRead ( 'http://www.google.com/humans.txt', 19 ) Then Return True EndFunc ;==> _IsConnected ( ) Func _ToolTipTimer ( ) AdlibUnRegister ( '_ToolTipTimer' ) ToolTip ( '' ) EndFunc ;==> _ToolTipTimer ( ) Func _StatusBarTextTimer ( ) AdlibUnRegister ( '_StatusBarTextTimer' ) If $_InetGet + $_Progression <> 0 Then If $_InetGet Then _GUICtrlStatusBar_SetText ( $_StatusBar, ' Downloading Sel : ' & $_DownloadText & ' - ' & $_DownloadPercent & '%' ) If $_Progression Then _GUICtrlStatusBar_SetText ( $_StatusBar, ' Downloading Sel : ' & $_DownloadText & ' - ' & Round ( $_Progression, 1 ) & '%' ) Else If $_Playing Or $_PlayingStream Then _GUICtrlStatusBar_SetText ( $_StatusBar, ' Playing Selection ' & $_PlayText ) Else If $_Search = 1 Then _GUICtrlStatusBar_SetText ( $_StatusBar, ' Searching Mp3 Songs' ) Else _GUICtrlStatusBar_SetText ( $_StatusBar, ' Waiting for Query...' ) EndIf EndIf EndIf EndFunc ;==> _StatusBarTextTimer ( ) Func _TimeToString ( $_Timer, $_LeaveZero=0 ) Local $_Secs, $_Mins, $_Hours _TicksToTime ( $_Timer, $_Hours, $_Mins, $_Secs ) $_Mins = StringFormat ( '%02d ', $_Mins ) & 'min' If Not $_LeaveZero And $_Mins = 0 Then $_Mins = '' $_Secs = StringFormat ( '%02d ', $_Secs ) & 'sec' If Not $_LeaveZero And $_Secs = 0 Then $_Secs = '' Return StringStripWS ( $_Mins & ' ' & $_Secs, 7 ) EndFunc ;==> _TimeToString ( ) #EndRegion --- Miscellaneous ------------------------------ #Region ------ TrayMenu Management ------------------------------ Func _IsTrayItemChecked ( $_TrayItem ) Return BitAND ( TrayItemGetState ( $_TrayItem ), $TRAY_CHECKED ) EndFunc ;==> _IsTrayItemChecked ( ) Func _OpenMp3skull ( ) TrayItemSetState ( $_Mp3skullItem, $TRAY_UNCHECKED ) _OpenInDefaultBrowser ( 'http://mp3skull.com' ) EndFunc ;==> _OpenMp3skull ( ) Func _OpenDilandau ( ) TrayItemSetState ( $_DilandauItem, $TRAY_UNCHECKED ) _OpenInDefaultBrowser ( 'http://fr.dilandau.eu/' ) EndFunc ;==> _OpenDilandau ( ) Func _OpenYahoo ( ) TrayItemSetState ( $_YahooItem, $TRAY_UNCHECKED ) _OpenInDefaultBrowser ( 'http://music.yahoo.cn' ) EndFunc ;==> _OpenYahoo ( ) Func _OpenSoso ( ) TrayItemSetState ( $_SosoItem, $TRAY_UNCHECKED ) _OpenInDefaultBrowser ( 'http://music.soso.com' ) EndFunc ;==> _OpenSoso ( ) Func _OpenTracktube ( ) TrayItemSetState ( $_TracktubeItem, $TRAY_UNCHECKED ) _OpenInDefaultBrowser ( 'http://tracktube.net' ) EndFunc ;==> _OpenTracktube ( ) Func _OpenMpleer ( ) TrayItemSetState ( $_MpleerItem, $TRAY_UNCHECKED ) _OpenInDefaultBrowser ( 'http://mpleer.ru' ) EndFunc ;==> _OpenMpleer ( ) Func _OpenMp3Juices ( ) TrayItemSetState ( $_Mp3JuicesItem, $TRAY_UNCHECKED ) _OpenInDefaultBrowser ( 'http://mp3juices.com' ) EndFunc ;==> _OpenMp3Juices ( ) Func _OpenBaseofmp3 ( ) TrayItemSetState ( $_BaseofmpItem, $TRAY_UNCHECKED ) _OpenInDefaultBrowser ( 'http://baseofmp3.com/' ) EndFunc ;==> _OpenBaseofmp3 ( ) Func _OpenAudiodump ( ) TrayItemSetState ( $_AudiodumpItem, $TRAY_UNCHECKED ) _OpenInDefaultBrowser ( 'http://www.audiodump.com/' ) EndFunc ;==> _OpenAudiodump ( ) Func _OpenTopic ( ) TrayItemSetState ( $_TopicItem, $TRAY_UNCHECKED ) _OpenInDefaultBrowser ( 'http://www.autoitscript.com/forum/topic/141443-mp3searchengine/' ) EndFunc ;==> _OpenTopic ( ) Func _ChangeOutputDir ( ) TrayItemSetState ( $_ChangeDirItem, $TRAY_UNCHECKED ) $_SelectFolder = FileSelectFolder ( 'Select MP3 Output Dir', '', 3 ) If Not FileExists ( $_SelectFolder ) Then Return $_OutputDirPath = $_SelectFolder RegWrite ( $_RegKeySettings, 'OutputDir', 'REG_SZ', $_OutputDirPath ) EndFunc ;==> _ChangeOutputDir ( ) Func _OpenOutputDir ( ) $_OutputDirPath = RegRead ( $_RegKeySettings, 'OutputDir' ) If $_OutputDirPath = '' Then $_OutputDirPath = @DesktopDir TrayItemSetState ( $_OutputDirItem, $TRAY_UNCHECKED ) ShellExecute ( $_OutputDirPath ) EndFunc ;==> _OpenOutputDir ( ) Func _About ( ) TrayItemSetState ( $_AboutItem, $TRAY_UNCHECKED ) TrayItemSetState ( $_AboutItem, $TRAY_DISABLE ) $_AboutText = @CRLF & 'Informations' & @CRLF & @CRLF & $_SoftTitle & @CRLF & @CRLF _ & 'Sites used are music search engine Websites designed for LEGAL entertainment purposes only.' & @TAB & @CRLF _ & 'All data comes from various different sources on the internet.' & @TAB & @CRLF _ & 'Download Links are verified to avoid :' & @CRLF _ & @TAB & 'dead or no direct links' & @CRLF _ & @TAB & 'poor quality ( as ringtone format )' & @CRLF _ & @TAB & 'doublons' & @CRLF _ & @TAB & 'no mp3 filetype' & @CRLF _ & 'You can Choose to not get Mp3 infos for a Search faster but links are not checked at all.' & @CRLF _ & 'Search engine Websites must have been selected before launching the Search.' & @CRLF _ & 'While Searching you can double click on a song for download it.' & @CRLF _ & 'By default ' & @DesktopDir & ' is the Output directory, but you can change it.' & @CRLF _ & 'You can also listen the last selected song.' & @CRLF _ & 'You can edit Title for renaming it ( It will be used for download ) when search is finished.' & @CRLF _ & 'You can Copy Title to the clipboard by pressing left Shift Key when Selecting a song,' & @CRLF _ & 'and also Copy Url by pressing left Ctrl Key when Selecting a song.' & @CRLF _ & "You can Sort ListView's Results." & @CRLF _ & 'Search, download and listen can be simultaneously.' & @CRLF _ & 'Double click on tray icon for restore/minimize Gui.' & @CRLF _ & 'See Tray menu for options.' & @CRLF & @CRLF _ & 'Thanks to AutoIt Community.' & @CRLF & @CRLF _ & 'wakillon.' $_SplashGui = GUICreate ( '', 650, 580, -1, -1, $WS_POPUP, $WS_EX_TOPMOST, WinGetHandle ( AutoItWinGetTitle ( ) ) ) _GuiSetGradientBkColor ( $_SplashGui, 0xDE070B, 0x706998 ) GUICtrlCreateLabel ( $_AboutText, 20, 20, 610, 540 ) GUICtrlSetTip ( -1, 'Click on Window for Close it', 'About', 1, 1 ) GUICtrlSetFont ( -1, 10, 600 ) GUICtrlSetColor ( -1, 0xFFFFFF ) GUICtrlSetBkColor ( -1, $GUI_BKCOLOR_TRANSPARENT ) GUISetState ( ) EndFunc ;==> _About ( ) Func _MuteSounds ( ) $_RegRead = RegRead ( $_RegKeySettings, 'MuteSounds' ) If $_Mute=1 Then $_Mute=0 TrayItemSetState ( $_MuteItem, $TRAY_UNCHECKED ) RegWrite ( $_RegKeySettings, 'MuteSounds', 'REG_SZ', 0 ) Else $_Mute=1 TrayItemSetState ( $_MuteItem, $TRAY_CHECKED ) RegWrite ( $_RegKeySettings, 'MuteSounds', 'REG_SZ', 1 ) EndIf EndFunc ;==> _MuteSounds ( ) Func _EnableCheckForUpdates ( ) $_EnableCheckForUpdates = _IsTrayItemChecked ( $_UpdateItem ) RegWrite ( $_RegKeySettings, 'EnableCheckForUpdates', 'REG_SZ', $_EnableCheckForUpdates ) EndFunc ;==> _EnableCheckForUpdates ( ) Func _EnableToolTips ( ) $_EnableToolTips = _IsTrayItemChecked ( $_TipItem ) RegWrite ( $_RegKeySettings, 'EnableToolTips', 'REG_SZ', $_EnableToolTips ) EndFunc ;==> _EnableToolTips ( ) Func _TrayTip ( $_Title= 'Please Wait', $_Texte= '...', $_Ico=0 ) TrayTip ( $_Title, $_Texte, 5, $_Ico ) EndFunc ;==> _TrayTip ( ) Func _TrayTipTimer ( ) AdlibUnRegister ( '_TrayTipTimer' ) TrayTip ( '', '', 1, 1 ) EndFunc ;==> _TrayTipTimer ( ) Func _SetTrayMenu ( ) TraySetIcon ( @WindowsDir & '\Loupe2.ico' ) $_TopicItem = TrayCreateItem ( 'Topic of ' & $_SoftTitle ) TrayItemSetOnEvent ( -1, '_OpenTopic' ) TrayCreateItem ( '' ) $_OnTopItem = TrayCreateItem ( 'Always on Top' ) TrayItemSetOnEvent ( -1, '_OnTop' ) $_RegRead = RegRead ( $_RegKeySettings, 'OnTop' ) If $_RegRead = '' Or $_RegRead = 1 Then TrayItemSetState ( $_OnTopItem, $TRAY_CHECKED ) Else TrayItemSetState ( $_OnTopItem, $TRAY_UNCHECKED ) EndIf TrayCreateItem ( '' ) $_MuteItem = TrayCreateItem ( 'Mute Sounds' ) TrayItemSetOnEvent ( -1, '_MuteSounds' ) $_RegRead = RegRead ( $_RegKeySettings, 'MuteSounds' ) If $_RegRead = '' Or $_RegRead = 0 Then $_Mute=0 TrayItemSetState ( $_MuteItem, $TRAY_UNCHECKED ) Else $_Mute=1 TrayItemSetState ( $_MuteItem, $TRAY_CHECKED ) EndIf TrayCreateItem ( '' ) $_TipItem = TrayCreateItem ( 'Enable ToolTips' ) TrayItemSetOnEvent ( -1, '_EnableToolTips' ) $_RegRead = RegRead ( $_RegKeySettings, 'EnableToolTips' ) If $_RegRead = '' Or $_RegRead = 1 Then $_EnableToolTips = 1 TrayItemSetState ( $_TipItem, $TRAY_CHECKED ) Else $_EnableToolTips = 0 TrayItemSetState ( $_TipItem, $TRAY_UNCHECKED ) EndIf TrayCreateItem ( '' ) $_UpdateItem = TrayCreateItem ( 'Enable Check for Updates at Start' ) TrayItemSetOnEvent ( -1, '_EnableCheckForUpdates' ) $_RegRead = RegRead ( $_RegKeySettings, 'EnableCheckForUpdates' ) If $_RegRead = '' Or $_RegRead = 1 Then $_EnableCheckForUpdates = 1 TrayItemSetState ( $_UpdateItem, $TRAY_CHECKED ) Else $_EnableCheckForUpdates = 0 TrayItemSetState ( $_UpdateItem, $TRAY_UNCHECKED ) EndIf TrayCreateItem ( '' ) Local $_WebSitesItem = TrayCreateMenu ( 'WebSite Search Engines' ) $_Mp3skullItem = TrayCreateItem ( 'Open mp3skull.com', $_WebSitesItem ) TrayItemSetOnEvent ( -1, '_OpenMp3skull' ) TrayCreateItem ( '', $_WebSitesItem ) $_DilandauItem = TrayCreateItem ( 'Open fr.dilandau.eu', $_WebSitesItem ) TrayItemSetOnEvent ( -1, '_OpenDilandau' ) TrayCreateItem ( '', $_WebSitesItem ) $_YahooItem = TrayCreateItem ( 'Open music.yahoo.cn', $_WebSitesItem ) TrayItemSetOnEvent ( -1, '_OpenYahoo' ) TrayCreateItem ( '', $_WebSitesItem ) $_SosoItem = TrayCreateItem ( 'Open soso.com', $_WebSitesItem ) TrayItemSetOnEvent ( -1, '_OpenSoso' ) TrayCreateItem ( '', $_WebSitesItem ) $_TracktubeItem = TrayCreateItem ( 'Open tracktube.net', $_WebSitesItem ) TrayItemSetOnEvent ( -1, '_OpenTracktube' ) TrayCreateItem ( '', $_WebSitesItem ) $_MpleerItem = TrayCreateItem ( 'Open mpleer.ru', $_WebSitesItem ) TrayItemSetOnEvent ( -1, '_OpenMpleer' ) TrayCreateItem ( '', $_WebSitesItem ) $_Mp3JuicesItem = TrayCreateItem ( 'Open Mp3Juices', $_WebSitesItem ) TrayItemSetOnEvent ( -1, '_OpenMp3Juices' ) TrayCreateItem ( '', $_WebSitesItem ) $_BaseofmpItem = TrayCreateItem ( 'Open baseofmp3.com', $_WebSitesItem ) TrayItemSetOnEvent ( -1, '_OpenBaseofmp3' ) TrayCreateItem ( '', $_WebSitesItem ) $_AudiodumpItem = TrayCreateItem ( 'Open audiodump.com', $_WebSitesItem ) TrayItemSetOnEvent ( -1, '_OpenAudiodump' ) TrayCreateItem ( '' ) If $_OutputDirPath = '' Then $_OutputDirPath = @DesktopDir RegWrite ( $_RegKeySettings, 'OutputDir', 'REG_SZ', $_OutputDirPath ) EndIf $_ChangeDirItem = TrayCreateItem ( 'Change Mp3 Directory' ) TrayItemSetOnEvent ( -1, '_ChangeOutputDir' ) TrayItemSetState ( $_ChangeDirItem, $TRAY_UNCHECKED ) TrayCreateItem ( '' ) $_OutputDirItem = TrayCreateItem ( 'Open Mp3 Directory' ) TrayItemSetOnEvent ( -1, '_OpenOutputDir' ) TrayCreateItem ( '' ) $_MinimizeItem = TrayCreateItem ( 'Minimize To Tray' ) TrayItemSetOnEvent ( -1, '_Minimize' ) TrayCreateItem ( '' ) $_AboutItem = TrayCreateItem ( 'About' ) TrayItemSetOnEvent ( -1, '_About' ) TrayCreateItem ( '' ) $_ExitItem = TrayCreateItem ( 'Exit' ) TrayItemSetOnEvent ( -1, '_Exit' ) TraySetClick ( 8 ) TraySetState ( 4 ) TraySetOnEvent ( $TRAY_EVENT_PRIMARYDOUBLE, '_Minimize' ) TraySetToolTip ( $_SoftTitle ) EndFunc ;==> _SetTrayMenu ( ) #EndRegion --- TrayMenu Management ------------------------------ Func _GetHostNameByUrl ( $_FileUrl ) If StringRight ( $_FileUrl, 1 ) = '/' Then $_FileUrl = StringTrimRight ( $_FileUrl, 1 ) $_FileUrl = StringReplace ( StringReplace ( $_FileUrl, 'https://', '' ), 'http://', '' ) Local $_UrlSplit = StringSplit ( $_FileUrl, '/' ) If Not @error Then Return $_UrlSplit[1] EndFunc ;==> _GetHostNameByUrl ( ) Func _ReduceMemory ( $_Pid=-1 ) If $_Pid <> -1 Then Local $_Handle = DllCall ( 'kernel32.dll', 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $_Pid ) Local $_Ret = DllCall ( 'psapi.dll', 'int', 'EmptyWorkingSet', 'long', $_Handle[0] ) DllCall ( 'kernel32.dll', 'int', 'CloseHAndle', 'int', $_Handle[0] ) Else Local $_Ret = DllCall ( 'psapi.dll', 'int', 'EmptyWorkingSet', 'long', -1 ) EndIf Return $_Ret[0] EndFunc ;==> _ReduceMemory ( ) #Region ------ Search Management ------------------------------ Func _Mp3Search_Skull ( $_Query ) $_Query = StringReplace ( StringReplace ( $_Query, '-', ' ' ), ' ', '_' ) $_Url = 'http://mp3skull.com/mp3/' & $_Query & '.html' $_SourceCode = _GetSourceCode ( $_Url ) If StringInStr ( $_SourceCode, 'Sorry, no results found' ) Then Return $_StringInStr1 = StringInStr ( $_SourceCode, 'info mp3 here' ) $_StringInStr2 = StringInStr ( $_SourceCode, '===' ) If $_StringInStr1 And $_StringInStr2 Then $_SourceCode = StringMid ( $_SourceCode, $_StringInStr1, $_StringInStr2 - $_StringInStr1 ) $_StringSplit = StringSplit ( $_SourceCode, @CRLF ) $_StringSplit = _DeleteArrayElementWithoutStrings ( $_StringSplit, 'mp3', '</div>' ) If Not IsArray ( $_StringSplit ) Then Return ReDim $_StringSplit[UBound ( $_StringSplit )-1] $_From = 'Mp3Skull' For $_I = 0 To UBound ( $_StringSplit ) -2 Step 2 $_Title = _StringBetween ( $_StringSplit[$_I], '<b>', '</b>' ) If Not @error Then $_Title = _StringProper ( _StringClean ( StringReplace ( $_Title[0], ' mp3', '' ) ) ) If StringLen ( $_Title ) > 3 Then $_DownloadUrl = _StringBetween ( $_StringSplit[$_I+1], 'href="', '"' ) If Not @error Then $_DownloadUrl = StringReplace ( $_DownloadUrl[0], '\', '' ) If Not _OneOfThisStringInStr ( $_DownloadUrl, 'rayfile.com|fileden.com|kickinthepeanuts.com' ) And Not _AlreadyInArray ( $_Links, $_DownloadUrl ) Then $_Go = 0 $_Bitrate = '' If $_Details = 1 Then $_SizeEx = _InetGetInfoEx ( $_DownloadUrl, $_MaxTimeOut ) If $_SizeEx > 1048576 And Not _AlreadyInArray ( $_Links, $_DownloadUrl, 0, 1 ) Then $_Go = 1 If StringLen ( $_Title2 ) > 3 Then $_Title = _StringProper ( _StringClean ( $_Title2 ) ) EndIf Else $_Go = 1 $_SizeEx = '' EndIf If $_Go Then _ArrayAdd ( $_Links, $_DownloadUrl ) StringReplace ( $_DownloadUrl, ' ', '%20' ) If @extended Then _ArrayAdd ( $_Links, StringReplace ( $_DownloadUrl, ' ', '%20' ) ) If @Compiled Then _WM_SendData ( $_MainGuiHwnd, $_Title & '|' & $_DownloadUrl & '|' & $_SizeEx & '|' & $_Bitrate & '|' & $_From ) ;ConsoleWrite ( '-->-- [' & @ScriptLineNumber & '][' & @HOUR & @MIN & @SEC & '] : ' & $_Title & '|' & $_DownloadUrl & '|' & $_SizeEx & '|' & $_Bitrate & '|' & $_From & @Crlf ) EndIf EndIf Else $_I-=1 EndIf EndIf EndIf Sleep ( 10 ) Next EndFunc ;==> _Mp3Search_Skull ( ) Func _Mp3Search_DilAndau ( $_Query ) $_Query = StringReplace ( $_Query, ' ', '-' ) Local $_PageNb = 2, $_Page=1, $_From = 'Dilandau' Do $_Page += 1 $_GetSourceCode_TimerInit = TimerInit ( ) Do If TimerDiff ( $_GetSourceCode_TimerInit ) > 7000 Then ; server is overloaded InetClose ( $hDownload2 ) ExitLoop EndIf Until InetGetInfo ( $hDownload2, 2 ) $_SourceCode = FileRead ( $_DilandauSrc ) FileDelete ( $_DilandauSrc ) $hDownload2 = InetGet ( $_DilandauUrl & '-' & $_Page & '.html', $_DilandauSrc, 1+2+8, 1 ) $_PageNbArray = StringRegExp ( $_SourceCode, '(?s)(?i)page_number">(.*?)</', 3 ) If IsArray ( $_PageNbArray ) Then $_PageNb = Number ( $_PageNbArray[UBound ( $_PageNbArray ) -1] ) $_StringBetween = _StringBetween ( $_SourceCode, '{ artist : "', '",id' ) If Not @error Then For $_I = 0 To UBound ( $_StringBetween ) -1 $_StringSplit = StringSplit ( $_StringBetween[$_I], '"', 1 ) If $_StringSplit[1] = '' Or Number ( $_StringSplit[1] ) > 0 Then $_Title = $_StringSplit[3] Else $_Title = $_StringSplit[1] & ' - ' & $_StringSplit[3] EndIf $_Title = _StringProper ( StringReplace ( _StringClean ( $_Title ), "'j", "j'" ) ) If StringLen ( $_Title ) > 3 Then $_DownloadUrl = StringReplace ( $_StringSplit[7], '\', '' ) If Not _OneOfThisStringInStr ( $_DownloadUrl, 'rayfile.com|fileden.com|kickinthepeanuts.com' ) And Not _AlreadyInArray ( $_Links, $_DownloadUrl, 1, 1 ) Then $_Go = 0 If $_Details = 1 Then $_SizeEx = _InetGetInfoEx ( $_DownloadUrl, $_MaxTimeOut ) If $_SizeEx > 1048576 Then $_Go = 1 If StringLen ( $_Title2 ) > 3 Then $_Title = _StringProper ( StringReplace ( _StringClean ( $_Title2 ), "'j", "j'" ) ) EndIf Else $_Go = 1 $_SizeEx = '' $_Bitrate = '' EndIf If $_Go Then _ArrayAdd ( $_Links, $_DownloadUrl ) StringReplace ( $_DownloadUrl, ' ', '%20' ) If @extended Then _ArrayAdd ( $_Links, StringReplace ( $_DownloadUrl, ' ', '%20' ) ) If @Compiled Then _WM_SendData ( $_MainGuiHwnd, $_Title & '|' & $_DownloadUrl & '|' & $_SizeEx & '|' & $_Bitrate & '|' & $_From ) ;ConsoleWrite ( '-->-- [' & @ScriptLineNumber & '][' & @HOUR & @MIN & @SEC & '] : ' & $_Title & '|' & $_DownloadUrl & '|' & $_SizeEx & '|' & $_Bitrate & '|' & $_From & @Crlf ) EndIf EndIf EndIf Sleep ( 10 ) Next EndIf Until $_Page >= $_PageNb EndFunc ;==> _Mp3Search_DilAndau ( ) Func _Mp3Search_Yahoo ( $_Query ) Local $_PageNb = 3, $_PageNbArray=0, $_Page=1, $_UboundOld, $_From = 'Yahoo' Do $_Page += 1 $_GetSourceCode_TimerInit = TimerInit ( ) Do If TimerDiff ( $_GetSourceCode_TimerInit ) > 7000 Then ; server is overloaded InetClose ( $hDownload3 ) ExitLoop EndIf Until InetGetInfo ( $hDownload3, 2 ) $_SourceCode = FileRead ( $_YahooSrc ) FileDelete ( $_YahooSrc ) $hDownload3 = InetGet ( $_YahooUrl & '&page=' & $_Page, $_YahooSrc, 1+2+8, 1 ) $_PageNbArray = StringRegExp ( $_SourceCode, "(?s)(?i);page=(.*?)'>", 3 ) If Not @error And IsArray ( $_PageNbArray ) Then $_PageNb = Number ( $_PageNbArray[UBound ( $_PageNbArray ) -1] ) $_StringSplit = StringSplit ( $_SourceCode, @CRLF ) $_StringSplit = _DeleteArrayElementWithoutStrings ( $_StringSplit, '.mp3', 'href' ) $_Singer = _StringBetween ( $_SourceCode, '"m_singer"', '</em></a></td>' ) If Not @error And UBound ( $_Singer ) > 1 Then If UBound ( $_Singer ) = UBound ( $_StringSplit ) Then $_Singer = StringMid ( StringReplace ( StringReplace ( $_Singer[1], '<em>', '' ), '</em>', '' ), StringInStr ( $_Singer[1], '">' )+2 ) Else $_Singer = '' EndIf Else $_Singer = '' EndIf For $_I = 0 To UBound ( $_StringSplit ) -1 $_Title = _StringBetween ( $_StringSplit[$_I], 'title=', '&url=' ) If Not @error Then $_Title = _StringProper ( _StringClean ( _UriDecode ( StringReplace ( $_Title[0], '+39', "'" ) ) ) ) If StringLen ( $_Title ) > 3 Then $_DownloadUrl = _StringBetween ( $_StringSplit[$_I], '&url=', '"' ) If Not @error Then $_DownloadUrl = StringReplace ( $_DownloadUrl[0], '\', '' ) If StringInStr ( $_DownloadUrl, '%' ) Then $_DownloadUrl = _UriDecode ( $_DownloadUrl ) If Not _OneOfThisStringInStr ( $_DownloadUrl, 'rayfile.com|fileden.com|kickinthepeanuts.com' ) And Not _AlreadyInArray ( $_Links, $_DownloadUrl, 1, 1 ) Then $_Go = 0 $_Bitrate = '' If $_Details = 1 Then $_SizeEx = _InetGetInfoEx ( $_DownloadUrl, $_MaxTimeOut ) If $_SizeEx > 1048576 Then $_Go = 1 If StringLen ( $_Title2 ) > 3 Then $_Title = _StringProper ( _StringClean ( $_Title2 ) ) Else If $_Singer And Not StringInStr ( $_Title, $_Singer ) Then $_Title = $_Singer & ' - ' & $_Title EndIf EndIf Else $_Go = 1 $_SizeEx = '' EndIf If $_Go Then _ArrayAdd ( $_Links, $_DownloadUrl ) StringReplace ( $_DownloadUrl, ' ', '%20' ) If @extended Then _ArrayAdd ( $_Links, StringReplace ( $_DownloadUrl, ' ', '%20' ) ) If @Compiled Then _WM_SendData ( $_MainGuiHwnd, $_Title & '|' & $_DownloadUrl & '|' & $_SizeEx & '|' & $_Bitrate & '|' & $_From ) ;ConsoleWrite ( '-->-- [' & @ScriptLineNumber & '][' & @HOUR & @MIN & @SEC & '] : ' & $_Title & '|' & $_DownloadUrl & '|' & $_SizeEx & '|' & $_Bitrate & '|' & $_From & @Crlf ) EndIf EndIf EndIf EndIf EndIf Sleep ( 10 ) Next Until $_Page >= $_PageNb EndFunc ;==> _Mp3Search_Yahoo ( ) Func _Mp3Search_Soso ( $_Query ) Local $_Nb=0, $_Page=1, $_PageNb=5, $_UboundOld, $_NoNewMp3 = 0, $_From = 'Soso' $_Query = StringLower ( StringReplace ( $_Query, ' ', '+' ) ) Do $_GetSourceCode_TimerInit = TimerInit ( ) $_Page+=1 Do If TimerDiff ( $_GetSourceCode_TimerInit ) > 7000 Then ; server is overloaded InetClose ( $hDownload4 ) ExitLoop EndIf Until InetGetInfo ( $hDownload4, 2 ) $_SourceCode = FileRead ( $_SosoSrc ) FileDelete ( $_SosoSrc ) $hDownload4 = InetGet ( $_SosoUrl & '&p=' & $_Page & '&source=1&t=1', $_SosoSrc, 1+2+8, 1 ) $_PageNbArray = StringRegExp ( $_SourceCode, "(?s)(?i)soso.pager.go(.*?);", 3 ) If Not @error And IsArray ( $_PageNbArray ) Then $_PageNb = Number ( StringReplace ( StringReplace ( $_PageNbArray[UBound($_PageNbArray)-2], '(', '' ), ')', '' ) ) $_SourceCode = StringMid ( $_SourceCode, StringInStr ( $_SourceCode, '<tbody>' ), StringInStr ( $_SourceCode, '/tbody' ) ) $_StringUrl = _StringBetween ( $_SourceCode, '<td class="data">', '</td>' ) If Not @error Then $_Size = _StringBetween ( $_SourceCode, '<td class="size">', '</td>' ) If Not @error Then For $_H = 0 To UBound ( $_StringUrl ) -1 $_StringSplit2 = StringSplit ( $_StringUrl[$_H], '@@', 1 ) $_Nb+=1 $_StringMid = StringMid ( $_StringSplit2[9], 1, StringInStr ( $_StringSplit2[9], '.mp3', 0, -1 ) +3 ) $_DownloadUrl = StringMid ( $_StringMid, StringInStr ( $_StringMid, 'http', 0, -1 ) ) If $_DownloadUrl = '' Then $_StringMid = StringMid ( $_StringSplit2[9], 1, StringInStr ( $_StringSplit2[9], '.wma', 0, -1 ) +3 ) $_DownloadUrl = StringMid ( $_StringMid, StringInStr ( $_StringMid, 'http', 0, -1 ) ) EndIf $_DownloadUrl = StringReplace ( $_DownloadUrl, '\', '' ) $_Title = _StringProper ( _StringClean ( StringReplace ( $_StringSplit2[4] & ' - ' & $_StringSplit2[2], ' mp3', '' ) ) ) If StringLen ( $_Title ) > 3 Then If StringRight ( $_DownloadUrl, 4 ) = '.wma' And StringInStr ( $_DownloadUrl, 'qqmusic.qq.com' ) Then $_DownloadUrl = _ConvertSosoWmaToMp3Url ( $_DownloadUrl ) If StringRight ( $_DownloadUrl, 4 ) <> '.wma' And Not _OneOfThisStringInStr ( $_DownloadUrl, 'rayfile.com|fileden.com|kickinthepeanuts.com' ) And Not _AlreadyInArray ( $_Links, $_DownloadUrl, 1, 1 ) Then $_Go = 0 $_Bitrate = '' $_Title2 = '' If $_Details =1 Then If Not $_Bitrate Then $_Bitrate = 'Undefined' If Not StringInStr ( $_DownloadUrl, 'qqmusic.qq.com' ) Then $_SizeEx = _InetGetInfoEx ( $_DownloadUrl, $_MaxTimeOut ) If $_SizeEx < 1048576 Then $_SizeEx = 0 Else If StringInStr ( $_SosoCookie, 'qqmusic_sosokey' ) Then $_Bitrate = 128 $_SizeEx = _WinHttpGetFileSize ( $_DownloadUrl, $_SosoCookie ) EndIf EndIf If $_SizeEx > 1048576 Then If StringLen ( $_Title2 ) > 3 Then $_Title = _StringProper ( _StringClean ( $_Title2 ) ) $_Go = 1 EndIf Else $_Go = 1 $_SizeEx = '' EndIf If $_Go Then _ArrayAdd ( $_Links, $_DownloadUrl ) StringReplace ( $_DownloadUrl, ' ', '%20' ) If @extended Then _ArrayAdd ( $_Links, StringReplace ( $_DownloadUrl, ' ', '%20' ) ) If @Compiled Then _WM_SendData ( $_MainGuiHwnd, $_Title & '|' & $_DownloadUrl & '|' & $_SizeEx & '|' & $_Bitrate & '|' & $_From ) ;ConsoleWrite ( '-->-- [' & @ScriptLineNumber & '][' & @HOUR & @MIN & @SEC & '] : ' & $_Title & '|' & $_DownloadUrl & '|' & $_SizeEx & '|' & $_Bitrate & '|' & $_From & @Crlf ) EndIf EndIf EndIf Sleep ( 10 ) Next EndIf EndIf If UBound ( $_Links ) -1 = $_UboundOld Then $_NoNewMp3 += 1 If $_NoNewMp3 >= 5 Then Return Else $_UboundOld = UBound ( $_Links ) -1 $_NoNewMp3 = 0 EndIf Until $_Page >= $_PageNb EndFunc ;==> _Mp3Search_Soso ( ) Func _Mp3Search_Tracktube ( $_Query ) Local $_PageNb = 8, $_Page=0, $_J=0, $_K=1, $_From = 'Tracktube' $_Query = StringReplace ( $_Query, ' ', '+' ) $_DataBase = $_DataBases[1] Do $_Page += 1 $_GetSourceCode_TimerInit = TimerInit ( ) Do If TimerDiff ( $_GetSourceCode_TimerInit ) > 7000 Then ; server is overloaded InetClose ( $hDownload5 ) ExitLoop EndIf Until InetGetInfo ( $hDownload5, 2 ) $_SourceCode = FileRead ( $_TracktubeSrc ) FileDelete ( $_TracktubeSrc ) $hDownload5 = InetGet ( $_TracktubeUrl & '&type=mp3&' & $_DataBase & '&page=' & $_Page, $_TracktubeSrc, 1+2+8, 1 ) $_StringSplit = StringSplit ( $_SourceCode, @CRLF ) Local $_JOld = $_J For $_I = 0 To UBound ( $_StringSplit ) -1 If StringInStr ( $_StringSplit[$_I], "'src':" ) Then $_DownloadUrl = _StringBetween ( $_StringSplit[$_I], "'src': '", "'," ) If Not @error Then $_DownloadUrl = $_DownloadUrl[0] If Not _OneOfThisStringInStr ( $_DownloadUrl, 'rayfile.com|fileden.com|kickinthepeanuts.com' ) And Not _AlreadyInArray ( $_Links, $_DownloadUrl, 1, 1 ) Then $_Title = _StringBetween ( $_StringSplit[$_I+1], "'title': '", "'," ) If Not @error Then $_Title = _StringProper ( _StringClean ( $_Title[0] ) ) If StringLen ( $_Title ) > 3 Then $_Go = 0 If $_Details = 1 Then $_SizeEx = _InetGetInfoEx ( $_DownloadUrl, $_MaxTimeOut ) If $_SizeEx > 1048576 Then $_Go = 1 If StringLen ( $_Title2 ) > 3 Then $_Title = _StringProper ( _StringClean ( $_Title2 ) ) EndIf Else $_Go = 1 $_SizeEx = '' $_Bitrate = '' EndIf If $_Go Then _ArrayAdd ( $_Links, $_DownloadUrl ) StringReplace ( $_DownloadUrl, ' ', '%20' ) If @extended Then _ArrayAdd ( $_Links, StringReplace ( $_DownloadUrl, ' ', '%20' ) ) If @Compiled Then _WM_SendData ( $_MainGuiHwnd, $_Title & '|' & $_DownloadUrl & '|' & $_SizeEx & '|' & $_Bitrate & '|' & $_From ) ;ConsoleWrite ( '-->-- [' & @ScriptLineNumber & '][' & @HOUR & @MIN & @SEC & '] : ' & $_Title & '|' & $_DownloadUrl & '|' & $_SizeEx & '|' & $_Bitrate & '|' & $_From & @Crlf ) $_J +=1 EndIf EndIf EndIf EndIf EndIf EndIf Sleep ( 10 ) Next If $_J = $_JOld Then InetClose ( $hDownload5 ) FileDelete ( $_TracktubeSrc ) If $_K >= 4 Then Return $_K+=1 $_Page=1 $_J=0 $_JOld=0 $_DataBase = $_DataBases[$_K] $hDownload5 = InetGet ( $_TracktubeUrl & '&type=mp3&' & $_DataBase & '&page=' & $_Page, $_TracktubeSrc, 1+2+8, 1 ) EndIf Until $_Page >= $_PageNb EndFunc ;==> _Mp3Search_Tracktube ( ) Func _Mp3Search_Mpleer ( $_Query ) Local $_Nb=0, $_Page=1, $_PageNb=5, $_UboundOld, $_From = 'Mpleer' $_Query = StringReplace ( $_Query, ' ', '%20' ) Do $_Page += 1 $_GetSourceCode_TimerInit = TimerInit ( ) Do If TimerDiff ( $_GetSourceCode_TimerInit ) > 7000 Then ; server is overloaded InetClose ( $hDownload6 ) ExitLoop EndIf Until InetGetInfo ( $hDownload6, 2 ) $_SourceCode = FileRead ( $_MpleerSrc ) FileDelete ( $_MpleerSrc ) If StringInStr ( $_SourceCode, '<p class="error' ) Then Return $hDownload6 = InetGet ( $_MpleerUrl & 's&p=' & $_Page, $_MpleerSrc, 1+2+8, 1 ) $_SourceCode1 = '' $_StringInStr1 = StringInStr ( $_SourceCode, 'google_ad_section_end' ) $_StringInStr2 = StringInStr ( $_SourceCode, '</p>' ) If $_StringInStr1 And $_StringInStr2 Then $_SourceCode1 = StringMid ( $_SourceCode, $_StringInStr1, $_StringInStr2 - $_StringInStr1 ) $_Maxpage = _StringBetween ( $_SourceCode1, 'p=', '>' ) If Not @error Then $_PageNb = $_Maxpage[UBound( $_Maxpage) -1] $_StringInStr1 = StringInStr ( $_SourceCode, 'id="track0' ) $_StringInStr2 = StringInStr ( $_SourceCode, 'google_ad_section_end' ) If $_StringInStr1 And $_StringInStr2 Then $_SourceCode = StringMid ( $_SourceCode, $_StringInStr1, $_StringInStr2 - $_StringInStr1 ) $_StringSplit = StringSplit ( $_SourceCode, @CRLF ) For $_I = 0 To UBound ( $_StringSplit ) -1 If StringInStr ( $_StringSplit[$_I], 'button link_play' ) Then $_DownloadUrl = _StringBetween ( $_StringSplit[$_I], 'href="', '"' ) If Not @error Then ; $_DownloadUrl = $_DownloadUrl[0] If Not _OneOfThisStringInStr ( $_DownloadUrl, 'rayfile.com|fileden.com|kickinthepeanuts.com' ) And Not _AlreadyInArray ( $_Links, $_DownloadUrl, 1, 1 ) Then If $_I+8 <= UBound ( $_StringSplit ) -1 Then $_Title = _StringBetween ( $_StringSplit[$_I+8], '<strong>', '<br>' ) If Not @error Then $_Title = _StringProper ( _StringClean ( StringReplace ( StringReplace ( $_Title[0], '</strong></a> — ', ' - ' ), 'www', '' ) ) ) If StringLen ( $_Title ) > 3 Then $_Go = 0 If $_Details = 1 Then $_SizeEx = _InetGetInfoEx ( $_DownloadUrl, $_MaxTimeOut ) If $_SizeEx > 1048576 Then $_Go = 1 If StringLen ( $_Title2 ) > 3 Then $_Title = _StringProper ( _StringClean ( $_Title2 ) ) EndIf Else $_Go = 1 $_SizeEx = '' $_Bitrate = '' EndIf If $_Go Then _ArrayAdd ( $_Links, $_DownloadUrl ) StringReplace ( $_DownloadUrl, ' ', '%20' ) If @extended Then _ArrayAdd ( $_Links, StringReplace ( $_DownloadUrl, ' ', '%20' ) ) If @Compiled Then _WM_SendData ( $_MainGuiHwnd, $_Title & '|' & $_DownloadUrl & '|' & $_SizeEx & '|' & $_Bitrate & '|' & $_From ) ;ConsoleWrite ( '-->-- [' & @ScriptLineNumber & '][' & @HOUR & @MIN & @SEC & '] : ' & $_Title & '|' & $_DownloadUrl & '|' & $_SizeEx & '|' & $_Bitrate & '|' & $_From & @Crlf ) EndIf EndIf EndIf EndIf EndIf EndIf EndIf Sleep ( 10 ) Next Until $_Page >= $_PageNb EndFunc ;==> _Mp3Search_Mpleer ( ) Func _Mp3Search_Mp3Juices ( $_Query ) Local $_Page = 1, $_From = 'Mp3Juices' Dim $_SizeArray[1] Dim $_Links[1] $_Query = StringReplace ( StringStripWS ( StringLower ( $_Query ), 7 ), ' ', '-' ) Local $_J=0, $_K = 0, $_Title Do $_Page += 1 $_GetSourceCode_TimerInit = TimerInit ( ) Do If TimerDiff ( $_GetSourceCode_TimerInit ) > 7000 Then ; server is overloaded InetClose ( $hDownload7 ) ExitLoop EndIf Until InetGetInfo ( $hDownload7, 2 ) $_SourceCode = FileRead ( $_Mp3JuicesSrc ) FileDelete ( $_Mp3JuicesSrc ) $_Mp3JuicesUrl = 'http://mp3juices.com/search/' & $_Query & '/' & $_Page $hDownload7 = InetGet ( $_Mp3JuicesUrl, $_Mp3JuicesSrc, 1+2+8, 1 ) $_ArrayLinks = StringRegExp ( $_SourceCode, '(?s)(?i)href="http://mp3juices.com/download/(.*?)"', 3 ) $_K = UBound ( $_Links ) -1 For $_I = 0 To UBound ( $_ArrayLinks ) -1 $_DownloadUrl = 'http://mp3juices.com/download/' & $_ArrayLinks[$_I] $_StringSplit = StringSplit ( $_ArrayLinks[$_I], '/', 1+2 ) If Not @error Then $_Title = _StringProper ( _StringClean ( _UriDecode ( $_StringSplit[3] ) ) ) If Not _AlreadyInArray ( $_Links, $_DownloadUrl, 1, 1 ) Then If StringLen ( $_Title ) > 3 Then $_Go = 0 If $_Details = 1 Then $_SizeEx = _InetGetInfoEx ( $_DownloadUrl, $_MaxTimeOut ) If $_SizeEx > 1048576 And Not _AlreadyInArray ( $_SizeArray, $_SizeEx ) Then $_Go = 1 If StringLen ( $_Title2 ) > 3 Then $_Title = _StringProper ( _StringClean ( $_Title2 ) ) _ArrayAdd ( $_SizeArray, $_SizeEx ) _ArrayAdd ( $_Links, $_DownloadUrl ) EndIf Else $_Go = 1 $_SizeEx = '' $_Bitrate = '' EndIf If $_Go Then If @Compiled Then _WM_SendData ( $_MainGuiHwnd, $_Title & '|' & $_DownloadUrl & '|' & $_SizeEx & '|' & $_Bitrate & '|' & $_From ) ;ConsoleWrite ( '-->-- [' & @ScriptLineNumber & '][' & @HOUR & @MIN & @SEC & '] : ' & $_Title & '|' & $_DownloadUrl & '|' & $_SizeEx & '|' & $_Bitrate & '|' & $_From & @Crlf ) EndIf EndIf EndIf EndIf Sleep ( 10 ) Next If $_K = UBound ( $_Links ) -1 Then $_J +=1 Until $_J = 2 EndFunc ;==> _Mp3Search_Mp3Juices ( ) Func _Mp3Search_Baseofmp3 ( $_Query ) Local $_Page=1, $_From = 'Baseofmp3' Dim $_Links[1] Local $_J=0, $_K = 0, $_Title $_Query = StringReplace ( StringStripWS ( StringLower ( $_Query ), 7 ), ' ', '+' ) Do $_Page += 1 $_GetSourceCode_TimerInit = TimerInit ( ) Do If TimerDiff ( $_GetSourceCode_TimerInit ) > 7000 Then ; server is overloaded InetClose ( $hDownload8 ) ExitLoop EndIf Until InetGetInfo ( $hDownload8, 2 ) $_SourceCode = FileRead ( $_Baseofmp3Src ) FileDelete ( $_Baseofmp3Src ) $hDownload8 = InetGet ( 'http://baseofmp3.com/?q=' & $_Query & '&st=' & $_Page, $_Baseofmp3Src, 1+2+8, 1 ) $_K = UBound ( $_Links ) -1 $_ArrayLinks = StringRegExp ( $_SourceCode, '(?s)(?i);artist=(.*?)/listen.mp3', 3 ) For $_I = 0 To UBound ( $_ArrayLinks ) -1 Step 1 $_StringSplit = StringSplit ( $_ArrayLinks[$_I], '" data="', 1+2 ) $_Title = StringReplace ( $_StringSplit[0], '&title=', '+' ) $_DownloadUrl = $_StringSplit[1] & '/baseofmp3.com_' & StringReplace ( $_Title, '+', '_' ) & '.mp3' $_Title = StringReplace ( StringReplace ( $_StringSplit[0], '+', ' ' ), 'title=', '' ) $_Title = _StringProper ( _StringClean ( _UriDecode ( $_Title ) ) ) If Not _AlreadyInArray ( $_Links, $_DownloadUrl, 1, 1 ) Then If StringLen ( $_Title ) > 3 Then $_Go = 0 If $_Details = 1 Then $_SizeEx = _InetGetInfoEx ( $_DownloadUrl, $_MaxTimeOut*3 ) If $_SizeEx > 1048576 Then $_Go = 1 Else $_Go = 1 $_SizeEx = '' $_Bitrate = '' EndIf If $_Go Then _ArrayAdd ( $_Links, $_DownloadUrl ) If @Compiled Then _WM_SendData ( $_MainGuiHwnd, $_Title & '|' & $_DownloadUrl & '|' & $_SizeEx & '|' & $_Bitrate & '|' & $_From ) ;ConsoleWrite ( '-->-- [' & @ScriptLineNumber & '][' & @HOUR & @MIN & @SEC & '] : ' & $_Title & '|' & $_DownloadUrl & '|' & $_SizeEx & '|' & $_Bitrate & '|' & $_From & @Crlf ) EndIf EndIf EndIf Sleep ( 10 ) Next If $_K = UBound ( $_Links ) -1 Then $_J += 1 Until $_J = 2 EndFunc ;==> _Mp3Search_Baseofmp3 ( ) Func _Mp3Search_Audiodump ( $_Query ) $_Query = StringReplace ( $_Query, ' ', '+' ) Local $_PageNb = 10, $_Page=1, $_From = 'Audiodump' Do $_Page += 1 $_GetSourceCode_TimerInit = TimerInit ( ) Do If TimerDiff ( $_GetSourceCode_TimerInit ) > 7000 Then ; server is overloaded InetClose ( $hDownload9 ) ExitLoop EndIf Until InetGetInfo ( $hDownload9, 2 ) $_SourceCode = FileRead ( $_AudiodumpSrc ) FileDelete ( $_AudiodumpSrc ) If StringInStr ( $_SourceCode, 'Sorry. Either no results found or server is overloaded' ) Then If $_Page > 1 Then $_Page -= 1 $hDownload9 = InetGet ( 'http://www.audiodump.com/search.php?p=' & $_Page & '&q=' & $_Query, $_AudiodumpSrc, 1+2+8, 1 ) Else $hDownload9 = InetGet ( 'http://www.audiodump.com/search.php?p=' & $_Page & '&q=' & $_Query, $_AudiodumpSrc, 1+2+8, 1 ) $_StringSplit = StringSplit ( $_SourceCode, @CRLF ) For $_I = 0 To UBound ( $_StringSplit ) -1 If StringInStr ( $_StringSplit[$_I], 'href="download.php?x=' ) Then $_Data = _StringBetween ( $_StringSplit[$_I], '<a href="', ')<BR' ) If Not @error Then For $_K = 0 To UBound ( $_Data ) -1 If Not StringInStr ( $_Data[$_K],'search.php?' ) Then $_StringSplit2 = StringSplit ( $_Data[$_K], '">', 1+2 ) If Not @error Then $_DownloadUrl = 'http://www.audiodump.com/' & $_StringSplit2[0] $_StringSplit3 = StringSplit ( $_StringSplit2[1], '</a> (', 1+2 ) $_Title = _StringProper ( StringReplace ( _StringClean ( $_StringSplit3[0] ), "'j", "j'" ) ) If Not _AlreadyInArray ( $_Links, $_DownloadUrl, 1, 1 ) And Not StringInStr ( $_DownloadUrl, '|' ) Then If StringLen ( $_Title ) > 3 Then $_Go = 0 If $_Details = 1 Then $_StringSplit4 = StringSplit ( $_StringSplit3[1], ':', 1+2 ) If Not @error Then $_Duration = $_StringSplit4[0]*60 + $_StringSplit4[1] $_SizeEx = _WinHttpGetFileSize ( $_DownloadUrl ) $_Bitrate = _GetBitrate ( $_SizeEx, $_Duration ) If $_Bitrate And $_SizeEx > 1048576 Then $_Go = 1 EndIf Else $_Go = 1 $_SizeEx = '' $_Bitrate = '' EndIf If $_Go Then _ArrayAdd ( $_Links, $_DownloadUrl ) StringReplace ( $_DownloadUrl, ' ', '%20' ) If @extended Then _ArrayAdd ( $_Links, StringReplace ( $_DownloadUrl, ' ', '%20' ) ) If @Compiled Then _WM_SendData ( $_MainGuiHwnd, $_Title & '|' & $_DownloadUrl & '|' & $_SizeEx & '|' & $_Bitrate & '|' & $_From ) ;ConsoleWrite ( '-->-- [' & @ScriptLineNumber & '][' & @HOUR & @MIN & @SEC & '] : ' & $_Title & '|' & $_DownloadUrl & '|' & $_SizeEx & '|' & $_Bitrate & '|' & $_From & @Crlf ) EndIf EndIf EndIf EndIf EndIf Next EndIf EndIf Sleep ( 10 ) Next EndIf Until $_Page = $_PageNb EndFunc ;==> _Mp3Search_Audiodump ( ) #EndRegion --- Search Management ------------------------------ #Region ------ Checking Links and getting infos ------------------------------ Func _InetGetInfoEx ( $_FileUrl, $_TimeOut ) $_Title2='' If FileExists ( $_TempFile ) Then FileDelete ( $_TempFile ) $_Bitrate='' $_InetGet = InetGet ( $_FileUrl, $_TempFile, 11, 1 ) Local $_InetTimerInit = TimerInit ( ) Local $_MIHandle = DllCall ( $_MediaInfoDll, 'ptr', 'MediaInfo_New' ) Do $_Size = InetGetInfo ( $_InetGet, 1 ) If Not @error And $_Size > 0 Then If $_Size < 1048576 Or $_Size > 1048576*12 Then $_Size= 0 ExitLoop EndIf DllCall ( $_MediaInfoDll, 'int', 'MediaInfo_Open', 'ptr', $_MIHandle[0], 'wstr', $_TempFile ) If Not $_Title2 Then $ret1 = DllCall ( $_MediaInfoDll, 'wstr', 'MediaInfo_Get', 'ptr', $_MIHandle[0], 'int', 0, 'int', 0, 'wstr', 'Performer', 'int', 1, 'int', 0 ) $ret2 = DllCall ( $_MediaInfoDll, 'wstr', 'MediaInfo_Get', 'ptr', $_MIHandle[0], 'int', 0, 'int', 0, 'wstr', 'Title', 'int', 1, 'int', 0 ) If $ret1[0] And $ret2[0] Then $_Title2 = $ret1[0] & ' - ' & $ret2[0] EndIf $Info_Get = DllCall ( $_MediaInfoDll, 'wstr', 'MediaInfo_Get', 'ptr', $_MIHandle[0], 'int', 0, 'int', 0, 'wstr', 'BitRate', 'int', 1, 'int', 0 ) $_Bitrate = Int ( $Info_Get[0]/1000 ) DllCall ( $_MediaInfoDll, 'none', 'MediaInfo_Close', 'ptr', $_MIHandle[0] ) If $_Bitrate Then ExitLoop EndIf Sleep ( 50 ) Until TimerDiff ( $_InetTimerInit ) > $_TimeOut DllCall ( $_MediaInfoDll, 'none', 'MediaInfo_Delete', 'ptr', $_MIHandle[0] ) $_MIHandle = 0 InetClose ( $_InetGet ) ; some times too slow... $_InetGet = 0 If Not _IsMp3 ( $_TempFile ) Or $_Bitrate <= 96 Then $_Size = 0 FileDelete ( $_TempFile ) Return $_Size EndFunc ;==> _InetGetInfoEx ( ) #EndRegion --- Checking Links and getting infos ------------------------------ #Region ------ String Cleaning Management ------------------------------ Func _StringClean ( $_String ) $_String = StringReplace ( $_String, '%2C', ',' ) $_String = StringReplace ( $_String, '%82', ',' ) $_String = StringReplace ( $_String, '%27', "'" ) $_String = StringReplace ( $_String, '%28', '(' ) $_String = StringReplace ( $_String, '%29', ')' ) $_String = StringReplace ( $_String, '"', '"' ) $_String = StringReplace ( $_String, ''', "'" ) $_String = StringReplace ( $_String, '&', '&' ) $_String = StringReplace ( $_String, '<', '<' ) $_String = StringReplace ( $_String, '>', '>' ) $_String = _StringReplaceAscChars ( $_String ) If StringRegexp ( $_String, '(?i)U([[:xdigit:]]{2,4})' ) Then $_String = StringReplace ( $_String, ' u', '\u' ) $_String = _StringReplaceUnicodeChars ( $_String ) EndIf $_String = _StringReplaceAccent ( $_String ) $_String = StringReplace ( $_String, '-', 'IIIIIII' ) $_String = StringReplace ( $_String, "'", 'JJJJJJJ' ) $_String = StringRegExpReplace ( $_String, '(?i)[^a-z0-9_\-\.]', ' ' ) $_String = StringStripWS ( StringReplace ( StringReplace ( $_String, 'IIIIIII', '-' ), 'JJJJJJJ', "'" ), 7 ) If StringRight ( $_String, 1 ) = '-' Then $_String = StringTrimRight ( $_String, 1 ) If StringLeft ( $_String, 1 ) = '-' Then $_String = StringTrimLeft ( $_String, 1 ) Do $_String = StringReplace ( $_String, "''", "'" ) Until Not @extended $_String = _RemoveDigitsFromStart ( $_String ) While StringLeft ( StringStripWS ( $_String, 7 ), 1 ) = '-' $_String = StringTrimLeft ( $_String, 1 ) WEnd Return StringStripWS ( $_String, 7 ) EndFunc ;==> _StringClean ( ) Func _StringReplaceUnicodeChars ( $_String ) Return Execute ( '"' & StringRegexpReplace ( $_String, "(?i)\\U([[:xdigit:]]{2,4})", '"&chrw(0x$1)&"' ) & '"' ) EndFunc ;==> _StringReplaceUnicodeChars ( ) Func _StringReplaceAscChars ( $_String ) Local $_SF2, $_SF3, $_I For $_I = 1103 To 32 step -1 If Not StringInStr ( $_String, '&' ) Then ExitLoop $_SF3 = StringFormat ( '%03d', $_I ) $_String = StringReplace ( $_String, '&' & $_SF3 & ';', ChrW ( $_I ) ) $_String = StringReplace ( $_String, '&#' & $_SF3 & ';', ChrW ( $_I ) ) If $_I < 100 Then $_SF2 = StringFormat ( '%02d', $_I ) $_String = StringReplace ( $_String, '&' & $_SF2 & ';', ChrW ( $_I ) ) $_String = StringReplace ( $_String, '&#' & $_SF2 & ';', ChrW ( $_I ) ) EndIf Next Return String ( $_String ) EndFunc ;==> _StringReplaceAscChars ( ) Func _RemoveDigitsFromStart ( $_String ) While StringIsDigit ( StringLeft ( StringStripWS ( $_String, 7 ), 1 ) ) $_String = StringTrimLeft ( $_String, 1 ) WEnd Return $_String EndFunc ;==> _RemoveDigitsFromStart ( ) #EndRegion --- String Cleaning Management ------------------------------ #Region ------ Miscellaneous ------------------------------ Func _GetBitrate ( $_Size, $_Duration ) $_Bitrate = $_Size/1024/$_Duration*8 Switch $_Bitrate Case 65 To 96 $_Bitrate = 96 Case 97 To 112 $_Bitrate = 112 Case 113 To 128 $_Bitrate = 128 Case 129 To 160 $_Bitrate = 160 Case 161 To 192 $_Bitrate = 192 Case 193 To 224 $_Bitrate = 224 Case 225 To 256 $_Bitrate = 256 Case 257 To 320 $_Bitrate = 320 Case Else $_Bitrate = 0 EndSwitch Return $_Bitrate EndFunc ;==> _GetBitrate ( ) Func _ConvertSosoWmaToMp3Url ( $_WmaUrl ) Local $_EndStringMid = StringMid ( $_WmaUrl, StringInStr ( $_WmaUrl, '.qqmusic.qq.com' ) ) Local $_WmaUrlMid = StringMid ( $_WmaUrl, 14, StringInStr ( $_WmaUrl, '.qqmusic.qq.com' )-14 )+10 $_WmaUrl = 'http://stream' & $_WmaUrlMid & $_EndStringMid $_WmaUrl = StringReplace ( $_WmaUrl, '.com/12', '.com/30' ) $_WmaUrl = StringReplace ( $_WmaUrl, '.com/13', '.com/31' ) Return StringReplace ( $_WmaUrl, '.wma', '.mp3' ) EndFunc ;==> _ConvertSosoWmaToMp3Url ( ) Func _CheckMainGui ( ) If Not WinExists ( $_MainGuiTitle ) Then Exit _ReduceMemory ( ) EndFunc ;==> _CheckMainGui ( ) Func _GetWinTitleByHandle ( $_WinHwnd ) Local $_WinList = WinList ( ) For $_I = 1 To $_WinList[0][0] If $_WinList[$_I][1] = $_WinHwnd Then Return $_WinList[$_I][0] Next EndFunc ;==> _GetWinTitleByHandle ( ) Func _GenerateRandomFileName ( $_Dir, $_Ext ) Do Local $_TempName = '~', $_TempPath While StringLen ( $_TempName ) < 12 $_TempName = $_TempName & Chr ( Round ( Random ( 97, 122 ), 0 ) ) Wend $_TempPath = $_Dir & '\' & $_TempName & '.' & $_Ext Until Not FileExists ( $_TempPath ) Return $_TempPath EndFunc ;==> _GenerateRandomFileName ( ) #EndRegion --- Miscellaneous ------------------------------ Func _ReadIni ( $_Ini ); Get last version and download link. Local $__LastVersion $_UpdateLink = _StringBetween ( $_Ini, 'UpdateLink=', @CR ) If Not @error Then $_UpdateLink = $_UpdateLink[0] $__LastVersion = _StringBetween ( $_Ini, 'version=', @CR ) If Not @error Then Return $__LastVersion[0] Return '0.0.0.0' EndFunc ;=> _ReadIni ( ) Func _LookForUpdate ( ) Local $__LastVersion, $_UpdateDatText, $_VersionCompare $_UpdateDatText = BinaryToString ( InetRead ( 'http://tinyurl.com/7cczd3p/update.ini' ) ) $__LastVersion = _ReadIni ( $_UpdateDatText ) $_ScriptVersion = _GetScriptVersion ( ) If $_ScriptVersion <> '0.0.0.0' And $__LastVersion <> '0.0.0.0' Then $_VersionCompare = _VersionCompare ( $__LastVersion, $_ScriptVersion ) Switch $_VersionCompare ; 0 - Both versions equal, 1 - Version 1 greater, -1 - Version 2 greater Case 0 Return Case 1 If MsgBox ( 262144+4+4096+64, 'Info', @CRLF & 'An Update is Available' & @CRLF & @CRLF & _ 'Mp3SearchEngine Version : ' & $__LastVersion & @CRLF & @CRLF & _ 'Do you want to Download it ?' & @CRLF ) = 6 Then Exit _OpenInDefaultBrowser ( $_UpdateLink ) EndSwitch EndIf EndFunc ;==> _LookForUpdate ( ) Func _GetScriptVersion ( ) Local $_FileVersion If @Compiled Then $_FileVersion = FileGetVersion ( @ScriptFullPath, 'FileVersion' ) Else $_FileVersion = _StringBetween ( FileRead ( @ScriptFullPath ), '#AutoIt3Wrapper_Res_Fileversion=', @CR ) If Not @error Then $_FileVersion = $_FileVersion[0] Else $_FileVersion = '0.0.0.0' EndIf EndIf RegWrite ( $_RegKeySettings, 'Version', 'REG_SZ', $_FileVersion ) Return $_FileVersion EndFunc ;==> _GetScriptVersion ( ) Func _GetOutFileName ( ) Local $_StringBetween If @Compiled Then Return @ScriptName $_StringBetween = _StringBetween ( FileRead ( @ScriptFullPath ), '#AutoIt3Wrapper_Outfile=', @CR ) If Not @error Then Return $_StringBetween[0] Exit MsgBox ( 262144+16, 'Exiting on Error', 'Script is Not Compiled !' & @CRLF & @CRLF & 'Compil it, and run it.' & @CRLF, 5 ) ; just in case where Outfile name can't be found. EndFunc ;==> _GetOutFileName ( ) Func _ErrFunc ( ) Endfunc ;==> _ErrFunc ( ) Func _Exit2 ( ) DllClose ( $_MediaInfoDll ) If $_InetGet Then InetClose ( $_InetGet ) Exit EndFunc ;==> _Exit2 ( ) Func _Exit ( ) TrayItemSetState ( $_ExitItem, $TRAY_UNCHECKED ) If ( $_InetGet Or $_Progression ) And MsgBox ( 262144+1+32, 'Confirm', 'A Download is running' & @CRLF & 'Are you sure to Exit ?', 0, $_Gui ) <> 1 Then Return Exit EndFunc ;==> _Exit ( ) Func _OnAutoItExit ( ) _GUICtrlListView_UnRegisterSortCallBack ( $hListView ) RegWrite ( 'HKCU\Software\Microsoft\Internet Explorer\International', 'W2KLpk', "REG_DWORD", 0x00000001 ) ; Re-Enable IE Prompt for install language Pack If $_InetGet Then InetClose ( $_InetGet ) If $_Progression Then _WinHttpCloseHandle ( $_HttpOpenRequest ) _WinHttpCloseHandle ( $_HttpConnect ) _WinHttpCloseHandle ( $_HttpOpen ) EndIf If $_Playing Or $_PlayingStream Then _BASS_ChannelStop ( $_Mp3Handle ) If $_Mp3Handle Then _BASS_StreamFree ( $_Mp3Handle ) _BASS_Free ( ) EndIf ToolTip ( '' ) Opt ( 'TrayIconHide', 0 ) $_Split = StringSplit ( $_SoftTitle, '@' ) If Not @error Then TrayTip ( $_Split[1], $_Split[2], 1, 1 ) GUISetState ( @SW_HIDE, $_Gui ) _GDIPlus_GraphicsDispose ( $hGraphic1 ) _GDIPlus_ImageDispose ( $hImage1 ) _GDIPlus_ImageDispose ( $hImage3 ) _GDIPlus_ImageDispose ( $hImage4 ) _GDIPlus_ImageDispose ( $hImage5 ) _GDIPlus_ImageDispose ( $hImage6 ) _GDIPlus_ImageDispose ( $hImage7 ) _GDIPlus_ImageDispose ( $hImage8 ) _GDIPlus_Shutdown ( ) $oGifArray=0 _StopSearching ( ) Sleep ( 1000 ) TrayTip ( '', '', 1, 1 ) EndFunc ;==> _OnAutoItExit ( ) Func _FileMissing ( ) If Not FileExists ( $_TempDir ) Then Return True If Not FileExists ( $_TempDir & '\MSE_Logo1.PNG' ) Then Return True If Not FileExists ( $_TempDir & '\PreLoader1.gif' ) Then Return True If Not FileExists ( $_TempDir & '\QueryButton1.PNG' ) Then Return True If Not FileExists ( $_TempDir & '\SearchButton1.PNG' ) Then Return True If Not FileExists ( $_TempDir & '\StopButton1.png' ) Then Return True If Not FileExists ( $_TempDir & '\PlayButton.png' ) Then Return True If Not FileExists ( $_TempDir & '\PauseButton.png' ) Then Return True If Not FileExists ( $_TempDir & '\StopPlayButton.png' ) Then Return True If Not FileExists ( @WindowsDir & '\Loupe2.ico' ) Then Return True If Not FileExists ( @WindowsDir & '\media\finish.wav' ) Then Return True If Not FileExists ( @WindowsDir & '\media\done.wav' ) Then Return True If Not FileExists ( @SystemDir & '\GIF89.dll' ) Then Return True If Not FileExists ( @SystemDir & '\bass.dll' ) Then Return True If Not FileExists ( @SystemDir & '\MediaInfo.dll' ) Then Return True EndFunc ;==> _FileMissing ( ) Func _FileInstall ( ) ToolTip ( _StringRepeat ( ' ', 12 ) & 'Please Wait while downloading externals files' & @Crlf, @DesktopWidth/2-152, 0, $_SoftTitle, 1, 4 ) Local $_Url = 'http://tinyurl.com/7cczd3p' If Not _IsConnected ( ) Then Exit MsgBox ( 262144+16, 'Error', 'You are Not Connected !' & @CRLF & 'Retry Later' & @CRLF & 'Exiting...', 5 ) If Not FileExists ( $_TempDir ) Then Dircreate ( $_TempDir ) RegWrite ( 'HKCU\Software\Microsoft\WINDOWS\CurrentVersion\Explorer\Advanced', 'EnableBalloonTips', "REG_DWORD", 0x00000001 ) If Not FileExists ( @WindowsDir & '\media\finish.wav' ) Then InetGet ( $_Url & '/Finish.wav', @WindowsDir & '\media\finish.wav', 9, 1 ) If Not FileExists ( @WindowsDir & '\media\done.wav' ) Then InetGet ( $_Url & '/done.wav', @WindowsDir & '\media\done.wav', 9, 1 ) If Not FileExists ( @WindowsDir & '\Loupe2.ico' ) Then InetGet ( $_Url & '/Loupe2.ico', @WindowsDir & '\Loupe2.ico', 9, 0 ) If Not FileExists ( $_TempDir & '\MSE_Logo1.PNG' ) Then InetGet ( $_Url & '/MSE_Logo1.PNG', $_TempDir & '\MSE_Logo1.PNG', 9, 0 ) If Not FileExists ( $_TempDir & '\QueryButton1.PNG' ) Then InetGet ( $_Url & '/QueryButton1.PNG', $_TempDir & '\QueryButton1.PNG', 9, 0 ) If Not FileExists ( $_TempDir & '\SearchButton1.PNG' ) Then InetGet ( $_Url & '/SearchButton1.PNG', $_TempDir & '\SearchButton1.PNG', 9, 0 ) If Not FileExists ( $_TempDir & '\StopButton1.png' ) Then InetGet ( $_Url & '/StopButton1.png', $_TempDir & '\StopButton1.png', 9, 0 ) If Not FileExists ( $_TempDir & '\PreLoader1.gif' ) Then InetGet ( $_Url & '/PreLoader1.gif', $_TempDir & '\PreLoader1.gif', 9, 0 ) If Not FileExists ( $_TempDir & '\PlayButton.png' ) Then InetGet ( $_Url & '/PlayButton.png', $_TempDir & '\PlayButton.png', 9, 0 ) If Not FileExists ( $_TempDir & '\PauseButton.png' ) Then InetGet ( $_Url & '/PauseButton.png', $_TempDir & '\PauseButton.png', 9, 0 ) If Not FileExists ( $_TempDir & '\StopPlayButton.png' ) Then InetGet ( $_Url & '/StopPlayButton.png', $_TempDir & '\StopPlayButton.png', 9, 0 ) If Not FileExists ( @SystemDir & '\bass.dll' ) Then InetGet ( $_Url & '/bass.dll', @SystemDir & '\bass.dll', 9, 0 ) If Not FileExists ( @SystemDir & '\MediaInfo.dll' ) Then InetGet ( $_Url & '/MediaInfo.dll', @SystemDir & '\MediaInfo.dll', 9, 0 ) If Not FileExists ( @SystemDir & '\GIF89.DLL' ) Then InetGet ( $_Url & '/GIF89.DLL', @SystemDir & '\GIF89.DLL', 9, 0 ) RunWait ( @Systemdir & '\regsvr32.exe GIF89.DLL /s', '', @SW_HIDE ) EndIf ToolTip ( '' ) EndFunc ;==> _FileInstall ( ) DllClose($dll) Func _SetThemeAppProperties ( $iTheme = -1 ) If Not StringInStr ( @OSTYPE, "WIN32_NT" ) Then Return 0 Switch $iTheme Case -1 Local $aOld_ThemeAppProperties = DllCall ( "Uxtheme.dll", "int", "GetThemeAppProperties" ) DllCall ( "Uxtheme.dll", "none", "SetThemeAppProperties", "int", 0 ) Return $aOld_ThemeAppProperties[0] Case Else DllCall ( "Uxtheme.dll", "none", "SetThemeAppProperties", "int", $iTheme ) EndSwitch EndFunc ;==> _SetThemeAppProperties ( ) Edited June 17, 2013 by FastJMAN1
wakillon Posted June 19, 2013 Author Posted June 19, 2013 Thanks FastJMAN1 for your feedback mp3raid.com use a captcha for download mp3, and for youtube, as there is only videos, script can't listen song directly. Most websites have modified their html code, so an update is necessary, i hope soon... Glad you love it ! AutoIt 3.3.18.0 X86 - SciTE 5.5.7 - WIN 11 24H2 X64 - Other Examples Scripts
FastJMAN1 Posted June 19, 2013 Posted June 19, 2013 Thanks FastJMAN1 for your feedback mp3raid.com use a captcha for download mp3, and for youtube, as there is only videos, script can't listen song directly. Most websites have modified their html code, so an update is necessary, i hope soon... Glad you love it ! wakillon, You are correct on the captcha but for youtube there is a way, I'm just not sure on how to go about doing it.. I have a youtube downloader that you copy the html link from youtube and then it downloads the video and it also downloads a seperate mp3 file that is just the Audio part.. I was thinking it would be cool to be able to just get the audio only from the link and to make it search youtube as well.. Also could make it were if the user clicks once on a youtube found link that it would take the user to that video on youtube and if the user clicks twice then it extracts the MP3 from the video.. For example, watch this video on how it is being done...
wakillon Posted June 19, 2013 Author Posted June 19, 2013 I have made a youtube downloader, take a look to my signature : TinyMp3Downloader I will not re-create a soft i have already done ! What 's i don't like with youtube, it's the results of search where all types of videos quality are mixed ( official, amateur and also relevancy ) And for get a good quality mp3, it's necessary to download a big video who take long time to download.( besides the conversion time ) I will don't talk about listen a youtube mp3, it would be too long to wait before the song start ! The possibility to get an overview of the song permit to avoid bad downloads and to verify the relevancy of the Search result's. Thanks for your interest to my example script, i'm actually working on other projects and updates, but Mp3SearchEngine will be update soon ! AutoIt 3.3.18.0 X86 - SciTE 5.5.7 - WIN 11 24H2 X64 - Other Examples Scripts
wakillon Posted November 2, 2013 Author Posted November 2, 2013 Ok, June to November it's not too early for update script, but it's done ! More stable and more fast. See Changes of Mp3SearchEngine v1.0.8.2 in first post AutoIt 3.3.18.0 X86 - SciTE 5.5.7 - WIN 11 24H2 X64 - Other Examples Scripts
wakillon Posted November 12, 2013 Author Posted November 12, 2013 Fixed a bug that occurred when downloading and when a new search was launched who caused script's crash. sorry for the inconvenience. Updated. Please report any bugs. AutoIt 3.3.18.0 X86 - SciTE 5.5.7 - WIN 11 24H2 X64 - Other Examples Scripts
Rogue5099 Posted November 16, 2013 Posted November 16, 2013 Very nice! Could add an option to play from downloaded. Also here is another site to search if you wanna try and add it, http://www.newjams.net/ My projects: Inventory / Mp3 Inventory, Computer Stats
wakillon Posted November 18, 2013 Author Posted November 18, 2013 Very nice! Could add an option to play from downloaded. Also here is another site to search if you wanna try and add it, http://www.newjams.net/ I can't add tapejams.com There is not direct links but multiple redirection links or in some cases java script and research is limited to one kind of music. Tested. wakillon, you rocks! Thanks. AutoIt 3.3.18.0 X86 - SciTE 5.5.7 - WIN 11 24H2 X64 - Other Examples Scripts
wakillon Posted January 7, 2014 Author Posted January 7, 2014 Updated. See changes on first post. Enjoy! AutoIt 3.3.18.0 X86 - SciTE 5.5.7 - WIN 11 24H2 X64 - Other Examples Scripts
AutID Posted January 7, 2014 Posted January 7, 2014 This is really a very good work. I want to borrow some functions for a project. I visited manually the sites you are using and i really like mp3ili. However dunno which one is the best. I will take a look at the source. Can you post an example for downloading a mp3 from mp3ili or an other server? That would be kind and i would be really greatfull. Cheers. P.S it was not running in the beggining. Had to run in admin mode and the .exe must be in the same place https://iblockify.wordpress.com/
wakillon Posted January 8, 2014 Author Posted January 8, 2014 This is really a very good work. I want to borrow some functions for a project. I visited manually the sites you are using and i really like mp3ili. However dunno which one is the best. I will take a look at the source. Can you post an example for downloading a mp3 from mp3ili or an other server? That would be kind and i would be really greatfull. Cheers. P.S it was not running in the beggining. Had to run in admin mode and the .exe must be in the same place Thanks. The best is audiodump but source code change periodicaly. mp3ili is good and look at the "_Mp3Search_Mp3ili" function for details. If UAC is enable you need to run it the first time as administrator. And as it is noticed in the first post : This script to run properly must be located next to his already compiled version. AutoIt 3.3.18.0 X86 - SciTE 5.5.7 - WIN 11 24H2 X64 - Other Examples Scripts
AutID Posted January 9, 2014 Posted January 9, 2014 (edited) It is the first time i see those sites. And your code is complicated. Actually it is not but it is not the format i use and it is really difficult for me to make it over with this. Please when and if you have the time i would really appriciate if you could post me an example. Cheers Edit: I just cut out the function to try to read it but it seams i must read the entire source to be able to make it work. When you have some times lend me a hand here expandcollapse popup#include <String.au3> #include <Array.au3> #include "WinHttp.au3" Global $sUserAgent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25 (compatible; Googlebot-Mobile/2.1; +http://www.google.com/bot.html)' Global $oGlobalIE, $iDetails Global $hTimerInitSearch, $aLinks, $sToolTipData Global $sTempDir = @TempDir & '\MSE' Global $sMp3iliSrc = _FileGenerateRandomName ( $sTempDir, 'src' ), $hDownload6, $smp3iliUrl _Mp3Search_Mp3ili ( "test" ) If @error Then ConsoleWrite(@error & @LF) _ArrayDisplay($aLinks) Func _Mp3Search_Mp3ili ( $sQuery ) $sQuery = StringLower ( StringReplace ( $sQuery, ' ', '+' ) ) Local $sFrom = 'mp3ili', $sSourceCode, $aStringBetween, $sDownloadUrl, $aTitle, $sTitle, $iGo, $sDuration, $aStringSplit, $iDuration Local $smp3iliUrl = 'http://mp3ili.net/skachat/' & $sQuery Local $hGetSourceCode_TimerInit = TimerInit ( ) $hDownload6 = InetGet ( $smp3iliUrl, $sMp3iliSrc, 1+2+8, 1 ) If @error Then ConsoleWrite(@error & @LF) Do If TimerDiff ( $hGetSourceCode_TimerInit ) > 7000 Then ; if server is overloaded InetClose ( $hDownload6 ) ExitLoop EndIf Until InetGetInfo ( $hDownload6, 2 ) $sSourceCode = FileRead ( $sMp3iliSrc ) FileDelete ( $sMp3iliSrc ) $aStringBetween = _StringBetween ( $sSourceCode, '<noindex><a href="', '<div style="h' ) If Not IsArray($aStringBetween) Then ConsoleWrite("Error, string is not array." & @LF); SetError If Not @error Then For $i = 0 To UBound ( $aStringBetween ) -1 $sDownloadUrl = StringMid ( $aStringBetween[$i], 1, StringInStr ( $aStringBetween[$i], '"' )-1 ) If Not _AlreadyInArray ( $aLinks, $sDownloadUrl, 1, 1 ) Then $aTitle = _StringBetween ( $aStringBetween[$i], 'title="', '"><img' ) If Not @error Then $sTitle = _StringProper ( StringStripWS ( StringRegExpReplace ( _StringClean ( $aTitle[0] ), '(?i)[^a-z0-9]', ' ' ), 7 ) ) If StringLen ( $sTitle ) > 3 Then $sTitle = _StringRemoveDigitsFromStart ( $sTitle ) $sTitle = _StringRemoveFromStart ( $sTitle, '-' ) $iGo = 0 If $iDetails = 1 Then $sDuration = StringMid ( $aStringBetween[$i], StringInStr ( $aStringBetween[$i], '(', 0, -1 )+1, StringInStr ( $aStringBetween[$i], ')', 0, -1 )-StringInStr ( $aStringBetween[$i], '(', 0, -1 )-1 ) $aStringSplit = StringSplit ( $sDuration, ':', 1+2 ) If Not @error Then $iDuration = $aStringSplit[0]*60 + $aStringSplit[1] $iSizeEx = _WinHttpGetFileSize ( $sDownloadUrl ) If $iSizeEx > 1048576 Then $iBitRate = _FileGetBitRate ( $iSizeEx, $iDuration ) If $iBitRate > 95 Then $iGo = 1 _ArrayAdd ( $aLinks, $sDownloadUrl ) EndIf EndIf EndIf Else $iGo = 1 $iSizeEx = '' $iBitRate = '' EndIf EndIf EndIf EndIf Sleep ( 10 ) Next EndIf $hDownload6 = 0 EndFunc ;==> _Mp3Search_Mp3ili () Func _FileGetBitRate ( $iSize, $iDuration ) Local $iBitRate = $iSize/1024/$iDuration*8 Switch $iBitRate Case 65 To 96 $iBitRate = 96 Case 97 To 112 $iBitRate = 112 Case 113 To 128 $iBitRate = 128 Case 129 To 160 $iBitRate = 160 Case 161 To 192 $iBitRate = 192 Case 193 To 224 $iBitRate = 224 Case 225 To 256 $iBitRate = 256 Case 257 To 320 $iBitRate = 320 Case Else $iBitRate = 0 EndSwitch Return $iBitRate EndFunc ;==> _FileGetBitRate () Func _WinHttpGetFileSize ( $sDownloadFileUrl, $sCookie='' ) Local $hOpen = _WinHttpOpen ( $sUserAgent ), $iFileSize Local $aCrackedUrl = _WinHttpCrackUrl ( $sDownloadFileUrl, $ICU_DECODE ) If Not @error Then Local $sHostName = $aCrackedUrl[2] Local $hConnect = _WinHttpConnect ( $hOpen, $sHostName ) Local $sFileName = $aCrackedUrl[6] & $aCrackedUrl[7] Local $hRequest = _WinHttpOpenRequest ( $hConnect, 'GET', $sFileName, 'HTTP/1.1', $sHostName ) _WinHttpAddRequestHeaders ( $hRequest, 'Accept: application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, application/msword, */*' ) _WinHttpAddRequestHeaders ( $hRequest, 'Accept-Encoding: gzip, deflate' ) _WinHttpAddRequestHeaders ( $hRequest, 'Connection: Keep-Alive' ) If StringInStr ( $sDownloadFileUrl, 'qqmusic.qq' ) Then _WinHttpAddRequestHeaders ( $hRequest, 'Referer: http://soso.music.qq.com/fcgi-bin/fcg_song.fcg' ) If $sCookie <> '' Then _WinHttpAddRequestHeaders ( $hRequest, 'Cookie: ' & $sCookie ) _WinHttpSendRequest ( $hRequest ) _WinHttpReceiveResponse ( $hRequest ) If _WinHttpQueryDataAvailable ( $hRequest ) Then $iFileSize = _WinHttpQueryHeaders ( $hRequest, $WINHTTP_QUERY_CONTENT_LENGTH ) _WinHttpCloseHandle ( $hRequest ) _WinHttpCloseHandle ( $hConnect ) EndIf _WinHttpCloseHandle ( $hOpen ) Return $iFileSize EndFunc ;==> _WinHttpGetFileSize () Func _StringRemoveFromStart ( $sString, $sStringToRemove ) While StringLeft ( StringStripWS ( $sString, 7 ), 1 ) = $sStringToRemove $sString = StringTrimLeft ( $sString, 1 ) WEnd Return StringStripWS ( $sString, 7 ) EndFunc ;==> _StringRemoveFromStart () Func _StringRemoveDigitsFromStart ( $sString ) While StringIsDigit ( StringLeft ( StringStripWS ( $sString, 7 ), 1 ) ) $sString = StringTrimLeft ( $sString, 1 ) WEnd Return $sString EndFunc ;==> _StringRemoveDigitsFromStart () Func _StringReplaceHtmlSymbolEntities ( $sString ) Return StringRegExpReplace ( $sString, '&#([[:xdigit:]]+);', Execute ( Chrw ( '0x$1' ) ) ) EndFunc ;==> _StringReplaceHtmlSymbolEntities () Func _StringReplaceUnicodeChars ( $sString ) Return Execute ( '"' & StringRegexpReplace ( $sString, '(?i)\\U([[:xdigit:]]{2,4})', '"&chrw(0x$1)&"' ) & '"' ) EndFunc ;==> _StringReplaceUnicodeChars () Func _StringReplaceCyrillicChars ( $sString ) Return StringRegExpReplace ( $sString, '[^[:alnum:]\-\s\x{0400}-\x{04FF}]', '' ) EndFunc ;==> _StringReplaceCyrillicChars () Func _StringReplaceAccent ( $sString ) $sString = StringReplace ( $sString, '°', '°' ) $sString = StringReplace ( $sString, 'ç', 'c' ) $sString = StringReplace ( $sString, 'ß', 'ss' ) $sString = StringReplace ( $sString, "’", "'" ) $sString = StringReplace ( $sString, '€', '€' ) $sString = StringRegExpReplace ( $sString, '(Ú|ê|é|è|ë|«|©|ã©|ãš|ãª|ã¨|ã«|â«|â©|è|é|ê)', 'e' ) $sString = StringRegExpReplace ( $sString, '(ç|Ç)', 'c' ) $sString = StringRegExpReplace ( $sString, '(ÃŽ|ö|ó|ô|ãŽ|ã¶|ã³|ã´|ô)', 'o' ) $sString = StringRegExpReplace ( $sString, '(û|ü|ù|ÃŒ|ú|ã»|ã¼|ã¹|ãŒ|ãº|û|ù)', 'u' ) $sString = StringRegExpReplace ( $sString, '(ï|î|ã¯|ã®|î)', 'i' ) $sString = StringRegExpReplace ( $sString, '(à |â|ä|À|ã|á|Ã¥|ã |ã¢|ã¤|ã€|ã£|ã¡|ã¥|â|ÃÂ|ãƒâ)', 'a' ) $sString = StringReplace ( $sString, 'Ã', 'a' ) Local $aPattern[7][2] = [['[àáãâáäåÁÀÄÂÅœŒÆ]', 'a'], ['[éêèéëÉÈËÊ]', 'e'], ['[íîïìÍÌÏÎ]', 'i'], ['[óõôòöÓÒÖÔøØ]', 'o'], ['[úûùüÚÙÜÛ]', 'u'], ['[ýÿÝ]', 'y'], ['[çÇ]', 'c']] For $i = 0 To 6 $sString = StringRegExpReplace ( $sString, $aPattern[$i][0], $aPattern[$i][1] ) Next Return $sString EndFunc ;==> _StringReplaceAccent () Func _StringClean ( $sString ) $sString = StringRegExpReplace ( $sString, '%([[:xdigit:]]+)', Execute ( Chr ( '0x$1' ) ) ) $sString = StringReplace ( $sString, '"', '"' ) $sString = StringReplace ( $sString, ''', "'" ) $sString = StringReplace ( $sString, '&', '&' ) $sString = StringReplace ( $sString, '<', '<' ) $sString = StringReplace ( $sString, '>', '>' ) $sString = _StringReplaceHtmlSymbolEntities ( $sString ) If StringRegexp ( $sString, '(?i)U([[:xdigit:]]{2,4})' ) Then $sString = StringReplace ( $sString, ' u', '\u' ) $sString = _StringReplaceUnicodeChars ( $sString ) EndIf $sString = StringReplace ( $sString, '-', 'IIIIIII' ) $sString = StringReplace ( $sString, "'", 'JJJJJJJ' ) $sString = StringStripWS ( StringReplace ( StringReplace ( $sString, 'IIIIIII', '-' ), 'JJJJJJJ', "'" ), 7 ) If StringRight ( $sString, 1 ) = '-' Then $sString = StringTrimRight ( $sString, 1 ) If StringLeft ( $sString, 1 ) = '-' Then $sString = StringTrimLeft ( $sString, 1 ) Do $sString = StringReplace ( $sString, "''", "'" ) Until Not @extended $sString = _StringRemoveDigitsFromStart ( $sString ) While StringLeft ( StringStripWS ( $sString, 7 ), 1 ) = '-' $sString = StringTrimLeft ( $sString, 1 ) WEnd $sString = _StringReplaceCyrillicChars ( $sString ) $sString = _StringReplaceAccent ( $sString ) If StringLeft ( StringStripWS ( $sString, 7 ), 1 ) = '-' Then Do $sString = StringTrimLeft ( StringStripWS ( $sString, 7 ), 1 ) Until StringLeft ( StringStripWS ( $sString, 7 ), 1 ) <> '-' EndIf If StringRight ( StringStripWS ( $sString, 7 ), 1 ) = '-' Then Do $sString = StringTrimRight ( StringStripWS ( $sString, 7 ), 1 ) Until StringRight ( StringStripWS ( $sString, 7 ), 1 ) <> '-' EndIf $sString = StringReplace ( $sString, ' cover', '' ) Return StringStripWS ( _StringReplaceUnWantedChars ( $sString ), 7 ) EndFunc ;==> _StringClean () Func _StringReplaceUnWantedChars ( $sString ) Return StringReplace ( StringRegExpReplace ( $sString, '[/:;.,_*?!"^`&~${}<>|#%]', ' ' ), '\', ' ' ) EndFunc ;==> _StringReplaceUnWantedChars () Func _AlreadyInArray ( $aSearch, $sItem, $iStart=0, $iPartial=0 ) Local $iIndex = _ArraySearch ( $aSearch, $sItem, $iStart, 0, 0, $iPartial ) If Not @error Then Return $iIndex EndFunc ;==> _AlreadyInArray () Func _FileGenerateRandomName ( $sDirectory, $sExt ) Do Local $sTempName = '~', $sTempPath While StringLen ( $sTempName ) < 12 $sTempName = $sTempName & Chr ( Round ( Random ( 97, 122 ), 0 ) ) Wend $sTempPath = $sDirectory & '\' & $sTempName & '.' & $sExt Until Not FileExists ( $sTempPath ) Return $sTempPath EndFunc ;==> _FileGenerateRandomName () Edited January 9, 2014 by AutID https://iblockify.wordpress.com/
wakillon Posted January 13, 2014 Author Posted January 13, 2014 Nothing too complicate ! Try like that : expandcollapse popup#include <String.au3> #include <Array.au3> #include "WinHttp.au3" Global $aLinks[1], $iTimeOut = 1000 Global $sTempDir = @TempDir & '\AutID' Global $sMp3iliSrc = _FileGenerateRandomName ( $sTempDir, 'src' ), $hDownload6, $smp3iliUrl _Mp3Search_Mp3ili ( "the beatles" ) _ArrayDisplay($aLinks) Func _Mp3Search_Mp3ili ( $sQuery ) $sQuery = StringLower ( StringReplace ( $sQuery, ' ', '%20' ) ) Local $sSourceCode, $aStringBetween, $sDownloadUrl, $aTitle, $sTitle, $sDuration, $aStringSplit, $iDuration Local $smp3iliUrl = 'http://mp3ili.net/skachat/' & $sQuery If Not FileExists ( $sTempDir ) Then DirCreate ( $sTempDir ) Local $hGetSourceCode_TimerInit = TimerInit ( ) $hDownload6 = InetGet ( $smp3iliUrl, $sMp3iliSrc, 1+2+8, 1 ) Do If TimerDiff ( $hGetSourceCode_TimerInit ) > 7000 Then ; if server is overloaded InetClose ( $hDownload6 ) ExitLoop EndIf Until InetGetInfo ( $hDownload6, 2 ) $sSourceCode = FileRead ( $sMp3iliSrc ) FileDelete ( $sMp3iliSrc ) $aStringBetween = _StringBetween ( $sSourceCode, '<noindex><a href="', '<div style="h' ) If Not @error Then For $i = 0 To UBound ( $aStringBetween ) -1 $sDownloadUrl = StringMid ( $aStringBetween[$i], 1, StringInStr ( $aStringBetween[$i], '"' )-1 ) If Not _AlreadyInArray ( $aLinks, $sDownloadUrl, 1, 1 ) Then $aTitle = _StringBetween ( $aStringBetween[$i], 'title="', '"><img' ) If Not @error Then $sTitle = _StringProper ( StringStripWS ( StringRegExpReplace ( _StringClean ( $aTitle[0] ), '(?i)[^a-z0-9]', ' ' ), 7 ) ) ConsoleWrite ( '+->-- [' & StringFormat ( '%03i', @ScriptLineNumber ) & '][' & @HOUR & @MIN & @SEC & '] Title : ' & $sTitle & @Crlf ) If StringLen ( $sTitle ) > 3 Then $sTitle = _StringRemoveDigitsFromStart ( $sTitle ) $sTitle = _StringRemoveFromStart ( $sTitle, '-' ) $sDuration = StringMid ( $aStringBetween[$i], StringInStr ( $aStringBetween[$i], '(', 0, -1 )+1, StringInStr ( $aStringBetween[$i], ')', 0, -1 )-StringInStr ( $aStringBetween[$i], '(', 0, -1 )-1 ) $aStringSplit = StringSplit ( $sDuration, ':', 1+2 ) If Not @error Then $iDuration = $aStringSplit[0]*60 + $aStringSplit[1] ConsoleWrite ( '-->-- [' & StringFormat ( '%03i', @ScriptLineNumber ) & '][' & @HOUR & @MIN & @SEC & '] Duration : ' & $iDuration & @Crlf ) $iSizeEx = _WinHttpGetFileSize ( $sDownloadUrl ) ConsoleWrite ( '+->-- [' & StringFormat ( '%03i', @ScriptLineNumber ) & '][' & @HOUR & @MIN & @SEC & '] Size : ' & $iSizeEx & @Crlf ) If $iSizeEx > 1048576 Then $iBitRate = _FileGetBitRate ( $iSizeEx, $iDuration ) ConsoleWrite ( '-->-- [' & StringFormat ( '%03i', @ScriptLineNumber ) & '][' & @HOUR & @MIN & @SEC & '] BitRate : ' & $iBitRate & @Crlf ) If $iBitRate > 95 Then _ArrayAdd ( $aLinks, $sDownloadUrl ) EndIf EndIf EndIf EndIf EndIf Sleep ( 10 ) Next EndIf $hDownload6 = 0 EndFunc ;==> _Mp3Search_Mp3ili () Func _FileGetBitRate ( $iSize, $iDuration ) Local $iBitRate = $iSize/1024/$iDuration*8 Switch $iBitRate Case 65 To 96 $iBitRate = 96 Case 97 To 112 $iBitRate = 112 Case 113 To 128 $iBitRate = 128 Case 129 To 160 $iBitRate = 160 Case 161 To 192 $iBitRate = 192 Case 193 To 224 $iBitRate = 224 Case 225 To 256 $iBitRate = 256 Case 257 To 320 $iBitRate = 320 Case Else $iBitRate = 0 EndSwitch Return $iBitRate EndFunc ;==> _FileGetBitRate () Func _WinHttpGetFileSize ( $sDownloadFileUrl, $sCookie='' ) Local $sUserAgent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25 (compatible; Googlebot-Mobile/2.1; +http://www.google.com/bot.html)' Local $hOpen = _WinHttpOpen ( $sUserAgent ), $iFileSize Local $aCrackedUrl = _WinHttpCrackUrl ( $sDownloadFileUrl, $ICU_DECODE ) If Not @error Then Local $sHostName = $aCrackedUrl[2] _WinHttpSetTimeouts ( $hOpen, 0, $iTimeOut, $iTimeOut, $iTimeOut ) Local $hConnect = _WinHttpConnect ( $hOpen, $sHostName ) Local $sFileName = $aCrackedUrl[6] & $aCrackedUrl[7] Local $hRequest = _WinHttpOpenRequest ( $hConnect, 'GET', $sFileName, 'HTTP/1.1', $sHostName ) _WinHttpAddRequestHeaders ( $hRequest, 'Accept: application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, application/msword, */*' ) _WinHttpAddRequestHeaders ( $hRequest, 'Accept-Encoding: gzip, deflate' ) _WinHttpAddRequestHeaders ( $hRequest, 'Connection: Keep-Alive' ) If $sCookie <> '' Then _WinHttpAddRequestHeaders ( $hRequest, 'Cookie: ' & $sCookie ) _WinHttpSendRequest ( $hRequest ) _WinHttpReceiveResponse ( $hRequest ) If _WinHttpQueryDataAvailable ( $hRequest ) Then $iFileSize = _WinHttpQueryHeaders ( $hRequest, $WINHTTP_QUERY_CONTENT_LENGTH ) _WinHttpCloseHandle ( $hRequest ) _WinHttpCloseHandle ( $hConnect ) EndIf _WinHttpCloseHandle ( $hOpen ) Return $iFileSize EndFunc ;==> _WinHttpGetFileSize () Func _StringRemoveFromStart ( $sString, $sStringToRemove ) While StringLeft ( StringStripWS ( $sString, 7 ), 1 ) = $sStringToRemove $sString = StringTrimLeft ( $sString, 1 ) WEnd Return StringStripWS ( $sString, 7 ) EndFunc ;==> _StringRemoveFromStart () Func _StringRemoveDigitsFromStart ( $sString ) While StringIsDigit ( StringLeft ( StringStripWS ( $sString, 7 ), 1 ) ) $sString = StringTrimLeft ( $sString, 1 ) WEnd Return $sString EndFunc ;==> _StringRemoveDigitsFromStart () Func _StringReplaceHtmlSymbolEntities ( $sString ) Return StringRegExpReplace ( $sString, '&#([[:xdigit:]]+);', Execute ( Chrw ( '0x$1' ) ) ) EndFunc ;==> _StringReplaceHtmlSymbolEntities () Func _StringReplaceUnicodeChars ( $sString ) Return Execute ( '"' & StringRegexpReplace ( $sString, '(?i)\\U([[:xdigit:]]{2,4})', '"&chrw(0x$1)&"' ) & '"' ) EndFunc ;==> _StringReplaceUnicodeChars () Func _StringReplaceCyrillicChars ( $sString ) Return StringRegExpReplace ( $sString, '[^[:alnum:]\-\s\x{0400}-\x{04FF}]', '' ) EndFunc ;==> _StringReplaceCyrillicChars () Func _StringReplaceAccent ( $sString ) $sString = StringReplace ( $sString, '°', '°' ) $sString = StringReplace ( $sString, 'ç', 'c' ) $sString = StringReplace ( $sString, 'ß', 'ss' ) $sString = StringReplace ( $sString, "’", "'" ) $sString = StringReplace ( $sString, '€', '€' ) $sString = StringRegExpReplace ( $sString, '(Ú|ê|é|è|ë|«|©|ã©|ãš|ãª|ã¨|ã«|â«|â©|è|é|ê)', 'e' ) $sString = StringRegExpReplace ( $sString, '(ç|Ç)', 'c' ) $sString = StringRegExpReplace ( $sString, '(ÃŽ|ö|ó|ô|ãŽ|ã¶|ã³|ã´|ô)', 'o' ) $sString = StringRegExpReplace ( $sString, '(û|ü|ù|ÃŒ|ú|ã»|ã¼|ã¹|ãŒ|ãº|û|ù)', 'u' ) $sString = StringRegExpReplace ( $sString, '(ï|î|ã¯|ã®|î)', 'i' ) $sString = StringRegExpReplace ( $sString, '(à |â|ä|À|ã|á|Ã¥|ã |ã¢|ã¤|ã€|ã£|ã¡|ã¥|â|ÃÂ|ãƒâ)', 'a' ) $sString = StringReplace ( $sString, 'Ã', 'a' ) Local $aPattern[7][2] = [['[àáãâáäåÁÀÄÂÅœŒÆ]', 'a'], ['[éêèéëÉÈËÊ]', 'e'], ['[íîïìÍÌÏÎ]', 'i'], ['[óõôòöÓÒÖÔøØ]', 'o'], ['[úûùüÚÙÜÛ]', 'u'], ['[ýÿÝ]', 'y'], ['[çÇ]', 'c']] For $i = 0 To 6 $sString = StringRegExpReplace ( $sString, $aPattern[$i][0], $aPattern[$i][1] ) Next Return $sString EndFunc ;==> _StringReplaceAccent () Func _StringClean ( $sString ) $sString = StringRegExpReplace ( $sString, '%([[:xdigit:]]+)', Execute ( Chr ( '0x$1' ) ) ) $sString = StringReplace ( $sString, '"', '"' ) $sString = StringReplace ( $sString, ''', "'" ) $sString = StringReplace ( $sString, '&', '&' ) $sString = StringReplace ( $sString, '<', '<' ) $sString = StringReplace ( $sString, '>', '>' ) $sString = _StringReplaceHtmlSymbolEntities ( $sString ) If StringRegexp ( $sString, '(?i)U([[:xdigit:]]{2,4})' ) Then $sString = StringReplace ( $sString, ' u', '\u' ) $sString = _StringReplaceUnicodeChars ( $sString ) EndIf $sString = StringReplace ( $sString, '-', 'IIIIIII' ) $sString = StringReplace ( $sString, "'", 'JJJJJJJ' ) $sString = StringStripWS ( StringReplace ( StringReplace ( $sString, 'IIIIIII', '-' ), 'JJJJJJJ', "'" ), 7 ) If StringRight ( $sString, 1 ) = '-' Then $sString = StringTrimRight ( $sString, 1 ) If StringLeft ( $sString, 1 ) = '-' Then $sString = StringTrimLeft ( $sString, 1 ) Do $sString = StringReplace ( $sString, "''", "'" ) Until Not @extended $sString = _StringRemoveDigitsFromStart ( $sString ) While StringLeft ( StringStripWS ( $sString, 7 ), 1 ) = '-' $sString = StringTrimLeft ( $sString, 1 ) WEnd $sString = _StringReplaceCyrillicChars ( $sString ) $sString = _StringReplaceAccent ( $sString ) If StringLeft ( StringStripWS ( $sString, 7 ), 1 ) = '-' Then Do $sString = StringTrimLeft ( StringStripWS ( $sString, 7 ), 1 ) Until StringLeft ( StringStripWS ( $sString, 7 ), 1 ) <> '-' EndIf If StringRight ( StringStripWS ( $sString, 7 ), 1 ) = '-' Then Do $sString = StringTrimRight ( StringStripWS ( $sString, 7 ), 1 ) Until StringRight ( StringStripWS ( $sString, 7 ), 1 ) <> '-' EndIf $sString = StringReplace ( $sString, ' cover', '' ) Return StringStripWS ( _StringReplaceUnWantedChars ( $sString ), 7 ) EndFunc ;==> _StringClean () Func _StringReplaceUnWantedChars ( $sString ) Return StringReplace ( StringRegExpReplace ( $sString, '[/:;.,_*?!"^`&~${}<>|#%]', ' ' ), '\', ' ' ) EndFunc ;==> _StringReplaceUnWantedChars () Func _AlreadyInArray ( $aSearch, $sItem, $iStart=0, $iPartial=0 ) Local $iIndex = _ArraySearch ( $aSearch, $sItem, $iStart, 0, 0, $iPartial ) If Not @error Then Return $iIndex EndFunc ;==> _AlreadyInArray () Func _FileGenerateRandomName ( $sDirectory, $sExt ) Do Local $sTempName = '~', $sTempPath While StringLen ( $sTempName ) < 12 $sTempName = $sTempName & Chr ( Round ( Random ( 97, 122 ), 0 ) ) Wend $sTempPath = $sDirectory & '\' & $sTempName & '.' & $sExt Until Not FileExists ( $sTempPath ) Return $sTempPath EndFunc ;==> _FileGenerateRandomName () AutID 1 AutoIt 3.3.18.0 X86 - SciTE 5.5.7 - WIN 11 24H2 X64 - Other Examples Scripts
AutID Posted January 14, 2014 Posted January 14, 2014 (edited) Thank you for the answer. I found out the audiodump is the best one. Actually i tested all of them and it was the only one that was ON while others were dead. However INetGet wont work with these links. _Mp3Search_Skull ($name) _Mp3Search_Soundcloud ($name) _Mp3Search_Myfreemp3 ($name) _Mp3Search_mp3ili ($name) _Mp3Search_Audiodump ($name) Before i found out that mp3ili server gets down i was using this function to download from mp3ili Func FileDownload($url, $SavePath) Local $xml, $Stream $xml = ObjCreate("Microsoft.XMLHTTP") $Stream = ObjCreate("Adodb.Stream") $xml.Open("GET", $url, 0) $xml.Send $Stream.Type = 1 $Stream.Open $Stream.write($xml.ResponseBody) $Stream.SaveToFile($SavePath) $Stream.Close EndFunc since inetget wasn't working with links returned from mp3ili. However neither my function or inetget are working with these servers above. Inetget actually downloads the mp3 but it is damaged. media player can't play it so i cant use sound commands + the size is incorect. It is 10-20 kbytes Edit: It actually doesnt work with mp3ili and _Mp3Search_Audiodump ($name). Edited January 14, 2014 by AutID https://iblockify.wordpress.com/
wakillon Posted January 14, 2014 Author Posted January 14, 2014 (edited) Read the first post carefully. I use a file named downloader.exe who recieve arguments from main script. See the source in the spoiler located to the first post. It permit to download mp3 files of all websites selected. Edited January 14, 2014 by wakillon AutoIt 3.3.18.0 X86 - SciTE 5.5.7 - WIN 11 24H2 X64 - Other Examples Scripts
AutID Posted January 14, 2014 Posted January 14, 2014 Read the first post carefully. I use a file named downloader.exe who recieve arguments from main script. See the source in the spoiler located to the first post. It permit to download mp3 files of all websites selected. Thanks for the help. As for your application, i have been using it for the last 2 days. I can say it is a high cpu usage app. I tested it on my desktop and during the search it reaches 40% cpu usage at its max, arround 30% normally. Tested on a 6 core with 8gb ram all of it usable, win 7 ultimate x86. As for my laptop it reaches 100% cpu usage during the start of the search. Win 7 x64 aero https://iblockify.wordpress.com/
wakillon Posted January 15, 2014 Author Posted January 15, 2014 Yes cpu usage can be high. You can see in task manager up to 10 script processes where 9 of them download source codes and check mp3 urls, and also the downloader.exe process launched for each download ! This is the price to pay for get many reliable and quick results. In each loop you can see a sleep function for reduce cpu usage. For reduce it, do not check all websites checkboxes or check "disable infos on mp3" or reduce the number of results wanted. AutoIt 3.3.18.0 X86 - SciTE 5.5.7 - WIN 11 24H2 X64 - Other Examples Scripts
AutID Posted April 26, 2014 Posted April 26, 2014 Hello wakillon, Looking back to this again I thought of using this as an exe on my computer(autoit not installed). I thought about using this as an mp3 player but it doesn't do the job. I know this is a mp3 downloader but it would be a very good feature to be able to use it as a mp3 player as well. Just add a checkbox and loop through the array to play all the mp3 found. I would do it but it might give some pleasure to you to do it since it is something you created Cheers https://iblockify.wordpress.com/
wakillon Posted April 29, 2014 Author Posted April 29, 2014 Hello wakillon, Looking back to this again I thought of using this as an exe on my computer(autoit not installed). I thought about using this as an mp3 player but it doesn't do the job. I know this is a mp3 downloader but it would be a very good feature to be able to use it as a mp3 player as well. Just add a checkbox and loop through the array to play all the mp3 found. I would do it but it might give some pleasure to you to do it since it is something you created Cheers Hi AutId ! It's not the purpose of this script, but if you want a mp3 player, take a look to my >TinyMp3Player ! AutoIt 3.3.18.0 X86 - SciTE 5.5.7 - WIN 11 24H2 X64 - Other Examples Scripts
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now