Esempio n. 1
0
        public int addAlbums(IWMPStringCollection collection, IWMPMediaCollection2 mediaCollection)
        {
            ArrayList items = new ArrayList();

            for (int k = 0; k < collection.count; k++)
            {
                string name = collection.Item(k);
                if (name != null && !name.Equals(""))
                {
                    Album item;
                    if (!stats_only)
                    {
                        item = new Album(name, mediaCollection.getByAlbum(name));
                    }
                    else
                    {
                        item = new Album(name, true);
                    }
                    if (!items.Contains(item))
                    {
                        items.Add(item);
                    }
                }
            }
            items.TrimToSize();
            if (!stats_only)
            {
                albums = items;
            }
            return(items.Count);
        }
Esempio n. 2
0
        static MediaLibrary()
        {
            Player = new WindowsMediaPlayer();

            Player.CurrentMediaItemAvailable += MediaLibrary.CurrMediaAvailable;

            Library = (IWMPMediaCollection2)Player.mediaCollection;
        }
Esempio n. 3
0
        public IEnumerable <IWMPMedia3> GetAudioTracks()
        {
            WindowsMediaPlayer player = new WindowsMediaPlayer();

            IWMPMediaCollection2 collection = (IWMPMediaCollection2)player.mediaCollection;
            IWMPPlaylist         playlist   = collection.getByAttribute("MediaType", "Audio");

            for (int i = 0; i < playlist.count; i++)
            {
                IWMPMedia3 media = (IWMPMedia3)playlist.get_Item(i);
                yield return(media);
            }
        }
Esempio n. 4
0
 private IWMPPlaylist getPlaylistFromExactQuery(string query_text, string query_type, IWMPMediaCollection2 collection)
 {
     if (query_type.Equals("Album"))
     {
         return collection.getByAlbum(query_text);
     }
     else if (query_type.Equals("Album Artist"))
     {
         return collection.getByAttribute("WM/AlbumArtist", query_text);
     }
     else if (query_type.Equals("Artist"))
     {
         return collection.getByAuthor(query_text);
     }
     else if (query_type.Equals("Genre"))
     {
         return collection.getByGenre(query_text);
     }
     else if (query_type.Equals("Song"))
     {
         return collection.getByName(query_text);
         //mediaPlaylist = collection.getByAttribute("Title", query_text);
     }
     return null;
 }