fix (imdb): better toString

This commit is contained in:
Gergő Törcsvári 2016-03-26 17:47:35 +01:00
parent df05e84754
commit a49b1066d3
2 changed files with 28 additions and 4 deletions

View File

@ -43,11 +43,35 @@ namespace NadekoBot.Classes.IMDB
public Dictionary<string, string> Aka { get; set; }
public string ToString
public override string ToString()
{
return "`Title:` **" + EnglishTitle + " (" + OriginalTitle + ")" +
"**\n`Year:` " + Year +
"**\n`Rating:` " + Rating +
"**\n`Genre:` " + GenresAsString +
"\n`Link:` " + ImdbURL +
"\n`Plot:` " + Plot.Substring(0, Plot.Length > 500 ? 500 : Plot.Length) + "..."
//"\n`img:` " + Poster //imdb url do it for us I think its a discord auto thing
;
}
public string EnglishTitle
{
get
{
return ImdbURL + "\n" + OriginalTitle + " (" + Year + ") - " + Rating;
return Aka.ContainsKey("USA") ? Aka["USA"] :
(Aka.ContainsKey("UK") ? Aka["UK"] :
(Aka.ContainsKey("(original title)") ? Aka["(original title)"] :
(Aka.ContainsKey("(original)") ? Aka["(original)"] : OriginalTitle)));
}
}
public string GenresAsString
{
get
{
string ret = "";
Genres.ForEach(g => ret = ret + " " + g);
return ret;
}
}
}

View File

@ -96,8 +96,8 @@ $@"🌍 **Weather for** 【{obj["target"]}】
string result;
try
{
var movie = ImdbScraper.ImdbScrape(e.GetArg("query"), false);
if (movie.status) result = movie.ToString;
var movie = ImdbScraper.ImdbScrape(e.GetArg("query"), true);
if (movie.status) result = movie.ToString();
else result = "Failed to find that movie.";
}
catch