hier mal aus Spaß an der Freud
[Blockierte Grafik: http://leviathan-design.de/tools/soad.png]
Spoiler anzeigen
#cs
Myspace-Music-Downloader by Leviathan
v0.1 please don't copy without my Name
#ce
#include <GuiListView.au3>
#include <GUIConstants.au3>
#include <String.au3>
#Include <INet.au3>
#NoTrayIcon
$Form1 = GUICreate("Myspace Music-Downloader v0.2", 222, 270, 193, 125)
$input = GUICtrlCreateInput("", 8, 32, 209, 21)
$Tracks = GUICtrlCreateListView("Tracks ", 8, 72, 209, 145)
GUICtrlSetLimit($Tracks, 210)
$Label1 = GUICtrlCreateLabel("Myspace-Account-Link:", 8, 8, 116, 17)
$Button1 = GUICtrlCreateButton("download", 8, 224, 121, 25, 0)
GUICtrlSetState($Button1, $GUI_DISABLE)
$Button2 = GUICtrlCreateButton("analyize", 136, 224, 81, 25, 0)
$progressCurrent = GUICtrlCreateProgress(8, 255, 209, 10)
GUISetState(@SW_SHOW)
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then Exit
If $msg = $Button2 Then _analyize()
If $msg = $Button1 Then _download()
WEnd
Func _analyize()
GUICtrlSetState($Button1, $GUI_DISABLE)
_GUICtrlListViewDeleteAllItems($Tracks)
$id = _getid(GUICtrlRead($input))
If $id <> 0 Then
_retrievedata($id)
GUICtrlSetState($Button1, $GUI_ENABLE)
EndIf
EndFunc
[/autoit] [autoit][/autoit] [autoit]Func _download()
$current = _GUICtrlListViewGetHotItem($Tracks)
;MsgBox(0,"", $current)
$dlpath = @ScriptDir&"\Downloads"
DirCreate($dlpath)
For $i = 0 to Ubound($durl)-1
$size = InetGetSize($durl[$i])
InetGet($durl[$i], $dlpath&"\"&$name[0]&" - "&$title[$i]&".mp3", 0, 1)
If @error Then
MsgBox(0,"","error")
Else
While @InetGetActive
GUICtrlSetData($progressCurrent,(@InetGetBytesRead/$size)*100)
WEnd
EndIf
Next
GUICtrlSetData($input, "Download Complete")
GUICtrlSetData($progressCurrent, 0)
GUICtrlSetState($Button1, $GUI_DISABLE)
EndFunc
Func _getid($url)
If StringinStr($url, 'http://') Then $url = StringReplace($url, 'http://', '')
$source = _INetGetSource($url)
;MsgBox(0,"", $source)
If @error Then
GUICtrlSetData($input, "Couldn't connect!")
Else
$search = _StringBetween($source, '"DisplayFriendId":', ',')
If @error then
GUICtrlSetData($input, "Couldn't find User-ID")
Return 0
Else
Return $search[0]
GUICtrlSetData($input, $search[0])
Endif
EndIf
EndFunc
Func _retrievedata($id)
Global $list[99]
$res = ""
$res2 = ""
$url = "http://mediaservices.myspace.com/services/media/musicplayerxml.ashx?b="&$id
$source = _INetGetSource($url)
;FileWrite(@Scriptdir&"\xml.xml", $source)
Global $durl = _StringBetween($source, 'durl="', '"')
Global $title = _StringBetween($source, 'title="', '"')
Global $name = _StringBetween($source, '')
If IsArray($durl) Then
#cs For $i = 0 To Ubound($durl)-1
$res &= $durl[$i]&@CRLF
$res2 &= $title[$i]&@CRLF
Next
#ce MsgBox(0,"", $res2)
For $i = 0 To Ubound($title)-1
$list[$i] = GUICtrlCreateListViewItem($name[0]&" - "&$title[$i], $Tracks)
Next
EndIf
EndFunc