request: add "aired" (boolean) field to an Episode

or_dvir wrote 7 years ago: 1

hi

right now in order to determine whether an episode has been aired, this is what im doing: if airStamp is available then all is good because it's a simple comparison between that value and the current time. however if it is not available, im comparing airDate value to current date, and if airTime is also available, i also compare that to be more accurate.

however when it comes to coding (java for android), this requires me to instantiate several objects and make multiple conversions from String to int - both of these are considered expensive operations. in addition im displaying all episodes of a specific season inside a list and in android (using RecyclerView if you're familiar), the function for displaying each episode (and therefore perform the above instantiations, calculations, and conversions) is called multiple times. this happens not just for each episode in the list, but multiple times per episode.

if you ask me, this is a waste of runtime and it would be a lot more efficient if i just had a field which says whether this episode has already been aired or not. will it be possible to add such a field?


david wrote 7 years ago: 1

Airstamp should always be available. Where are you seeing episodes without it?

or_dvir wrote 7 years ago: 1

david wrote:
Airstamp should always be available. Where are you seeing episodes without it?

i did not see it specifically, i am trying to be a good programmer and cover all cases :). is airStamp guaranteed to be in every episode and be non null/empty? if so, what would be the value for episodes where this information is unknown? also, if this is guaranteed, why are there airDate and airTime (which could definitely be empty)?


gazza911 wrote 7 years ago: 1

Airdate and airtime is in the show's timezone.

Airstamp is the UTC date.

For example, Lucifer airs at 9pm EST, which is 5 hours behind UTC.

Therefore the UTC date is 2am the following day, as can be seen here.


gazza911 wrote 7 years ago: 1

And to answer your other question, it will be an empty string for airdate when the date is unknown and null for airstamp, as can be seen here.

If the airtime is not known, but the airdate is, the airstamp will just be noon on the airdate.

or_dvir wrote 7 years ago: 1

Thank you for your answers.

But what about adding an "aired" field?

deleted wrote 7 years ago: 1

or_dvir wrote:
hi

right now in order to determine whether an episode has been aired, this is what im doing: if airStamp is available then all is good because it's a simple comparison between that value and the current time. however if it is not available, im comparing airDate value to current date, and if airTime is also available, i also compare that to be more accurate.

however when it comes to coding (java for android), this requires me to instantiate several objects and make multiple conversions from String to int - both of these are considered expensive operations. in addition im displaying all episodes of a specific season inside a list and in android (using RecyclerView if you're familiar), the function for displaying each episode (and therefore perform the above instantiations, calculations, and conversions) is called multiple times. this happens not just for each episode in the list, but multiple times per episode.

if you ask me, this is a waste of runtime and it would be a lot more efficient if i just had a field which says whether this episode has already been aired or not. will it be possible to add such a field?

You could also move this code into a background service in Android and run it using jobscheduler/syncadapter at night. The data on tv maze doesn't update that often and it's safe to cache data for at least an hour from TV maze. I have it set to 12 hours in Episode Guide.

Once you have made the calculation move the data into a database using SQLLite, Room or Realm etc It will rarely change in the future and you will only need to calculate new episodes etc.


david wrote 7 years ago: 1

Yeah, if airdate is available for an episode, airstamp will be available as well. Comparing your local time against airstamp is much better than adding an aired property on our end, because caching means such a property would frequently be stale.

Try 30 days of free premium.