I'm not sure if I'm the only one, but I've noticed a problem with the
tv_grab_zz_sdjson
grabbers from the XMLTV project. I personally much prefer Schedule Direct's JSON service API over their older DataDirect API (@tv_grab_na_dd@), as the newer JSON API provides better descriptions and season/episode information.
However, I noticed a problem with the grabbers when I set the "Broadcast type" of my Autorecs to "New/premiere": Tvheadend was not scheduling these airings to record because they had a
previously-shown
element in the XMLTV file. (I'm UTC-0700, so for prime time shows, this often put a show's
previously-shown
date into yesterday, as XMLTV usually has its date/time set for UTC.) Even after modifying the grabber script to output the
previously-shown
element in my locale, Tvheadend still wouldn't mark some shows for recording even if the
new
element was present.
Therefore, I tweaked the grabber script so that if a scheduled program has
{"new": true}
in the schedule response, then the generation of the
previously-shown
element is completely suppressed. (It also seems to make more sense semantically, too, that if this is indeed "new" and has not been aired before, then it doesn't make sense for there to be a "previously shown" date. In the Schedules Direct JSON API this is acceptable, because Schedules Direct reports this as
{"originalAirDate": "YYY-MM-DD"}@, but it's attached to the program response: meaning it relates to a program, not a particular airing of the program.
I also recently switched from using @tv_grab_zz_sdjson
to
tv_grab_zz_sdjson_sqlite@, as the SQLite version of the grabber is much *MUCH* faster and more efficient. However, the @_sqlite
version of the grabber suffers from almost the same problem: if a program has an
originalAirDate
associated with it, the
previously-shown
element is generated. The check for whether an airing is "new" is only checked if there is no
originalAirDate@, which seems a bit backwards. So, I made the same similar modification to @tv_grab_zz_sdjson_sqlite@: if a program is marked as "new" for that airing, the generated XMLTV will have a @new
element, and no
previously-shown
element will be generated.
I'm attaching my patches as unified diffs, in case anyone else might find this useful. The
tv_grab_zz_sdjson
patch is against the shipping 0.5.69 version from the XMLTV project. The
tv_grab_zz_sdjson_sqlite
version, though is against version 1.32 (2017-06-19) which I pulled from the GitHub repo of its author.