kevintuhumury / itvdb

An Objective-C wrapper around the TVDB (http://thetvdb.com) XML API for use in iOS (with ARC enabled) and OSX apps.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TVDbUpdater Question

opened this issue · comments

I am having difficulties understanding the TVDbUpdater mechanism.
In my Project, single shows (along with it's episodes) can be added to a database.
I display them in a tableview where i want to check for updates from time to time.

The read me says:
The first time you have a list of shows (or episodes), you should save the timestamp of that moment in your app.

If i save the timestamp every time a single show is added, wouldn't i constantly overwrite the timestamp?

Any help is welcome :)

That's kind of the point of:

[[TVDbUpdater sharedInstance] updateLastUpdatedAtTimestamp];

You'll have to call that once you've updated your data. To retrieve updates on your shows, you'll have to call (e.g.):

NSDictionary *showUpdates = [[TVDbUpdater sharedInstance] showUpdates];

That will only retrieve the updates since the last time you've saved the timestamp. So, if you save the timestamp every time you add a single show, you could also update all other shows at that time to be fully up to date.

If you don't want to do that however, because you like to add shows every minute (or even faster), you could save the timestamp only when you actually call an update method of some sorts. I would imagine that you have some kind of way to update your watch list (pull down or something like that). If so, set the timestamp after you've updated your data. Next time, it will retrieve all updates from that moment on and so forth. This would probably be my approach to updating a watch list.