Fetch the current track info from Spotify app after March 2015 update

坚强是说给别人听的谎言 提交于 2019-12-07 16:05:41

问题


I want to pull out the current track information from Spotify windows client using autohotkey.

Although this question Hotkey for next song in Spotify solved some of the problems (the media playback issues) in the commonly used ahk script (can be found in this question: Newest Spotify update: Autohotkeys script broke and below), the track info shortcut still does not work.

^Down:: 
{ 
DetectHiddenWindows, On 
SetTitleMatchMode 2 
WinGetTitle, now_playing, ahk_class SpotifyMainWindow 
;StringTrimLeft, playing, now_playing, 10 
DetectHiddenWindows, Off 
clipboard = %playing%`r`n
return 
}

This will give me "Spotify free" no matter what song I am playing.

The main problem is that the tray icon and the task bar icon stopped showing the currently played song information after this update. Only text Windows spy can find from the task bar icon is now "Spotify Free".

So, I tried to get all controllist and extract texts in each of them by following the example in this question: How to obtain textual contents from a window

But, I could only find two controls ("Chrome_WidgetWin_01" and "Chrome_RenderWidgetHostHWND1") and Window spy can find text "Chrome Legacy Window" and this is all it finds.

Is there a way to dig into this further? I noticed in the Windows Task Manager there are 3 spotify.exe instances. Would looking into other processes help?

PS AHK Window Info 1.7 (http://www.autohotkey.com/board/topic/8204-ahk-window-info-17/) is not available for download at moment. so i could only use Ahk Window Spy 1.3.3 by Decarlo.

Oh, I found the code for AHK Window Info pasted as spoiler at http://www.autohotkey.com/board/topic/8204-ahk-window-info-17/page-6 But it did not help. information found was not more than Ahk Window Spy.

(edit) UISpy from microsoft gives me a bit more info but it's not possible to get texts in Spotify client. And, I realized that it's a good thing in terms of security (otherwise malware can read my email password etc). So, unless Spotify client wants to expose this information, it would be hard or not possible to do this by ahk. Is this correct or any cleaver way around in this particular case?


回答1:


EDIT: This solution is no longer needed. The song artist and title have been added back to the Window Title.

The best solution is to downgrade Spotify to a 0.9 version from FileHorse. Then do the following:

  1. Go to C:\Users\YOURUSERNAME\Appdata\Roaming\Spotify
  2. Make a new empy text file
  3. Name it Spotify_new.exe
  4. Right click the file and make the file read-only
  5. Copy this file and name the new one Spotify_new.exe.sig
  6. Spotify needs to delete these files to do an automatic upgrade. The read-only flag on both of these files will prevent upgrading from happening.

I haven't had any issues running an old version at this point in time.



来源:https://stackoverflow.com/questions/29821881/fetch-the-current-track-info-from-spotify-app-after-march-2015-update

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!