示例#1
0
        public async Task <Book> GetBook(string catalogId)
        {
            var urlId    = CatalogResolver.Resolve(catalogId).UrlId;
            var uri      = new Uri($"{MEK_ENDPOINT_URL}/{urlId}/index.xml");
            var response = await GetAsync(uri);

            var html = MekConvert.ToUtf8(await response.Content.ReadAsByteArrayAsync());

            return(MekFactory.CreateBookFromIndex(html));
        }
示例#2
0
        public async Task <IQueryable <Book> > FindAudioBook(string query = "")
        {
            var uri      = new Uri($"{MEK_ENDPOINT_URL}/katalog/kataluj.php3");
            var postData = $"szerint=cimsz&s1=dc_format+format_name&m1=MP3&muv1=and&s2=dc_creator_o+FamilyGivenName&m2={query}&muv2=or&s3=dc_title+subtitle&m3=&muv3=or&s4=dc_subject+keyword&m4=&muv4=or&s5=dc_subject+keyword&m5=&subid=&x=31&y=8&sind1=0&sind2=7&sind3=16&sind4=13&sind5=18&muv1index=0&muv2index=0&muv3index=0&muv4index=0&subid_check=&ekezet_check=&ekezet=ektelen";
            var content  = new FormUrlEncodedContent(MekConvert.ToKeyValuePair(postData));

            var response = await new HttpClient().PostAsync(uri, content);
            var html     = MekConvert.ToUtf8(await response.Content.ReadAsByteArrayAsync());
            var books    = MekFactory.CreateBookListFromResultPage(html);

            return(books);
        }
示例#3
0
        public async Task <AudioBook> GetAudioBook(string catalogId)
        {
            var urlId    = CatalogResolver.Resolve(catalogId).UrlId;
            var url      = $"{MEK_ENDPOINT_URL}/{urlId}/mp3/";
            var response = await GetAsync(new Uri(url));

            var html      = MekConvert.ToUtf8(await response.Content.ReadAsByteArrayAsync());
            var audioBook = await GetBook(catalogId);

            var trackBook = MekFactory.CreateAudioBookFromMP3Page(url, html);

            trackBook.Copy(audioBook);

            return(trackBook);
        }
示例#4
0
        public static async Task <IQueryable <Book> > SearchAsync(string query = "", string format = "")
        {
            var uri    = new Uri($"{Client.MEK_ENDPOINT_URL}/katalog/kataluj.php3");
            var filter = new List <KeyValuePair <string, string> >();

            filter.Add(data("szerint", "cimsz"));

            //TODO: Resolve field Indexes
            filter.AddRange(SearchFilter(0, "dc_format+format_name", format, "and", 1));
            filter.AddRange(SearchFilter(7, "dc_creator_o+FamilyGivenName", query, "or", 2));
            filter.AddRange(SearchFilter(16, "dc_title+subtitle", "", "or", 3));
            filter.AddRange(SearchFilter(13, "dc_subject+keyword", "", "or", 4));
            filter.AddRange(SearchFilter(18, "dc_subject+keyword", "", "", 5));

            filter.Add(data("ekezet", "ektelen"));

            filter.Add(data("x", "31"));
            filter.Add(data("y", "8"));

            //filter.Add(data("subid", ""));
            filter.Add(data("sind1", "0"));
            filter.Add(data("sind2", "7"));
            filter.Add(data("sind3", "16"));
            filter.Add(data("sind4", "13"));
            filter.Add(data("sind5", "18"));

            filter.Add(data("muv1index", "0"));
            filter.Add(data("muv2index", "0"));
            filter.Add(data("muv3index", "0"));
            filter.Add(data("muv4index", "0"));

            filter.Add(data("subid_check", ""));

            filter.Add(data("ekezet_check", ""));



            var content  = new FormUrlEncodedContent(filter);
            var response = await new HttpClient().PostAsync(uri, content);
            var html     = MekConvert.ToUtf8(await response.Content.ReadAsByteArrayAsync());

            return(MekFactory.CreateBookListFromResultPage(html));
        }