Jump to content

cortechs

Active Members
  • Posts

    10
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

cortechs's Achievements

Newbie

Newbie (1/14)

  1. Alright!! All my problems but the favicon "warning" seem to be fixed in this beta. Great job :D
  2. Man good job! I got a problem thou with both of your betas; when I run your aps, it always saves the first song while only 580kB were cached. Are you sure you're waiting for the next song to start caching before saving/renaming the song? or is it a function tied to a timer? Might also be due to my crappy slow connection!! :oops: I also have this wierd error: INFO Thread-2 server.Server - processing url: GET /favicon.ico HTTP/1.1 INFO Thread-2 servlet.ProcessAction - processing static request. path: GET /favicon.ico HTTP/1.1 INFO Thread-2 servlet.ProcessAction - path = favicon.ico INFO Thread-2 servlet.ProcessAction - documentType = ICO INFO Thread-2 server.Server - No enum const class enums.FileType.ICO It's apparently looking for a favicon that is not included with the code. And finally, the program gets lost (desynchronized) if you fastforward songs and don't have the next cached. I try to explain: if I fastforward like say 2 songs in a row, i just had the next song(the 3rd one i'm listening to) starting to cache, the program sees that I have skeeped the tracks because the artist + title are right but it uses the wrong "access-x" file to save/rename. The result is an MP3 with the right name but actually the wrong song in it and of small size ( a couple of KB). Again, I think that might have something to do with the way you check if a file is done downloading before saving/renaming it. ****Update: it appears that the program catches up with the desynchro after a couple of songs (might be when the new xml arrives from pandora.com) Anyway, keep up the great work.
  3. 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
  4. 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
  5. 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
  6. 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.
  7. Sorry if I offended you :( , but I think that people who have subscribed to the $ 12 for 3 months or the $36 for 12 months and wants to enjoy their favorite playlists on the go and DO buy later on the songs they've eared have the right to know how to do it or maybe just see how it's done. What bothers me the most with closed source is when the programer decides suddenly to stop supporting his program. People get stuck with no alternatives. :? Also, it happens that the programmer release all its code at once when feelling like quiting and... that... is also a big problem for the people who want to keep the project alive as they don't have any input from the original creator or the code is badly commented. My last griefs with closed source are : - Bad timing to release a fix; because the programer doesn't feel like it the day the problem araise or just doesn't have time right away (we all have a life). - And only one "team" develops it wich doesn't help improving the code itself; other people often times have other more efficient ways to code a the same function. Other than that i just love open source as it's very educative to any programer to see how things are done. :P
  8. My problem with 3tunes is that it's closed source and TomB says on is website that he doesn't know if he's gonna open the source someday. It looks to me that he wants to make some profits if it's successfull... Furthermore, it doesn't work with my "temp" directory settings.:( or maybe i'm just paranoïd... :?
  9. Hello guys, Here is what i have done with Jeng's program: I rewrote and changed places of part of the original code so it can now open a new firefox window and launch pandora.com when the script starts. It then waits 30 seconds in order for the first song to start loading. The script then looks for the first song to be finised downloading and finally name it. I haven't tested it with multiple stations(playlist) thou. Note: You can turn off the debug mode if you don't want to see the code when you put your mouse over the tray icon while it's running. If you wnat to compile the script to self contained exe, you can download Aut2Exe from AutoIt website there: http://www.autoitscript.com/autoit3/downloads.php Hope this helps. Anyway, here it is: ; ---------------------------------------------------------------------------- ; ; AutoIt Version: 3.1.0 ; Author: Jang ; ; 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/") ;; Wait for the window to load the first song WinWait ( "by", "", 30 ) ; Define get partial title match and Wait for downloading AutoItSetOption("WinTitleMatchMode", 2) ;; Get the handle of a Firefox window that contains "by" in title $handle = WinGetHandle("by") If @error Then MsgBox(4096, "Error", "Could not find the correct window") Else ; Define Bogus Tile Global $title = "nothing" ; Define the path to the tempory folder $tempdir1 = EnvGet("temp") & "plugtmp" $tempdir2 = EnvGet("temp") & "plugtmp-" $increment = 1 ; Check which plugtemp exists ; Change by CygnusTM While Not FileExists ($tempdir1 & "access") While Not FileExists ($tempdir2 & $increment & "access") ; End change $increment = $increment + 1 WEnd $tempdir1 = $tempdir2 & $increment WEnd ; Used later Global $number = 1 Global $notspecified = $tempdir1 & "access-" Global $previous = $tempdir1 & "access" Global $next = $notspecified & $number Global $saveto = IniRead(@ScriptDir & "config.ini", "SaveTo", "dir", @UserProfileDir & "Desktop") If FileExists ($saveto) Then Else DirCreate ($saveto) EndIf $mainprogram = 1 While $mainprogram = 1 ;MsgBox(0, "caixa", "whilestop") $next = $notspecified & $number ;; This loop checks if the next cached song is started. If so, the current song is ready to be saved $lookup = 1 While $lookup=1 ;; Wait 10 secs before checking if the next song starts to be cached. To save CPU usage Sleep(10000) If FileExists($next) Then $lookup = 0 EndIf WEnd ;; Check if the song is paused While "(Paused)"=StringLeft(WinGetTitle($handle), 8) Sleep(500) WEnd ;MsgBox(0, "caixa", "whilenot") ;Get the window Title $title=WinGetTitle($handle) ;Isolate the music Title from the rest $array = StringSplit($title, " - P",1) $titlefinal = $array[1] FileCopy($previous, $saveto & $titlefinal & ".mp3") $Previous = $next $number = $number + 1 WEnd EndIf By the way, don't forget to put the config.ini file in the same folder as your executable. Your config.ini file should contain the path to your saved music directory: Don't forget to include "" at the end [SaveTo] dir=C:My music
  10. Hi, Your script works great but I had to change a thing so it could work with my "Temp" folder as i changed it during install. So you might consider changing this: to: $tempdir1 = EnvGet("temp") & "plugtmp" $tempdir2 = EnvGet("temp") & "plugtmp-" The "EnvGet("temp")" declaration is just going to read the path directly from Windows. Just my 2 cents to your script. I also noticed a problem: if you run the program after you've been listening to Pandora.com for a while, the script won't catch up with the already "in the plugtmp directory" songs. So what is happening is the script only generate a single song named pandora with no IDtags and doesn't creates the following currently playing song. I'm not talking about trying to IDTag the old songs in the plugtmp directory but to generate the IDTags for the new songs. Don't know if I make myself clear??? :( Anyway, thanks for your program.
×
×
  • Create New...