Jump to content

Pandora.com Keyboard


DicatoroftheUSA
 Share

Recommended Posts

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Version=Beta
#AutoIt3Wrapper_Outfile=..\..\..\..\Desktop\Pandora.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#region includes
#Include <FF.au3>;http://www.autoitscript.com/forum/topic/95595-ffau3-v0600b/
#include<hotkey.au3>;http://www.autoitscript.com/forum/topic/90492-hotkey-udf/
#include<string.au3>
#endregion includes
#region Options
AutoItSetOption("trayicondebug", True)
#endregion Options
#region Globals
;Below are physical keyboard key values.
Global Const $gc0x_VolumeMute = 0x00AD
Global Const $gc0x_StopMedia = 0x00B2
Global Const $gc0x_PreviousTrack = 0x00B1
Global Const $gc0x_NextTrack = 0x00B0
Global Const $gc0x_Play = 0x00B3
Global Const $gc0x_Media = 0x00B5
#endregion Globals
#region hotkeys
_HotKey_Assign($gc0x_StopMedia, '_StopMedia')
_HotKey_Assign($gc0x_VolumeMute, '_VolumeMute')
_HotKey_Assign($gc0x_PreviousTrack, '_PreviousTrack')
_HotKey_Assign($gc0x_NextTrack, '_NextTrack')
_HotKey_Assign($gc0x_Play, '_Play')
_HotKey_Assign($gc0x_Media, '_Media')
#endregion hotkeys


_pandorasend()
_main()

Func _PandoraStart(ByRef $chFF, $reSend = "")
_FFConnect()
If @error Then _FFStart("http://www.pandora.com/station/play", "default")
;~ Sleep(2000)
$chFF = _FFWindowSelect("station/play", 'href', False)
If $chFF = 0 Then
_FFWindowOpen("http://www.pandora.com/station/play", False, True)
$chFF = _FFWindowSelect("Pandora One")
EndIf
If $reSend <> "" Then _pandorasend($reSend)


EndFunc ;==>_PandoraStart



Func _main()
While 1
Sleep(10)
WEnd
EndFunc ;==>_main

Func _VolumeMute()
ConsoleWrite('stop' & @LF)
_pandorasend("tiredOfSong")
EndFunc

Func _StopMedia()
ConsoleWrite('stop' & @LF)
_pandorasend("thumbDownButton")

EndFunc ;==>_StopMedia


Func _PreviousTrack()
ConsoleWrite('previous' & @LF)
_pandorasend("thumbUpButton")

EndFunc ;==>_PreviousTrack

Func _NextTrack()
ConsoleWrite('next' & @LF)
_pandorasend("skipButton")
EndFunc ;==>_NextTrack

Func _Play()
ConsoleWrite('playButton' & @LF)
_pandorasend('playButton')
EndFunc ;==>_Play

Func _media()
_pandorasend('pauseButton')
EndFunc ;==>_media


Func _pandorasend($sSend = "")
Static Local $chFF = 0
If $chFF = 0 Then _PandoraStart($chFF)
If $sSend = "" Then
_PandoraStart($chFF)
Return
EndIf
$hBackupTab = _FFTabGetSelected()
If Not _FFIsConnected() Then
_PandoraStart($chFF, $sSend)
EndIf
If Not _FFTabExists("Pandora One") Then
_PandoraStart($chFF, $sSend)
EndIf
_FFTabSetSelected(@extended)
$sMode = "Class"
$iIndex = 0
$bLoadWait = True
_FFClick($sSend, $sMode, $iIndex, $bLoadWait)
If @error Then
;~ TrayTip("Error", @error, 1)
_PandoraStart($chFF, $sSend)

Else
;~ $sLabel = _FFGetValue($sSend, $sMode)


$sLabel = $sSend & @CRLF
$sLabel &= _getdetails('songTitle') & @CRLF
$sLabel &= _getdetails('playerBarAlbum') & @CRLF
$sLabel &= _getdetails('playerBarArtist')

TrayTip("", $sLabel, 1)
EndIf

_FFTabSetSelected($hBackupTab)


EndFunc ;==>_pandorasend

Func _getdetails($sClass)
$str_obj_ff = _FFObjGet($sClass, 'class')
$str_obj_ff = _ffobj($str_obj_ff, 'textContent')
Return $str_obj_ff
EndFunc ;==>_getdetails

Assigns pandora to the keyboard's media keys, it requires and I use ff version "0.6.0.1b-8"

Edited by DicatoroftheUSA
Link to comment
Share on other sites

  • 2 weeks later...
  • 3 months later...
  • 4 months later...

Hi,

your code looks very good, but i'll get following error:

"_FF Windows GetHandle General Error"

and i didn't get any information about the actual title, artist ...

Mayby you'll have a look?

Thanks

Dizzy

(And: Is it possible to extend your script to save the album picture?)

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