Jump to content

www.pandora.com new hack Working


jang

Recommended Posts

I'm deeply sorry about all the fuss i created with my first comment. My last post aside from the first line wasn't directed to Tomb or his choice to open or not his code. (Tomb has made a choice and i respect that.)

I just talked about my point of view toward open and close sources. Just A Reflection on it that's all.

Link to comment
Share on other sites

  • Replies 65
  • Created
  • Last Reply

Top Posters In This Topic

As said I was just fooling around with the "attention whore" thing and I'm sorry if you got it wrong, the making me stupid was related to "no I didn't want it on digg, but I dugg the link" controversy.

Anymay new version out, it should support pause, change station and skip, although it isn't fully tested, check first post

I won't delete the current version.

Link to comment
Share on other sites

Jang i just checked your new version but it seems to go into an infinite loop while looking for the right plugtmp-# folder.

I guess that the same bug as in your original version.

By the way, here is my new remodeled version of the original Jang script:

Still opens a dedicated window of firefox using Pandora minimized.

you can pause, skip songs (but it will still rename the skipped song :? )

I fixed some bugs with slow connection and loss of connection

I put some more output when a problem is found.

So far, it's been running with no problems for a full day....

--------------------------------Downloads-------------------------------------

Executable only: http://locationsdouard.free.fr/pandora/pandora_rebuild.exe

Full Archive: http://locationsdouard.free.fr/pandora/pandora_rebuild.zip

---------------------------------------------------------------------------------

; ----------------------------------------------------------------------------

;

; AutoIt Version: 3.1.1.0

; Authors:         Jang & CygnusTM & Cortechs

;

; Script Function:

;   Get Pandora mp3s

;

; ----------------------------------------------------------------------------



;---------- Debug mode ------------

Opt( "TrayIconDebug",1 )

;----------------------------------



;; Start a new dedicated window of firefox and launch Pandora.com website

Run ( "C:Program FilesMozilla Firefoxfirefox.exe -new-window http://www.pandora.com/?cmd=tunermini")

; Define partial title match mode

Opt("WinTitleMatchMode", 2)

;; Wait up to 5 minutes for the window to load the first song

WinWait ( "- Pandora -", "", 300 )

;; Get the handle of a Firefox window that contains "- Pandora -" in title

$PandoraWindow = WinGetHandle( "- Pandora -" )

If @error Then

    MsgBox(4096, "Error", "Could not find the correct window")

    Exit

Else

; Define the path to the tempory folder

    $tempdir1 = EnvGet( "temp" ) & "plugtmp"

    $tempdir2 = EnvGet( "temp" ) & "plugtmp-"

    $FolderNumber = 1

    $MaxFolderDepth = 100



; Check which plugtemp exists

    While Not FileExists ( $tempdir1 & "access" )

        If $FolderNumber > $MaxFolderDepth Then

            MsgBox ( 4112 , "Time out" , "The program couldn't find any temporary folder created by Pandora." & @CRLF & "To solve this problem, try to clean this folder :" & EnvGet( "temp" ))

            Exit

        ElseIf Not FileExists ( $tempdir2 & $FolderNumber & "access" ) Then

            $FolderNumber = $FolderNumber + 1

        EndIf

        $tempdir1 = $tempdir2 & $FolderNumber

    WEnd

    

