Project

General

Profile

Show isn't being recognized as new. Can't figure out why

Added by Reggie Burnett almost 8 years ago

I am on comcast in TN and noticed yesterday that Marvel's Agents of Shield airing tonight was not listed to be recordoed. I had the autorec broadcast type set to New instead of any. Changing it to any causd it to be listed but I don't want to record any airing, only the new ones. I have not seen this problem with really any other shows.

I just dumped all my epg channels and reloaded (I'm using tv_grab_sd_json) and it ran successfully and mapped properly onto nearly all of the channels. Marvels is still not being recognized as new.

I ran tv_grab_sd_json and saved the output to a file. Looking at the file I saw for that Marvels show the following entries:

< previously-shown start="20170131"/ >

< new/ >

This appears to clearly list this show as new. Any idea why it's not being recognized?

Thanks!


Replies (12)

RE: Show isn't being recognized as new. Can't figure out why - Added by Robert Cameron almost 8 years ago

I believe it is related to "previously shown" being present. If there is a "previously shown" element, Tvheadend will not treat is as new. I had the same problem with tv_grab_sd_json, so I modified the grabber. Now, if there is a new, premiere, &c. element, then it will suppress the "previously shown" element from being generated.

Let me find a clean copy of the original tv_grab_sd_json, and I can generate a diff for which changes I made.

RE: Show isn't being recognized as new. Can't figure out why - Added by Robert Cameron almost 8 years ago

Here's the diff for my changes to tv_grab_sd_json :

--- a/tv_grab_sd_json
+++ b/tv_grab_sd_json
@@ -1184,8 +1184,14 @@
 # The xmltv docs state this field is "When and where the programme was last shown".
 # However mythtv expects the original air date to be in this field.
 sub get_program_previously_shown {
-    my ($details) = @_;
+    my ($program, $details) = @_;
+
     my %previously_shown;
+
+  my $new = $program->{'new'};
+  if($new) {
+    return undef;
+  }

     my $date = $details->{'originalAirDate'};
     if($date) {
@@ -1282,6 +1288,7 @@
     my ($w, $channel, $program, $details) = @_;

     my $dt = DateTime::Format::ISO8601->parse_datetime($program->{'airDateTime'});
+    $dt->set_time_zone('local');
     my $dur = DateTime::Duration->new(seconds => $program->{'duration'});

     if(($dt + $dur) >= $dt_start && $dt <= $dt_stop) {
@@ -1309,7 +1316,7 @@
             'episode-num'      => get_program_episode($program, $details),
             'video'            => get_program_video($program),
             'audio'            => get_program_audio($program),
-            'previously-shown' => get_program_previously_shown($details),
+            'previously-shown' => get_program_previously_shown($program, $details),
             'premiere'         => get_program_premiere($program),
 #            'last-chance'      => undef,
             'new'              => get_program_new($program),

RE: Show isn't being recognized as new. Can't figure out why - Added by Reggie Burnett almost 8 years ago

Thanks alot. I will apply this right away and try it out.

RE: Show isn't being recognized as new. Can't figure out why - Added by Reggie Burnett almost 8 years ago

Can you post here your tv_grab_sd_json file? I made the changes (except for one as the set_time_zone method didn't match up to my file but it didn't seem like that would interfere with the new flag so I didn't think leaving it out is a problem. That being said, I've now loaded up my EPG channels twice and it is still not marking some shows as new. Maybe if I had your exact copy of the script it would work better?

RE: Show isn't being recognized as new. Can't figure out why - Added by Robert Cameron almost 8 years ago

It's only going to work on new entries. Are you looking at items 2-3 weeks out for the new flag? It won't affect entries already in your EPG database.

Another thought: delete your tv_grab_sd_json.cache file. This way it will re download all the data. Otherwise, if the information hasn't changed on SD's servers it won't download the guide info for that programme again.

RE: Show isn't being recognized as new. Can't figure out why - Added by Reggie Burnett almost 8 years ago

OK. Thanks for the reply. I've deleted by EPG channels. is that not enough to dump the EPG database? How do I go about telling tvh to dump the entire EPG and reload?

RE: Show isn't being recognized as new. Can't figure out why - Added by Robert Cameron almost 8 years ago

Reggie Burnett wrote:

OK. Thanks for the reply. I've deleted by EPG channels. is that not enough to dump the EPG database? How do I go about telling tvh to dump the entire EPG and reload?

I don't believe that's enough, and I've never figured out how to purge the database in TVH. Also remember to remove your XMLTV cache file before running the grabber again. It's usually in ~/.xmltv of the user that TVH runs as.

RE: Show isn't being recognized as new. Can't figure out why - Added by Reggie Burnett almost 8 years ago

Quick update. I deleted the db file on disk (after stopping the service). I then started it back up and ran my grabber twice. I deleted the cache files like you said. Now the upcoming Marvel's Agents of Shield show is appearing as new. I think you have helped me solve it. Thanks!

RE: Show isn't being recognized as new. Can't figure out why - Added by Robert Cameron almost 8 years ago

Glad you've gotten it figured out.

The reason I changed the time to local time was because the previously shown and scheduled start/stop were different. Meaning: prime time shows would show a previously/original air date that was the day after its actual air date.

RE: Show isn't being recognized as new. Can't figure out why - Added by Reggie Burnett almost 8 years ago

That seems really useful but my file didn't quite match your diff.

Your diff has this:
my $dt = DateTime::Format::ISO8601->parse_datetime($program->{'airDateTime'});
+ $dt->set_time_zone('local');
my $dur = DateTime::Duration->new(seconds => $program->{'duration'});

my line right above my $dur reads like this:

my $airtime = parse_airtime($program->{'airDateTime'});
my $dur = int($program->{'duration'});

not sure if that means I have a newer or older grabber file.

RE: Show isn't being recognized as new. Can't figure out why - Added by Robert Cameron almost 8 years ago

Reggie Burnett wrote:

That seems really useful but my file didn't quite match your diff.

Your diff has this:
my $dt = DateTime::Format::ISO8601->parse_datetime($program->{'airDateTime'});
+ $dt->set_time_zone('local');
my $dur = DateTime::Duration->new(seconds => $program->{'duration'});

my line right above my $dur reads like this:

my $airtime = parse_airtime($program->{'airDateTime'});
my $dur = int($program->{'duration'});

not sure if that means I have a newer or older grabber file.

It's possible. I haven't upgraded to 0.5.69 yet, so it may be part of the update. Also, the name of the grabber in 0.5.69 changed to tv_grab_zz_sdjson, although it will be available under tv_grab_sd_json for this release, but going forward it will only be available under the new name.

RE: Show isn't being recognized as new. Can't figure out why - Added by Robert Cameron almost 8 years ago

I just installed 0.5.69 of the XMLTV utils, so here is my diff for tv_grab_zz_sdjson

--- a/tv_grab_zz_sdjson
+++ b/tv_grab_zz_sdjson
@@ -1339,8 +1339,13 @@
 # The xmltv docs state this field is "When and where the programme was last shown".
 # However mythtv expects the original air date to be in this field.
 sub get_program_previously_shown {
-    my ($details) = @_;
+    my ($program, $details) = @_;
     my %previously_shown;
+
+    my $new = $program->{'new'};
+    if($new) {
+        return undef;
+    }

     my $date = $details->{'originalAirDate'};
     if($date) {
@@ -1457,7 +1462,7 @@
             'episode-num'      => get_program_episode($program, $details),
             'video'            => get_program_video($program),
             'audio'            => get_program_audio($program),
-            'previously-shown' => get_program_previously_shown($details),
+            'previously-shown' => get_program_previously_shown($program, $details),
             'premiere'         => get_program_premiere($program),
 #            'last-chance'      => undef,
             'new'              => get_program_new($program),

It basically does the same as before: If a show is marked as new, it does not get a previously-shown element at all.

    (1-12/12)