lad1337 / xem

codeigniter based web app to map epsiodes and shows across websites
19 stars 8 forks source link

Error when using API: trying to get property of non-object #12

Open tremby opened 9 years ago

tremby commented 9 years ago
$ curl "http://thexem.de/map/single?id=73141&origin=scene&season=11&episode=14&destination=tvdb"
<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">

<h4>A PHP Error was encountered</h4>

<p>Severity: Notice</p>
<p>Message:  Trying to get property of non-object</p>
<p>Filename: models/postman.php</p>
<p>Line Number: 282</p>

</div>{"result":"success","data":[],"message":"single mapping for 73141 on scene."}

Doesn't seem like such a success to me...

thezoggy commented 9 years ago

scene doesnt have ids, so its not valid. that is a valid tvdb id, so if your origin is that http://thexem.de/map/single?id=73141&origin=tvdb&season=11&episode=14&destination=scene it works

tremby commented 9 years ago
  1. I want to map from scene to TVDB, not the other way around. How do I do that? I've tried giving the show name as an ID; I get a similar error. The API docs say "You will need the id / identifier of the show e.g. tvdb-id for American Dad! is 73141", which I took to mean I should use the TVDB ID in all cases. Perhaps that could be clarified.
  2. If my request wasn't valid, why does it give a "success" response?
  3. When I try your suggested query which appears to ask for the scene numbering of TVDB season 11 episode 14 I get the response {"result":"success","data":{"scene":{"season":11,"episode":11,"absolute":186}},"message":"single mapping for 73141 on tvdb."}, which makes no sense. http://thexem.de/xem/show/2366 shows season 11 episode 14 doesn't even exist according to TVDB. Surely this query should return a failure.
thezoggy commented 9 years ago

1) tvdb->scene->tvdb. you map one way, store the info on how you map so you know how to reverse map. 2) because the params passed were valid, thus was a successful call. 3) your getting the absolute passthru # of scene.. so #186 is s11e11. - xem itself does not talk to scene/tvdb/tvrage/etc. it doesnt know whats 'valid' or not on any of these places.

bounds checking should be enforced by the app, as you are aware.. xem is crowd sourced info and while is moderated its hard to put in all data from each provider (nor do we want to.. its only should have mapped data).

anyways, this has been working the way it is for many years now in several apps.

tremby commented 9 years ago
  1. Okay. So given what I want to do here -- get the TVDB season and episode corresponding to a scene release (I know the TVDB ID) -- is the best thing I can do an all call for whe whole show, and loop through the results on my end?
  2. First you said my call wasn't valid, then you said it was valid. Either way, the response has error messages in it and obviously isn't valid JSON; surely you want to fix that?
thezoggy commented 9 years ago

2) the call wasnt valid. that id doesnt exist for scene (no id's exist for scene)