Uniquely identify albums and songs in Windows Phone media library - windows-phone-7

I am importing a songs collection from an Album object that is obtained from querying MediaLibrary on Windows Phone Mango.
Is there a unique identifier provided by the platform, by which I could be identifying different songs and albums?
I need something that will remain the same for the same albums if I re-query the MediaLibrary next time my app is ran.
I have seen a "handle" property in the debugger, but it doesn't appear in any of the Album class documentation.

I'd try GetHashCode() for Song and Album. At least Song overrides this function directly, so hopefully it is computed from the song's properties.

Related

Programmatically retrieving the current playing song, album and artist from Spotify

With Spotify's most recent update, the old method to retrieving the current playing song, album and artist is not usable anymore. The old method looked at all open window titles until it finds one with "Spotify - SONG...", and then it removed "Spotify - " resulting in "SONG...".
The newest Spotify only has "Spotify Premium" in its title, and my old method is doomed...
That's why I'm looking for an alternative method, but so far, I haven't been able to find an alternative.
Someone told me to look inside the "C:\Users\NAME\AppData\Roaming" folder and look for Spotify's stream output from one of the files in there. I couldn't find anything close to resembling a "stream output" however...

Pause/resume the current playing song in Windows Phone

I want to write a method in a Windows Phone Application to pause the current playing song and to resume the song if it has paused.
Like a play/pause button.
What is the simplest way to achieve this?
If you want to get it done with the help of the songs stored in the media library the n its easy with the help of MedaPlayer
Use this namespace
using Microsoft.Xna.Framework.Media;
To get all the songs in the media library
MediaLibrary mLibrary = new MediaLibrary();
SongCollection songs= mLibrary.Songs;
To play a specific song
MediaPlayer.Play(songs, int index);
To Pause the mediaplayer
MediaPlayer.Pause();
To continue playing the song
MediaPlayer.Play(songs);
A simple demo as well.

WP7 how to rate a Song

I see that the Song class only contains IsRated and Rating property with Set method.
However, I see that the default music player application in WP7 has the ability to rate a song
So, how can I rate a Song ?
Both Rating and IsRated are only get methods.
This means you can get the value of the rating but you can't set it.
That can only be done by the default media player
For Rating
http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.media.song.rating.aspx
For IsRated
http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.media.song.israted.aspx
As you can see both only have get methods

dice games in the mac app store?

I have a mac app. Logically, it could be considered a dice game. One of the listed categories for my LSApplicationCategoryType key is public.app-category.dice-games. But when I go to the store and look at the list of categories, I don't see one for dice games.
So if I use public.app-category.dice-games for the key, what can I expect to happen with my app in the store?
As best I can determine, there is a category type for Dice games.
I would suggest starting with:
http://developer.apple.com/support/resources/itunes-connect.html
and reading through
http://itunesconnect.apple.com/docs/iTunesConnect_DeveloperGuide.pdf
If you search for LSApplicationCategoryType in this PDF, there is only one result.
It will take you to some information which says that you will need to select the primary and secondary categories for your app. The primary category would be Games and Dice is a valid selection for the secondary category.
What you will also see is the following:
The list of categories you can choose
to define in your info.plist is the
same as what is available for Mac OS X
apps in iTunes Connect.
To find this information, I went to the Mac Dev Center and clicked on the Submitting to the Mac App Store link. In there I found public.app-category.dice-games
It would seem that you can specify that yours is a dice game at every point you need to.
Oh, what the hell.
Dice games are, to me, a subset of the casino games category (usually - it might also be a kids' game, or you could make an educational game that uses dice to teach addition to children). So, if it's a supported category, Apple might just shove it into a broader category like casino games or whatever the app seems to be for. If in doubt, though, you really ought to contact Apple about it (whether or not you can do that, I don't know). Since the Mac App Store doesn't actually show it as a category, it might be a deprecated value, too.
At any rate, I can't give you a concrete answer, since I'm not Apple.

Getting a unique ID for a window of another application

I'm a newbie Cocoa developer and I'm developing my first application. I want to read a unique identifier from any window of any application - whether it's Cocoa or Carbon. Cocoa applications make their window IDs available to AppleScript (although I'm sure there's a much better way to do this through a proper Objective C route), but I'm trying to access window IDs from documents in the Adobe apps. This seems to be a lot trickier. All I can seem to find in the reference libraries is HIWindowGetCGWindowID:
"This function returns the window ID assigned by the window server when a window is created. The window ID is not generally useful with any other Carbon function, but may be used with other Mac OS X functions that require a window ID, such as functions in OpenGL."
Can this be used to get the ID from my program? Or is it just a function that can be used within one application?
If someone could point me in the right direction, I'd be eternally grateful.
The function HIWindowGetCGWindowID() can only return a CGWindowID for one of your app's windows, since a WindowRef from another program won't be valid in yours.
The function CGWindowListCopyWindowInfo() from CGWindow.h will return an array of dictionaries, one for each window that matches the criteria you set, including ones in other applications. It only lets you filter by windows above a given window, windows below a given window and "onscreen" windows, but the dictionary returned includes a process ID for the owning app which you can use to match up window to app. In each returned dictionary the kCGWindowNumber key will point to the window ID as a CFNumber. There is also a CGWindowListCreate() function that only returns an array of CGWindowIDs. There is basically no documentation for these functions beyond the CGWindow.h header and the Son of Grab sample code. Also, it's 10.5 only.

Resources