public object Get(TagsByCategory request) { List <Tag> result = new List <Tag>(); using (TagsDBUser user = new TagsDBUser(request.Test)) { var readIf = GetReadInterface(user, request); foreach (var categoryForLanguage in readIf.GetAllCategories()) { String category = DataEncoding.UnescapeDataString(request.Category); if (categoryForLanguage.Name.Equals(category, StringComparison.Ordinal)) { foreach (var tagForLanguage in readIf.GetAllTags(categoryForLanguage.Id)) { var tag = new Tag { Name = tagForLanguage.Name, Category = request.Category }; SetResponseOptions(request, tag, user); result.Add(tag); } break; } } var response = CreateItemResponse <TagsByCategoryResponse, List <Tag> >(request, result, user); response.Category = DataEncoding.UnescapeDataString(request.Category); return(CreateHttpResponse(request, response)); } }
public object Get(Artists request) { List <Album> result = new List <Album>(); using (TagsDBUser user = new TagsDBUser(request.Test)) { foreach (Ares.Tags.Album album in user.TagsDB.BrowseInterface.GetAlbumsByArtist(DataEncoding.UnescapeDataString(request.Name))) { result.Add(CreateItemResponse <Album, Ares.Tags.Album>(request, album, user)); } var response = CreateItemResponse <ArtistsResponse, List <Album> >(request, result, user); response.Artist = DataEncoding.UnescapeDataString(request.Name); return(CreateHttpResponse(request, response)); } }
public object Get(FilesByTag request) { List <File> result = new List <File>(); using (TagsDBUser user = new TagsDBUser(request.Test)) { long tagId = GetReadInterface(user, request).FindTag(DataEncoding.UnescapeDataString(request.Category), DataEncoding.UnescapeDataString(request.Tag)); foreach (var file in user.TagsDB.ReadInterface.GetFilesForTag(tagId)) { result.Add(CreateItemResponse <File, Ares.Tags.FileIdentification>(request, file, user)); } var response = CreateItemResponse <FilesByTagResponse, List <File> >(request, result, user); response.Tag = DataEncoding.UnescapeDataString(request.Tag); return(CreateHttpResponse(request, response)); } }
public object Get(Albums request) { List <File> result = new List <File>(); using (TagsDBUser user = new TagsDBUser(request.Test)) { foreach (Ares.Tags.FileIdentification file in user.TagsDB.BrowseInterface.GetFilesByAlbum(DataEncoding.UnescapeDataString(request.Artist), DataEncoding.UnescapeDataString(request.Name))) { result.Add(CreateItemResponse <File, Ares.Tags.FileIdentification>(request, file, user)); } var response = CreateItemResponse <AlbumsResponse, List <File> >(request, result, user); response.Album = DataEncoding.UnescapeDataString(request.Name); response.Artist = DataEncoding.UnescapeDataString(request.Artist); return(CreateHttpResponse(request, response)); } }
public object Get(TagsByFile request) { List <Tag> result = new List <Tag>(); Int64 fileId = Int64.Parse(request.Id); using (TagsDBUser user = new TagsDBUser(request.Test)) { var readIf = GetReadInterface(user, request); foreach (var tagForLanguage in readIf.GetTagsForFile(fileId)) { var tag = new Tag { Name = tagForLanguage.Name, Category = tagForLanguage.Category }; SetResponseOptions(request, tag, user); result.Add(tag); } var response = CreateItemResponse <TagsByFileResponse, List <Tag> >(request, result, user); response.File = DataEncoding.UnescapeDataString(request.Name); return(CreateHttpResponse(request, response)); } }