; Used later

    Opt("WinTitleMatchMode", 3)

    Global $LastNumber = 1

    Global $FilePath = $tempdir1 & "access-"

    Global $PreviousFile = $tempdir1 & "access"

    Global $NextFile = $FilePath & $LastNumber

    Global $saveto = IniRead( @ScriptDir & "config.ini", "SaveTo", "dir", @UserProfileDir & "Desktop" )

    Global $PandoraWindowTitle = "", $PandoraWindowTitleTmp = ""

    Global $Delay = 15

    Global $ConnectionActive = 1



    If FileExists ( $saveto ) Then

    Else

        DirCreate ( $saveto )

    EndIf



    While $ConnectionActive

        $PandoraWindowTitle = WinGetTitle( $PandoraWindow )

        $PandoraWindowTitleTmp = $PandoraWindowTitle

    

    ;; Wait for the next file to start caching and check if connection isn't lost

        $EndingTime = @MIN + $Delay

        While Not FileExists( $NextFile )

            Sleep( 500 )

            $StartingTime = @MIN

            If $StartingTime > $EndingTime Or "Pandora -"=StringLeft(WinGetTitle($PandoraWindow), 9) Or "Mozilla"=StringLeft(WinGetTitle($PandoraWindow), 7) Then

                MsgBox( 64, "Information", "Connection lost, the program will stop!" )

                $ConnectionActive = 0

                ExitLoop

            ElseIf "(Paused)"=StringLeft( WinGetTitle( $PandoraWindow ), 8 ) Then

                WinWait ( $PandoraWindowTitle, "", $Delay*60 )

                $EndingTime = @MIN + $Delay

            EndIf

        WEnd

        

    ;; Name the finished song

        $array = StringSplit( $PandoraWindowTitle, " - P",1 )

        $PandoraWindowTitle = $array[1]

        FileCopy( $PreviousFile, $saveto & $PandoraWindowTitle & ".mp3" )

    

    ;; Wait for the next file to start playing

        While $PandoraWindowTitleTmp = WinGetTitle( $PandoraWindow )

            Sleep( 500 )

        WEnd

        

    ;; Set the variables up for next pass

        $LastNumber = $LastNumber + 1

        $PreviousFile = $NextFile

        $NextFile = $FilePath & $LastNumber

    WEnd

EndIf

Exit

Link to comment
Share on other sites

Thanks for the update.

Could you explain the bug better?

EnvGet( "temp" ) = @tempdir

and as far as I know, if Pandora is running (I check it before) a plugtmp must exist, so sooner or later the script should find the right folder. The bug that I do know that exists is when pandora is forced to close, ie firefox crash, leaving the access files in temp, and that makes the script find the wrong folder. that is resolved by cleaning the Temp directory.

And your fix for loss of connection is great.

Link to comment
Share on other sites

as far as I know, if Pandora is running (I check it before) a plugtmp must exist, so sooner or later the script should find the right folder.

OK here is the deal: You do actually check if Pandora is running with this line

; Get the handle of a Firefox window that contains "Pandora" in title

$handle = WinGetHandle("Pandora")

But you don't wait for the "access" file you're testing to be created. This file is only created when the player starts...... playing.

You should better use this:

Opt("WinTitleMatchMode", 2)

;; Wait up to 5 minutes for the window to load the first song

WinWait ( "- Pandora -", "", 300 )

Because for people with slow or shitty connection like mine, the test will go on and on for ever as the while loop might had already pass the actual folder when the access file is created.

If that happen anyway, I added a $MaxFolderDepth variable to prevent to CPU to hang forever.

BTW here is a small update using a GUI bar that automates the closing of both the script and the Pandora window. It's based on my last remodeled version.

- Fixed: changing playlist made the program exit as lost of connection

There's one thing i didn't manage to do and don't know how to that is closing only the newly opened firefox window (and not all the firefox windows) when the player doesn't start.

It does'n t look that nice but it's my first time messing with a GUI.

--------------------------------Downloads-------------------------------------

Executable only: http://locationsdouard.free.fr/pandora/pan...rebuild_gui.exe

Full Archive: http://locationsdouard.free.fr/pandora/pan...rebuild_gui.zip

---------------------------------------------------------------------------------

; ----------------------------------------------------------------------------

;

; AutoIt Version: 3.1.1.0

; Authors:         Jang & CygnusTM & Cortechs

;

; Script Function:

;   Get Pandora mp3s

;

; ----------------------------------------------------------------------------



#include <GUIConstants.au3>



;---------- Debug mode ------------

Opt( "TrayIconDebug",1 )

;----------------------------------



; Initialize GUI

Opt("GUIOnEventMode", 1)

$mainwindow = GUICreate( "Pandora Rebuild", 250, 15, -1, 0, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW) )

GUISetBkColor( 0x336799 )

$Texte = GUICtrlCreateLabel("Wait for Pandora to start playing", 50, 0)

GUICtrlSetColor($Texte,0xff9900)

;GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")

GUISetState(@SW_SHOW)



;; Start a new dedicated window of firefox and launch Pandora.com website

