Jump to content

Radioblogclub music downloader


rambo3889
 Share

Recommended Posts

Heya Guys/Girls.

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 ("http://www.radioblogclub.com")
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
My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! youÂ’re the best in town Fight!
Link to comment
Share on other sites

44 views and no replys makes me sad :shocked:

Uh forgot to post ^^

I really really like your idea!

I'm actually coding your script into my music player to autodownload songs ^^

Btw I found a way for not need the Clipboard:

Case $listfilesinhost
            $Input = $Radio.document.documentElement.outerHTML
            $Pos = StringInStr($Input,"')"">Click here to play")
            $Pos2 = StringInStr(StringTrimLeft($Input,$Pos-100),'href="')
            $Test = StringTrimLeft($Input,$Pos2+$Pos-95)
            $Test = StringLeft($Test,$Pos - ($Pos-100+$Pos2+6))
            _getandlist($Test)

Hope you can use it :(

Edith said I should learn english.

Edited by Pascal257
Link to comment
Share on other sites

Thank you for that one i didnt think of that , very nice :shocked:

I'm Glad you like it.

I'll code in into my version now

Edited by rambo3889
My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! youÂ’re the best in town Fight!
Link to comment
Share on other sites

Thank you for that one i didnt think of that , very nice :shocked:

I'm Glad you like it.

I'll defintly use it :(

Cool

I'm glad I could help you.

Tested it many times -- should work.

I'll show you the finished code of the automaticdownload. ^^

But I'm actually pretty busy so it's posible that I post it next week or later.

Link to comment
Share on other sites

Update:

Made some error checking (If playlistfile aint possible to download)

If the sound file is a swf then it will be downloaded as a swf file

Now uses Pascal's way to getting the playlistfile. (Thanks for that one Pascal)

Code:

#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.
    Now Press the Gather List button.(Removed the clipboard use thanks to pascal :P, thanks
    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
    
    Sample xml file:
    <?xml version="1.0" encoding="UTF-8"?>
    <tracks>
    <track trackMod="1175515801" title="H-Blockx - Push Me" path="http://toms07.free.fr/Radio/radio.blog/sounds/H-Blockx - Push Me.rbs"/>
    </tracks>
    
    
    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 ("http://www.radioblogclub.com")
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 & _
                    '   Now Press the Gather List button.(Removed clipboard use thanks to Pascal,thanks:P' & @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
            $Input = $Radio.document.documentElement.outerHTML
            $Pos = StringInStr($Input, "')"">Click here to play")
            $Pos2 = StringInStr(StringTrimLeft($Input, $Pos - 100), 'href="')
            $Test = StringTrimLeft($Input, $Pos2 + $Pos - 95)
            $Test = StringLeft($Test, $Pos - ($Pos - 100 + $Pos2 + 6))
            _getandlist($Test)
        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 $name
    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) 
        If StringRight($name, 3) = "swf" Then
            setstatus("It appears that the currently file downloading is a swf file, this file will be downloaded as a swf file not a mp3")
            $name = StringLeft($name, StringLen($name) - 3) & ".swf"
        Else
            $name = $name & ".mp3"
        EndIf
        
        $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")
    

    If Not $read[1] = '<?xml version="1.0" encoding="UTF-8"?>' And $read[2] = '<tracks>' Then
        setstatus("It appears that the given playlist file aint valid or is impossible to download")
        Return -1
    EndIf
    
    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]
            
            If StringRight($pathtoinsert, 3) = 'swf' Then
                GUICtrlCreateListViewItem($Array[1] & ".swf" & "|" & $pathtoinsert, $listedfilelistview)
            Else
                GUICtrlCreateListViewItem($Array[1] & "|" & $pathtoinsert, $listedfilelistview)
            EndIf
        Else
            
            $pathtoinsert = $Array[2]
            
            If StringRight($pathtoinsert, 3) = 'swf' Then
                GUICtrlCreateListViewItem($Array[1] & ".swf" & "|" & $Array[2], $listedfilelistview)
            Else
                GUICtrlCreateListViewItem($Array[1] & "|" & $Array[2], $listedfilelistview)
            EndIf
        EndIf
    Next

    $d = FileDelete(@ScriptDir & "\Temp.txt")
    setstatus("Done setting up listview     filelist path:" & @CRLF & $adress_1)
EndFunc   ;==>_getandlist
Edited by rambo3889
My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! youÂ’re the best in town Fight!
Link to comment
Share on other sites

The program seems to work for me up until the website controls working...e.g. the search button does not work and no jukebox on the front page. Any idea why this doesn't work for me? I really like the idea of your program btw :shocked:

Link to comment
Share on other sites

The program seems to work for me up until the website controls working...e.g. the search button does not work and no jukebox on the front page. Any idea why this doesn't work for me? I really like the idea of your program btw :shocked:

Weird must be something with your IE, because it works at my place and my friends

Amazing. I love this.

Thanks for that one :(
My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! youÂ’re the best in town Fight!
Link to comment
Share on other sites

  • 1 month later...

Very nice script! To bad radioblogclub runs on 64kbs instead of 128kbs for its bitrate, though i wonder how long it will take, if it hasent happened allready, for radioblogclub to get into some serious copyright trouble...

MUHAHAHAHAHA

Link to comment
Share on other sites

  • 2 weeks later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...