Werbung: SecurityConsole.de verwaltet Ihre Computer mit Security Essentails aus der Cloud!
30 Tage kostenfrei testen und 20% Rabatt für Ihre Bestellung mit Promocode: WBF2685582
(Promocode gültig bis 31.12.2011)

Group:  English: Entertainment » microsoft.public.windowsmedia.sdk
Thread: query wmp11 library for year

HTVi
TV Discussion Newsgroups

query wmp11 library for year
stephan hattinger 4/21/2007 12:32:00 AM
hello!

im writing an addon for vista media center and id like to do a query for
year (the one from the id3 tag..).

im querying the library like this (C#):

using WMPLib;
player = new WindowsMediaPlayer();
library = (IWMPMediaCollection2)player.mediaCollection;
IWMPQuery query = library.createQuery();

String attr, op;
query.addCondition(attr, op, "2007");

IWMPStringCollection wmpstr =
library.getStringCollectionByQuery("WM/AlbumTitle", query, "audio", "",
false);

here, i always get a COMException.

"WM/Year" as attr doesnt work (as said in
http://msdn2.microsoft.com/en-us/library/aa393560.aspx) with neither "Equals"
nor "GreatherThan" as op.

ive tried "ReleaseDateYear", "ReleaseDate" and some others with varying
operators, without success.

so, am i missing something here? maybe i should create an
AxWindowsMediaPlayer to get the collection from?

thanks for any help..

stephan hattinger

Re: query wmp11 library for year
"Alessandro Angeli" <nobody[ at ]nowhere.in.the.net> 4/21/2007 1:15:48 AM
From: "stephan hattinger"

[Quoted Text]
> here, i always get a COMException.

What COMException? You should have got an HRESULT.

> "WM/Year" as attr doesnt work (as said in
> http://msdn2.microsoft.com/en-us/library/aa393560.aspx)
> with neither "Equals" nor "GreatherThan" as op.

If the following is your actual code:

> String attr, op;
> query.addCondition(attr, op, "2007");

then you never set the values of attr and op before creating
the query.

--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm


Re: query wmp11 library for year
stephan hattinger 4/21/2007 12:00:01 PM
thank you for the quick response.

the basic querying really works, no excpetions and correct results if i
query for "WM/AlbumArtist", "WM/Genre", "WM/AlbumTitle" and others. but
querying for any date/year information, i get the exceptions. the only thing
that differs here from the working part is the actual query added with
IWMPQuery.addCondition.

i put the the two strings there just so i could reference them in the
following post, was a bit more confusing than it helped i guess :)

i tried to reproduce some of the exceptions, heres the results:

query.addCondition("WM/Year", "Equals", "2006"); -> ArgumentException
query.addCondition("WM/Year", "GreaterThan", "2006"); -> ArgumentException
query.addCondition("ReleaseDateYear", "Equals", "2006"); -> E_FAIL
query.addCondition("ReleaseDateYear", "GreaterThan", "2006"); -> 0xC00D32D0
(i guess the operator is wrong here)
query.addCondition("ReleaseDateYear", "EndsWith", "2006");->ArgumentException
query.addCondition("ReleaseDate", "GreaterThan", "2006/01/01");-> 0xC00D32D0
query.addCondition("ReleaseDate", "EndsWith", "2006");->ArgumentException
query.addCondition("ReleaseDate", "GreaterThan", "01.01.2006"); -> 0xC00D32D0

also, i noticed that the only date/year related thing i can use in automatic
playlists in wmp 11 is "Release Year" with quite strange, but working,
options ("is after 2000/1990/1980/etc." or "is after yeaterday/last 7
days/last 30 days/6 months/1 jear/ etc.", but no "equals" with inputtable
year)

i get the impression that microsoft somehow forgot to add this functionality
to the queries. in the docs for "WM/Year"
(http://msdn2.microsoft.com/en-us/library/aa393560.aspx) it is stated that
"WM/Year" shouldnt be queried against because it is a derived attribute, but
they give no hint whatsoever as to what should be used instead...

on the other hand i read somewhere on msdn that attributes available in the
mediacollection property of WindowsMediaPlayer will always be a subset of
those in AxWindowsMediaPlayer. maybe this propagates to the set of queryable
properties?
i have tried this too, some days ago, with no success, but i have given this
no all to thorough investigation.

"Alessandro Angeli" wrote:

[Quoted Text]
> From: "stephan hattinger"
>
> > here, i always get a COMException.
>
> What COMException? You should have got an HRESULT.
>
> > "WM/Year" as attr doesnt work (as said in
> > http://msdn2.microsoft.com/en-us/library/aa393560.aspx)
> > with neither "Equals" nor "GreatherThan" as op.
>
> If the following is your actual code:
>
> > String attr, op;
> > query.addCondition(attr, op, "2007");
>
> then you never set the values of attr and op before creating
> the query.
>
> --
> // Alessandro Angeli
> // MVP :: DirectShow / MediaFoundation
> // mvpnews at riseoftheants dot com
> // http://www.riseoftheants.com/mmx/faq.htm
>
>
>
Re: query wmp11 library for year
stephan.hattinger[ at ]gmail.com 4/29/2007 8:48:01 PM
just wanted to give an update on the subject..

i still havent found a way to directly do it by queries, now i instead
just get the media sorted (getplaylistbyquery()) by
"ReleaseDateYear" (this works..) and then do some sort of "ranged"
binary search ("ranged" because what i want to find is an interval not
a single item).

hope this helps someone sometimes :)

regards,

stephan hattinger

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net
Suche nach Orten, Städten, Postleitzahlen, Vorwahlen, Kfz-Kennzeichen