Run ( "C:Program FilesMozilla Firefoxfirefox.exe -new-window http://www.pandora.com/?cmd=tunermini")

; Define partial title match mode

Opt("WinTitleMatchMode", 2)

;; Wait up to 5 minutes for the window to load the first song

WinWait ( "- Pandora -", "", 300 )

;; Get the handle of a Firefox window that contains "- Pandora -" in title

$PandoraWindow = WinGetHandle( "- Pandora -" )

If @error Then

    MsgBox(4096, "Error", "Could not find the correct window")

    Exit

Else

; Define the path to the tempory folder

    Global $tempdir1 = EnvGet( "temp" ) & "plugtmp"

    Global $tempdir2 = EnvGet( "temp" ) & "plugtmp-"

    Global $FolderNumber = 1

    Global $MaxFolderDepth = 100



; Check which plugtemp exists

    While Not FileExists ( $tempdir1 & "access" )

        If $FolderNumber > $MaxFolderDepth Then

            MsgBox ( 4112 , "Time out" , "The program couldn't find any temporary folder created by Pandora." & @CRLF & "To solve this problem, try to clean this folder :" & EnvGet( "temp" ))

            WinClose( $PandoraWindow )

            Exit

        ElseIf Not FileExists ( $tempdir2 & $FolderNumber & "access" ) Then

            $FolderNumber = $FolderNumber + 1

        EndIf

        $tempdir1 = $tempdir2 & $FolderNumber

    WEnd

    

; Used later

    Global $LastNumber = 1

    Global $FilePath = $tempdir1 & "access-"

    Global $PreviousFile = $tempdir1 & "access"

    Global $NextFile = $FilePath & $LastNumber

    Global $saveto = IniRead( @ScriptDir & "config.ini", "SaveTo", "dir", @UserProfileDir & "Desktop" )

    Global $PandoraWindowTitle = "", $PandoraWindowTitleTmp = ""

    Global $Delay = 15

    Global $ExtractSongInfo = 1

    

; Creates the close button 

    $CloseButton = GUICtrlCreateButton("X", 225, 0, 15, 15 )

    $Texte = GUICtrlCreateLabel("Pandora Rebuild is currently running ....", 15, 0)

    GUICtrlSetColor($Texte,0xff9900)

    GUICtrlSetOnEvent($CloseButton, "CloseButton")

    GUISetState(@SW_SHOW)



    If FileExists ( $saveto ) Then

    Else

        DirCreate ( $saveto )

    EndIf



    While $ExtractSongInfo

        $PandoraWindowTitle = WinGetTitle( $PandoraWindow )

        $PandoraWindowTitleTmp = $PandoraWindowTitle

    

    ;; Wait for the next file to start caching and check if connection isn't lost

        $EndingTime = @MIN + $Delay

        While Not FileExists( $NextFile )

            Sleep( 500 )

            $StartingTime = @MIN

            If $StartingTime > $EndingTime And ("Pandora -"=StringLeft(WinGetTitle($PandoraWindow), 9) Or "Mozilla"=StringLeft(WinGetTitle($PandoraWindow), 7)) Then

                MsgBox( 64, "Information", "Connection lost, the program will stop!" )

                Call( "CloseButton" )

            ElseIf "(Paused)"=StringLeft( WinGetTitle( $PandoraWindow ), 8 ) Then

                Opt("WinTitleMatchMode", 3); Define total title match mode

                WinWait ( $PandoraWindowTitle, "", $Delay*60 )

                $EndingTime = @MIN + $Delay

            EndIf

        WEnd

        

    ;; Name the finished song

        $array = StringSplit( $PandoraWindowTitle, " - P",1 )

        $PandoraWindowTitle = $array[1]

        FileCopy( $PreviousFile, $saveto & $PandoraWindowTitle & ".mp3" )

    

    ;; Wait for the next file to start playing

        While $PandoraWindowTitleTmp = WinGetTitle( $PandoraWindow )

            Sleep( 500 )

        WEnd

        

    ;; Set the variables up for next pass

        $LastNumber = $LastNumber + 1

        $PreviousFile = $NextFile

        $NextFile = $FilePath & $LastNumber

    WEnd

EndIf



Func CloseButton()

