.roles updated string, missed af ile

This commit is contained in:
Kwoth
2016-10-15 23:14:28 +02:00
parent 17f76da220
commit 799b6cfae2
3 changed files with 50 additions and 4 deletions

View File

@@ -0,0 +1,46 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace NadekoBot.Modules.Searches.Commands.OMDB
{
public static class OmdbProvider
{
private const string queryUrl = "http://www.omdbapi.com/?t={0}&y=&plot=full&r=json";
public static async Task<OmdbMovie> FindMovie(string name)
{
using (var http = new HttpClient())
{
var res = await http.GetStringAsync(String.Format(queryUrl,name.Trim().Replace(' ','+'))).ConfigureAwait(false);
var movie = JsonConvert.DeserializeObject<OmdbMovie>(res);
movie.Poster = await NadekoBot.Google.ShortenUrl(movie.Poster);
return movie;
}
}
}
public class OmdbMovie
{
public string Title { get; set; }
public string Year { get; set; }
public string ImdbRating { get; set; }
public string ImdbId { get; set; }
public string Genre { get; set; }
public string Plot { get; set; }
public string Poster { get; set; }
public override string ToString() =>
$@"`Title:` {Title}
`Year:` {Year}
`Rating:` {ImdbRating}
`Genre:` {Genre}
`Link:` http://www.imdb.com/title/{ImdbId}/
`Plot:` {Plot}";
}
}