History:Some of my friends likes to listen to music on the school or at home, but they didnt like that they werent able to save music from Radioblogclub without going through alot of pain of removing javascript tags.
So i made this program for them so they can save music easy now.
Program::
#cs How to use: First search for a song, when found click the link so you can hear it in the RBS v3 test on RBS site. then rightclick on the red bar saying "Click here to play " Now you should get a link in your clipboard saying something like: java script:openRadio('http://soral.borkmadjai.com/?autoplay=') Now Press the Gather List button. This should get the playlist.php on the server source (XML) an save it(ON VERY RARE HOSTS THEY DONT USE THE playlist.php) Then it will fill all these songs which links are located in the XML file into the left Listview (The listview which contains songs located on servers) After that you can mark one song in the left Listview and Press ">>" to add that song to your download listview( Right listview) When done with that you can press Download and it should start downloading the songs in your download list This script allows you to kinda directory list the files in sounds/ on a radioblogclub site and the and them to a download list Program best used in 1280:1024 Know bugs: if you press Forward or Backward before have done anything in the IE object it will crash Author:Rambo3889 Greetz goes to: Jon & The Autoit Team. GaFrost for his wonderfull UDF for Listview Anyone else which helped me to learn autoit in a good way on their forum. #ce #include <String.au3> #include <inet.au3> #include <array.au3> #include <file.au3> #include <Guiconstants.au3> #include <Guilistview.au3> Global Const $debug = False;for debugging purpose Global Const $real = True Global $Downloadstate = 0 Global $Lastpath Global $dldir Dim $read If Not FileExists(@ScriptDir & "\Rbcdl.ini") Then FileWrite(@ScriptDir & "\Rbcdl.ini", "[Settings]" & @CRLF & "dldir=" & @ScriptDir & "\Radioblogclub downloader\") $dldir = IniRead(@ScriptDir & "\Rbcdl.ini", "Settings", "dldir", @ScriptDir & "\Radioblogclub downloader\") If Not FileExists($dldir) Then DirCreate($dldir) $Radio = ObjCreate("Shell.Explorer.2") AutoItSetOption("WinTitleMatchMode", 4) $trayheight = WinGetPos("classname=Shell_TrayWnd", "") $height = @DesktopHeight - $trayheight[3] $width = $trayheight[2] $main = GUICreate("Radioblogclub", @DesktopWidth, $height - 20, 0, 0, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $RadioOBJ = GUICtrlCreateObj($Radio, 20, 20, @DesktopWidth - 400, $height - 450) GUICtrlCreateLabel("Download directory:", 24, $height - 425) $dlinput = GUICtrlCreateInput($dldir, 120, $height - 425, @DesktopWidth - 550, 20, $ES_READONLY) $changedir = GUICtrlCreateButton("Change", @DesktopWidth - 425, $height - 425, -1, 20) GUICtrlCreateGroup("Controls", @DesktopWidth - 350, 30, 300, 300) $listfilesinhost = GUICtrlCreateButton("Gather List", @DesktopWidth - 330, 60, 90, 25) $forward = GUICtrlCreateButton("Forward", @DesktopWidth - 330, 90, 90, 25) $backward = GUICtrlCreateButton("Backward", @DesktopWidth - 330, 120, 90, 25) GUICtrlCreateLabel("Current Playlist.php file:", @DesktopWidth - 330, 280) $label_php = GUICtrlCreateLabel("", @DesktopWidth - 330, 295, 275, 25, $SS_SUNKEN) $listedfilelistview = GUICtrlCreateListView("Song|Path", 20, $height - 375, @DesktopWidth - 825, 350) $downloadlist = GUICtrlCreateListView("Song|Size KB|Path", @DesktopWidth- (825 - 120), $height - 375, @DesktopWidth - 825, 350) $addtodl = GUICtrlCreateButton(">>", @DesktopWidth - 800, $height - 300, 90) $addalltodl = GUICtrlCreateButton("All >>", @DesktopWidth - 800, $height - 265, 90) $deletefromdl = GUICtrlCreateButton("Delete", @DesktopWidth - 800, $height - 230, 90) $Removeall = GUICtrlCreateButton("Remove all", @DesktopWidth - 800, $height - 195, 90) $downloadthem = GUICtrlCreateButton("Download", @DesktopWidth - 800, $height - 160, 90) $Abort = GUICtrlCreateButton("Abort", @DesktopWidth - 800, $height - 125, 90) $help = GUICtrlCreateButton("Help", @DesktopWidth - 330, 150, 90, 25) GUICtrlCreateLabel("Statusbar:", @DesktopWidth - 350, 340) $statusbar = GUICtrlCreateLabel("", @DesktopWidth - 350, 360, 300, 50, $SS_SUNKEN) $oMyError = ObjEvent("AutoIt.Error", "uselessfunc");Create a event to catch Erros and pass them to The func _GUICtrlListViewSetColumnWidth($listedfilelistview, 0, 100) _GUICtrlListViewSetColumnWidth($downloadlist, 0, 100) GUICtrlSetState($Abort, $GUI_DISABLE) GUICtrlSetBkColor($statusbar, 0xff0000) If $real Then $Radio.navigate ("<a href='http://www.radioblogclub.com' class='bbc_url' title='External link' rel='nofollow external'>http://www.radioblogclub.com"</a>) If Not $real Then $Radio.navigate ("about:blank") GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $changedir $folderselect = FileSelectFolder("Select a folder", "", 5) If @error Then MsgBox(0, "", "No folder selected" & @CRLF & "No changes have been made") Else GUICtrlSetData($dlinput, $folderselect & "\") IniWrite(@ScriptDir & "\Rbcdl.ini", "settings", "dldir", $folderselect & "\") $dldir = $folderselect & "\" EndIf Case $help MsgBox(0, "Help", @CRLF & _ ' How to use:' & @CRLF & _ ' First search for a song, when found click the link so you can hear it in the RBS v3 test on RBS site.' & @CRLF & _ ' then rightclick on the red bar saying "Click here to play "' & @CRLF & _ " Now you should get a link in your clipboard saying something like: java script:openRadio('http://soral.borkmadjai.com/?autoplay=')" & @CRLF & _ ' Now Press the Gather List button.' & @CRLF & _ ' This should get the playlist.php on the server source (XML) an save it(ON VERY RARE HOSTS THEY DONT USE THE playlist.php)' & @CRLF & _ ' Then it will fill all these songs which links are located in the XML file into the left Listview (The listview which contains songs located on servers)' & @CRLF & _ ' After that you can mark one song in the left Listview and Press ">>" to add that song to your download listview( Right listview)' & @CRLF & _ ' When done with that you can press Download and it should start downloading the songs in your download list') Case $GUI_EVENT_CLOSE Exit Case $addtodl _addtodllist() Case $deletefromdl _GUICtrlListViewDeleteItemsSelected($downloadlist) Case $listfilesinhost _getandlist(ClipGet()) Case $downloadthem _download() Case $addalltodl _addall() Case $Removeall _GUICtrlListViewDeleteAllItems($downloadlist) Case $backward $Radio.GoBack Case $forward $Radio.GoForward EndSwitch WEnd Func uselessfunc() EndFunc ;==>uselessfunc Func _download() Local $aborted = 0 $totalcount = _GUICtrlListViewGetItemCount($downloadlist) - 1 If $totalcount = -1 Then setstatus("Error at downloading stage" & @CRLF & "Reason: No files in the download list") Return -1 EndIf setcontrolstate(0) $Downloadstate = 1 For $1 = 0 To $totalcount $dlpath = _GUICtrlListViewGetItemText($downloadlist, $1, 2) $name = _GUICtrlListViewGetItemText($downloadlist, $1, 0) & ".mp3" $size = _GUICtrlListViewGetItemText($downloadlist, $1, 1) $aborted = 0 If $debug Then ConsoleWrite("Now:" & $1 & @CRLF) If $debug Then ConsoleWrite("Size:" & $size & @CRLF) If $debug Then ConsoleWrite("Host:" & $dlpath & @CRLF) InetGet($dlpath, $dldir & $name, 1, 1) While @InetGetActive _GUICtrlListViewSetItemText($downloadlist, $1, 1, Int(@InetGetBytesRead / 1024) & "/" & $size) $msg = GUIGetMsg() If $msg = $Abort Then InetGet("abort") $aborted = 1 If $debug Then ConsoleWrite("Download of " & $name & " Aborted" & @CRLF) EndIf WEnd If $aborted = 0 Then _GUICtrlListViewSetItemText($downloadlist, $1, 1, "Done") Else _GUICtrlListViewSetItemText($downloadlist, $1, 1, "Aborted") EndIf Next setcontrolstate(1) EndFunc ;==>_download Func setcontrolstate($state) If $state = 1 Then GUICtrlSetState($Abort, $GUI_DISABLE) GUICtrlSetState($downloadthem, $GUI_ENABLE) GUICtrlSetState($Removeall, $GUI_ENABLE) GUICtrlSetState($listfilesinhost, $GUI_ENABLE) GUICtrlSetState($deletefromdl, $GUI_ENABLE) GUICtrlSetState($addtodl, $GUI_ENABLE) GUICtrlSetState($addalltodl, $GUI_ENABLE) If $debug Then ConsoleWrite("Controls are now Enabled " & @CRLF) EndIf If $state = 0 Then GUICtrlSetState($Abort, $GUI_ENABLE) GUICtrlSetState($downloadthem, $GUI_DISABLE) GUICtrlSetState($Removeall, $GUI_DISABLE) GUICtrlSetState($listfilesinhost, $GUI_DISABLE) GUICtrlSetState($deletefromdl, $GUI_DISABLE) GUICtrlSetState($addtodl, $GUI_DISABLE) GUICtrlSetState($addalltodl, $GUI_DISABLE) If $debug Then ConsoleWrite("Controls are now Disabled " & @CRLF) EndIf EndFunc ;==>setcontrolstate Func setstatus($zText) GUICtrlSetData($statusbar, $zText) If $debug Then ConsoleWrite("Status bar now read:" & $zText & @CRLF) EndFunc ;==>setstatus Func _addall() $total = _GUICtrlListViewGetItemCount($listedfilelistview) ConsoleWrite($total) For $1 = 0 To $total $hostpath = _GUICtrlListViewGetItemText($listedfilelistview, $1, 1) $name = _GUICtrlListViewGetItemText($listedfilelistview, $1, 0) If $name <> "" And $hostpath <> "" Then GUICtrlCreateListViewItem($name & "|" & Int(InetGetSize($hostpath) / 1024) & "|" & $hostpath, $downloadlist) If $debug Then ConsoleWrite($name & " Are now Added To dl List" & @CRLF) Next EndFunc ;==>_addall Func _addtodllist() If _GUICtrlListViewGetCurSel($listedfilelistview) = $LV_ERR Then setstatus("You'll have to choose an item before you can add it to the download list") Return -1 EndIf $filename = _GUICtrlListViewGetItemText($listedfilelistview, _GUICtrlListViewGetCurSel($listedfilelistview), 0) $path = _GUICtrlListViewGetItemText($listedfilelistview, _GUICtrlListViewGetCurSel($listedfilelistview), 1) If $debug Then ConsoleWrite("Filename:" & $filename & @CRLF) If $debug Then ConsoleWrite("Hostpath:" & $path & @CRLF) GUICtrlCreateListViewItem($filename & "|" & Int(InetGetSize($path) / 1024) & "|" & $path, $downloadlist) EndFunc ;==>_addtodllist Func _getandlist($zData) Local $adress_1;Contains the adress with removed both Local $adress_2;Contains the adress with removed the auto play but still javascript in it Local $startadresslen = StringLen($zData) Local $errorvalid = 0 Dim $read setstatus("Assambling path to filelist") $st = StringSplit($zData, "?autoplay", 1) $error = @error If @error Then setstatus("Error the address given aint a valid Radioblogclub link!") MsgBox(0, "", "The address isnt a valid radioblogclub") Local $errorvalid = 1 If $debug Then ConsoleWrite("Error at assemblin path at stage 1, error is:" & $error & @CRLF) Return 1 Else Local $adress_2 = $st[1] If $debug Then ConsoleWrite($adress_2 & @CRLF) EndIf If $adress_2 <> "" Then ;Okay the first part have been removed but now the second $st1 = StringSplit($adress_2, "'", 1) Local $adress_1 = $st1[2] & "sounds/playlist.php" If $debug Then ConsoleWrite($adress_1 & @CRLF) EndIf If $adress_1 <> "" And $errorvalid = 0 Then GUICtrlSetData($label_php, $adress_1) Global $Lastpath = StringLeft($adress_1, StringLen($adress_1) - StringLen("sounds/playlist.php")) If $debug Then ConsoleWrite($adress_1 & @CRLF & $Lastpath & @CRLF) EndIf setstatus("Deleting old filelist") $d = FileDelete(@ScriptDir & "\Temp.txt") setstatus("Downloading new filelist") $r = FileWrite(@ScriptDir & "\Temp.txt", _INetGetSource($adress_1)) _GUICtrlListViewDeleteAllItems($listedfilelistview) _FileReadToArray(@ScriptDir & "\Temp.txt", $read) setstatus("Inserting tracks into Listview") For $1 = 3 To $read[0];3 means start with the first track If $read[$1] = "</tracks>" Then ExitLoop $Array = _StringBetween($read[$1], '"', '"') If StringLeft($Array[2], 6) = "sounds" Then $pathtoinsert = $Lastpath & $Array[2] GUICtrlCreateListViewItem($Array[1] & "|" & $pathtoinsert, $listedfilelistview) Else GUICtrlCreateListViewItem($Array[1] & "|" & $Array[2], $listedfilelistview) EndIf Next $d = FileDelete(@ScriptDir & "\Temp.txt") setstatus("Done setting up listview filelist path:" & @CRLF & $adress_1) EndFunc ;==>_getandlist
Edited by rambo3889, 03 April 2007 - 04:42 AM.