; Define partial title match mode

    Opt("WinTitleMatchMode", 2)

; Name the current song if finished downloading

    If WinExists ( "- Pandora -" ) And FileExists( $NextFile ) Then

    ;; Name the finished song

        $array = StringSplit( $PandoraWindowTitle, " - P",1 )

        $PandoraWindowTitle = $array[1]

        FileCopy( $PreviousFile, $saveto & $PandoraWindowTitle & ".mp3" )

    EndIf

    WinClose( $PandoraWindow )

    Exit

EndFunc



Exit

Link to comment
Share on other sites

hey, creator of the original pandora hack here...

listen, i have all these things working. my app works perfectly, it supports pausing, skipping, and even does ID3 tags... it also has none of the bugs that 3tunes has....

refer to this please: http://www.hak5.org/forums/viewtopic.php?t=409

you need to get your hands on pandora1.1, my updated version. you'll love it.

I need a host though.

Link to comment
Share on other sites

I guess it's gonna be the last update for a while until pandora decide to change something with the way their player works.... Or until somebody get real issues with this release.

Fixed: Detect title containing the "(Paused)" string.

Assume that the string "Pandora -" means skipped track or connection lost

If connection lost mark the file as "~ConnectionLost~ " +full title

Bug: Out of sync if skip a song and pause right away. I believe it's a problem of Pandora not refreshing the player fast enough sometimes because it doesn't happen quiet often.

Make sure the player displays the title right from the start. Again Pandora's problem. Sometimes the first title gets lost in the tube (my connection is bad).

--------------------------------Downloads-------------------------------------

Executable only: http://locationsdouard.free.fr/pandora/pan...rebuild_gui.exe

Full Archive: http://locationsdouard.free.fr/pandora/pan...rebuild_gui.zip

---------------------------------------------------------------------------------

; ----------------------------------------------------------------------------

;

; AutoIt Version: 3.1.1.0

; Authors:         Jang & CygnusTM & Cortechs

;

; Script Function:

;   Get Pandora mp3s

;

; ----------------------------------------------------------------------------



#include <GUIConstants.au3>



;---------- Debug mode ------------

Opt( "TrayIconDebug",1 )

;----------------------------------



; Initialize GUI

Opt("GUIOnEventMode", 1)

$mainwindow = GUICreate( "Pandora Rebuild", 250, 15, -1, 0, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW) )

GUISetBkColor( 0x336799 )

$Texte = GUICtrlCreateLabel("Wait for Pandora to start playing", 50, 0)

GUICtrlSetColor($Texte,0xff9900)

;GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")

GUISetState(@SW_SHOW)



;; Start a new dedicated window of firefox and launch Pandora.com website

Run ( "C:Program FilesMozilla Firefoxfirefox.exe -new-window http://www.pandora.com/?cmd=tunermini")

; Define partial title match mode

Opt("WinTitleMatchMode", 2)

;; Wait up to 5 minutes for the window to load the first song

WinWait ( "- Pandora -", "", 300 )

;; Get the handle of a Firefox window that contains "- Pandora -" in title

$PandoraWindow = WinGetHandle( "- Pandora -" )

$PandoraWindowTitle = WinGetTitle( $PandoraWindow )

If @error Then

    MsgBox(4096, "Error", "Could not find the correct window")

    Exit

Else

; Define the path to the tempory folder

    Global $tempdir1 = EnvGet( "temp" ) & "plugtmp"

    Global $tempdir2 = EnvGet( "temp" ) & "plugtmp-"

    Global $FolderNumber = 1

    Global $MaxFolderDepth = 100



; Check which plugtemp exists

    While Not FileExists ( $tempdir1 & "access" )

        If $FolderNumber > $MaxFolderDepth Then

            MsgBox ( 4112 , "Time out" , "The program couldn't find any temporary folder created by Pandora." & @CRLF & "To solve this problem, try to clean this folder :" & EnvGet( "temp" ))

            WinClose( $PandoraWindow )

            Exit

        ElseIf Not FileExists ( $tempdir2 & $FolderNumber & "access" ) Then

            $FolderNumber = $FolderNumber + 1

        EndIf

        $tempdir1 = $tempdir2 & $FolderNumber

    WEnd

    

