Ejemplo n.º 1
0
		public static List<MediaSession.QueueItem> GetPlayingQueue(string mediaId,
			MusicProvider musicProvider) {

			// extract the browsing hierarchy from the media ID:
			var hierarchy = MediaIDHelper.GetHierarchy(mediaId);

			if (hierarchy.Length != 2) {
				LogHelper.Error(Tag, "Could not build a playing queue for this mediaId: ", mediaId);
				return null;
			}

			var categoryType = hierarchy[0];
			var categoryValue = hierarchy[1];
			LogHelper.Debug(Tag, "Creating playing queue for ", categoryType, ",  ", categoryValue);

			IEnumerable<MediaMetadata> tracks = null;
			// This sample only supports genre and by_search category types.
			if (categoryType == MediaIDHelper.MediaIdMusicsByGenre) {
				tracks = musicProvider.GetMusicsByGenre(categoryValue);
			} else if (categoryType == MediaIDHelper.MediaIdMusicsBySearch) {
				tracks = musicProvider.SearchMusic(categoryValue);
			}

			if (tracks == null) {
				LogHelper.Error(Tag, "Unrecognized category type: ", categoryType, " for mediaId ", mediaId);
				return null;
			}

			return ConvertToQueue(tracks, hierarchy[0], hierarchy[1]);
		}
Ejemplo n.º 2
0
        public static List <MediaSession.QueueItem> GetRandomQueue(MusicProvider musicProvider)
        {
            var genres = musicProvider.Genres;

            if (genres.Count <= 1)
            {
                return(new List <MediaSession.QueueItem> ());
            }
            var genre  = genres [1];
            var tracks = musicProvider.GetMusicsByGenre(genre);

            return(ConvertToQueue(tracks, MediaIDHelper.MediaIdMusicsByGenre, genre));
        }
        public static List <MediaSession.QueueItem> GetRandomQueue(MusicProvider musicProvider)
        {
            List <string> genres = musicProvider.Genres;

            if (genres.Count <= 1)
            {
                return(new List <MediaSession.QueueItem> ());
            }

            string genre = genres [1];
            IEnumerable <MediaMetadata> tracks = musicProvider.GetMusicsByGenre(genre);

            return(ConvertToQueue(tracks, MediaIDHelper.MediaIdMusicsByGenre, genre));
        }
Ejemplo n.º 4
0
        public static List <MediaSession.QueueItem> GetPlayingQueue(string mediaId,
                                                                    MusicProvider musicProvider)
        {
            // extract the browsing hierarchy from the media ID:
            var hierarchy = MediaIDHelper.GetHierarchy(mediaId);

            if (hierarchy.Length != 2)
            {
                LogHelper.Error(Tag, "Could not build a playing queue for this mediaId: ", mediaId);
                return(null);
            }

            var categoryType  = hierarchy[0];
            var categoryValue = hierarchy[1];

            LogHelper.Debug(Tag, "Creating playing queue for ", categoryType, ",  ", categoryValue);

            IEnumerable <MediaMetadata> tracks = null;

            // This sample only supports genre and by_search category types.
            if (categoryType == MediaIDHelper.MediaIdMusicsByGenre)
            {
                tracks = musicProvider.GetMusicsByGenre(categoryValue);
            }
            else if (categoryType == MediaIDHelper.MediaIdMusicsBySearch)
            {
                tracks = musicProvider.SearchMusic(categoryValue);
            }

            if (tracks == null)
            {
                LogHelper.Error(Tag, "Unrecognized category type: ", categoryType, " for mediaId ", mediaId);
                return(null);
            }

            return(ConvertToQueue(tracks, hierarchy[0], hierarchy[1]));
        }
Ejemplo n.º 5
0
		public static List<MediaSession.QueueItem> GetRandomQueue(MusicProvider musicProvider) {
			var genres = musicProvider.Genres;
			if (genres.Count <= 1)
				return new List<MediaSession.QueueItem> ();
			var genre = genres [1];
			var tracks = musicProvider.GetMusicsByGenre (genre);

			return ConvertToQueue (tracks, MediaIDHelper.MediaIdMusicsByGenre, genre);
		}