Jump to content

Kantaris - Last.FM downloader


Recommended Posts

**Kantaris is an open source media player built on VLC http://www.kantaris.org/

This works fine on my computer, however i know with the mouseclicks navigating the Kantaris menus it will not be universal. I would like suggestions on making the menu navigation more generic. Also looking for a nice way to select the next users playlist, as now you get whatever the first return is. But good for a quick grab of new stuff. Basically it performs the following:

- asks what you want to search for

- pops kantaris

- navigates to the last.fm button

- searches on the provided string

- since Kantaris autoplays the first return it right clicks in the playlist and saves the m3u to @ScriptDir

- parses the m3u for just the mp3 URLs

- throttles your box getting all the mp3s and saves them in c:\AutoITtunes

Edit(1): Added If $M3U exists then Delete it

Added If The first array (due to an empty or no m3u acquired) does not exist then messagebox, then exit.

Edit(2): Fixed tooltip.

#include <array.au3>
#Include <File.au3>

$input = inputbox ("Search For:" , "Which Artist/Title/Genre/User")
$file = "Kantaris 0.6.5"
run ("C:\Program Files\Kantaris\KantarisMain.exe")

Winwait ($file, "")
WinActivate($file)
WinMove($File , "", 300, 0, 450, 740,1)

MouseClick ("left" , 473 , 41)
sleep (250)
send ($input)
sleep (250)
send ("{ENTER}")
sleep (10000)

MouseClick ("right" , 749 , 194)
MouseClick ("left" , 810 , 366)
sleep (250)
$M3U = @ScriptDir & "\" & $input & ".m3u"
If FileExists ($M3U) Then
    FileDelete ($M3U)
EndIf

;msgbox (0 , '' , $M3U)
sleep (250)
send ($M3U)
sleep (250)
send ("{TAB}")
sleep (250)
send ("{TAB}")
sleep (250)
send ("{ENTER}")

sleep (2000)

Winclose ($file)

$temp = "c:\autoitTUNES\"

Dircreate ($temp)

Dim $aArray
_FileReadToArray($M3U,$aArray)
;msgbox (0, '' , @Error)
;~ _arraydisplay ($aArray)
IF @Error > 0 Then
    msgbox (0, '' , "No songs returned, Please Search Again")
    Exit
    Endif

$bArray = _ArrayFindAll ($aArray, 'http', 0 , 0 , 0 , 1)
;~ _arraydisplay ($bArray)


$i = ubound($bArray)
Dim $cArray[$i]
For $i = 0 to ubound ($bArray) - 1
$cArray[$i] = $aArray[$bArray[$i]]
Next

;~ _arraydisplay ($cArray)

$dstring = _ArrayToString($cArray , "/")

$dstring = StringReplace ($dstring , "%20" , " ")

$dArray = StringSplit($dstring , "/")
;~ _Arraydisplay ($dArray)

$namesArray = _ArrayFindAll ($dArray , '.mp3', 0 , 0 , 0 ,1)
;~ _Arraydisplay ($namesArray)

For $i = 0 to ubound($cArray) - 1
    $size = inetgetsize ($cArray[$i] , $temp  & $dArray[$namesArray[$i]])
    If $size > 60000 Then
tooltip ("Downloading :: " & $dArray[$namesArray[$i]] , 0 , 0 , "Downloading")
    inetget ($cArray[$i] , $temp  & $dArray[$namesArray[$i]])
    
else
    Endif
Next

tooltip ("Download Complete" , 0 , 0, "Finished" , 1)
sleep (5000)
tooltip ("")
exit
Edited by iamtheky

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

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...