; Used later

    Global $LastNumber = 1

    Global $FilePath = $tempdir1 & "access-"

    Global $PreviousFile = $tempdir1 & "access"

    Global $NextFile = $FilePath & $LastNumber

    Global $saveto = IniRead( @ScriptDir & "config.ini", "SaveTo", "dir", @UserProfileDir & "Desktop" )

    Global $PandoraWindowTitleTmp = ""

    Global $Delay = 2

    Global $ExtractSongInfo = 1

    Global $Mozilla = 7

    Global $Paused = 8

    Global $Pandora = 9

    Global $SleepTime = 250

    Global $ConnectionLost = 0

    

; Creates the close button 

    $CloseButton = GUICtrlCreateButton("X", 225, 0, 15, 15 )

    $Texte = GUICtrlCreateLabel("Pandora Rebuild is currently running ....", 15, 0)

    GUICtrlSetColor($Texte,0xff9900)

    GUICtrlSetOnEvent($CloseButton, "CloseButton")

    GUISetState(@SW_SHOW)



    If FileExists ( $saveto ) Then

    Else

        DirCreate ( $saveto )

    EndIf



    While $ExtractSongInfo



        $PandoraWindowTitleTmp = $PandoraWindowTitle

    

    ;; Wait for the next file to start caching and check if connection isn't lost

        $EndingTime = @MIN + $Delay

        While Not FileExists( $NextFile )

            Sleep( $SleepTime )

            $StartingTime = @MIN

            If $StartingTime > $EndingTime And ("Pandora -"=StringLeft( WinGetTitle( $PandoraWindow ), $Pandora ) Or "Mozilla"=StringLeft( WinGetTitle( $PandoraWindow), $Mozilla ) ) Then

                MsgBox( 64, "Information", "Connection lost, the program will stop!" )

                $ConnectionLost = 1

                Call( "CloseButton" )

            ElseIf "(Paused)"=StringLeft( WinGetTitle( $PandoraWindow ), $Paused ) Then

                Opt("WinTitleMatchMode", 3); Define total title match mode

                WinWait ( $PandoraWindowTitle, "", $Delay )

                $EndingTime = @MIN + $Delay

            EndIf

        WEnd

        

    ;; Name the finished song

        If "Pandora -"<>StringLeft( WinGetTitle( $PandoraWindow ), $Pandora ) Then

            $array = StringSplit( $PandoraWindowTitle, " - P",1 )

            $PandoraWindowTitle = $array[1]

            FileCopy( $PreviousFile, $saveto & $PandoraWindowTitle & ".mp3" )

        EndIf

            

    ;; Wait for the next file to start playing

        While $PandoraWindowTitleTmp = WinGetTitle( $PandoraWindow ) Or "(Paused)"=StringLeft( WinGetTitle( $PandoraWindow ), $Paused ) 

            Sleep( $SleepTime )

        WEnd

        

    ;; Set the variables up for next pass

        $PandoraWindowTitle = WinGetTitle( $PandoraWindow )

        $LastNumber = $LastNumber + 1

        $PreviousFile = $NextFile

        $NextFile = $FilePath & $LastNumber

    WEnd

EndIf



Func CloseButton()

; Name the current song if 

    If $ConnectionLost Then

        $PandoraWindowTitle = "~ConnectionLost~ " & $PandoraWindowTitle



        $array = StringSplit( $PandoraWindowTitle, " - P",1 )

        $PandoraWindowTitle = $array[1]

        FileCopy( $PreviousFile, $saveto & $PandoraWindowTitle & ".mp3" )

    EndIf

                    

    WinClose( $PandoraWindow )

    Exit

EndFunc



Exit

Link to comment
Share on other sites

A new update is available

Integrated more features from last.fm:

1) Displays song stats

2) Displays similar artist + links

3) Artist bio works fine now

misc:

1) UI beefed up, using AJAX calls now - bye iframes

2) Reolved security issue (checks host name / file extentsion / indexes of [../, ..])

http://www.tengbob.com/pandora-0.04.zip

http://www.hak5.org/forums/viewtopic.php?t=828

next release

1) last.fm song tagging

2) last.fm song journaling

3) save album art

preview.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...