Altered Find method for FreebaseIds

Following up on issue #34, I've altered the Freebase searching so that
it now works. At the TMDb forums, a fix was pushed which allowed working
with Freebase-Id's.

http://www.themoviedb.org/talk/526963d5760ee3490201c360?page=4
This commit is contained in:
Michael Bisbjerg 2014-04-18 21:10:00 +02:00
parent 89bc439ce3
commit 0978bd7e1f
2 changed files with 8 additions and 3 deletions

View File

@ -20,7 +20,12 @@ namespace TMDbLib.Client
public FindContainer Find(FindExternalSource source, string id)
{
RestRequest req = new RestRequest("find/{id}");
req.AddUrlSegment("id", HttpUtility.UrlEncode(id));
if (source == FindExternalSource.FreeBaseId || source == FindExternalSource.FreeBaseMid)
// No url encoding for freebase Id's (they include /-slashes)
req.AddUrlSegment("id", id);
else
req.AddUrlSegment("id", HttpUtility.UrlEncode(id));
req.AddParameter("external_source", source.GetDescription());

View File

@ -13,8 +13,8 @@ namespace TMDbLibTests
private const string tvdbBreakingBadId = "81189";
private const string imdbBreakingBadId = "tt0903747";
private const string tvRageBreakingBadId = "18164";
private const string freebaseBreakingBadId = "/en/breaking_bad";
private const string freebaseMidBreakingBadId = "/m/03d34x8";
private const string freebaseBreakingBadId = "en/breaking_bad";
private const string freebaseMidBreakingBadId = "m/03d34x8";
[TestInitialize]
public void Initiator()