Esempio n. 1
0
 private getMetadataResponse ExtractSections(getMetadataRequest request)
 {
     var itemIndex = int.Parse(request.id.Split('/')[1]);
     var mediaList = new mediaList();
     var items = RetreiveArtists(itemIndex);
     mediaList.Items = items.Skip(request.index).Take(request.count).ToArray();
     var response = new getMetadataResponse(mediaList);
     response.getMetadataResult.total = items.Length;
     response.getMetadataResult.count = mediaList.Items.Length;
     response.getMetadataResult.index = request.index;
     return response;
 }
Esempio n. 2
0
 private getMetadataResponse ExtractTracks(getMetadataRequest request)
 {
     var itemIndex = request.id.Substring(4);
     var mediaList = new mediaList();
     var items = RetrieveTracks(itemIndex);
     mediaList.Items = items.Skip(request.index).Take(request.count).ToArray();
     var response = new getMetadataResponse(mediaList);
     response.getMetadataResult.total = items.Length;
     response.getMetadataResult.count = mediaList.Items.Length;
     response.getMetadataResult.index = request.index;
     return response;
 }
Esempio n. 3
0
        public getMetadataResponse GetMetadata(getMetadataRequest request)
        {
            if (request.id.Equals("root"))
            {
                var mediaList = new mediaList();
                var items = RetrieveMediaCollections();
                mediaList.Items = items.Skip(request.index).Take(request.count).ToArray();
                var response = new getMetadataResponse(mediaList);
                response.getMetadataResult.total = items.Length;
                response.getMetadataResult.count = mediaList.Items.Length;
                response.getMetadataResult.index = request.index;
                return response;
            }
            else
            {
                var itemType = request.id.Split('/')[0];

                switch (itemType)
                {
                    case "S":
                        return ExtractSections(request);
                    case "Art":
                        return ExtractAlbums(request);
                    case "Alb":
                        return ExtractTracks(request);
                }

                throw new NotImplementedException();
            }
        }