XMLTV grabber returned error code 1

Have a MythTV related problem? Ask for help from other MythTV users here.

Moderator: Forum Moderators

mtbdrew
Junior
Posts: 50
Joined: Tue Jul 22, 2014 1:10 pm
United States of America

XMLTV grabber returned error code 1

Post by mtbdrew » Thu Jul 23, 2020 7:18 pm

mythtv 31 Trying to get the Schedules Direct mythfilldatabase to run correctly. When I run:

sudo -H -u mythtv bash -c "mythfilldatabase --refresh all"

It returns this error:
2020-07-23 14:12:14.018804 I XMLTV config file is: /home/mythtv/.mythtv/SD.xmltv
2020-07-23 14:12:14.770299 E XMLTV grabber returned error code 1
2020-07-23 14:12:15.119418 E Malformed XML file, missing </tv> element, at line 1, Premature end of document.
2020-07-23 14:12:16.441085 E Failed to fetch some program info

cat /home/mythtv/.mythtv/SD.xmltv
lineup=USA-OTA-76078
3rdparty-metadata=enabled
mythtv-categories=enabled
station-logo-order=

Seems like something is missing from the SD.xmltv file regarding TV element?

User avatar
bill6502
Developer
Posts: 1724
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: XMLTV grabber returned error code 1

Post by bill6502 » Thu Jul 23, 2020 7:38 pm

SD.xmltv isn't an XML (format) file. The error is in the data downloaded. If you run mythfilldatabase with
the -v system option, you'll see the grabber command. Run that from the command line and
look at the file. The bulk of the data is between a <tv ....> and </tv> tags.

Rerunning the command may be enough. For what it's worth (probably little) I don't run
mythfilldatabase with the --refresh all switch or have the station-logo-order line.

mtbdrew
Junior
Posts: 50
Joined: Tue Jul 22, 2014 1:10 pm
United States of America

Re: XMLTV grabber returned error code 1

Post by mtbdrew » Thu Jul 23, 2020 8:44 pm

So how exactly do I run mythfilldatabase with the -v system option?

sudo -H -u mythtv bash -c "mythfilldatabase -v"

Give the exact same error message:
2020-07-23 15:42:50.779993 I XMLTV config file is: /home/mythtv/.mythtv/SD.xmltv
2020-07-23 15:42:51.531665 E XMLTV grabber returned error code 1
2020-07-23 15:42:51.880608 E Malformed XML file, missing </tv> element, at line 1, Premature end of document.
2020-07-23 15:42:53.183875 E Failed to fetch some program info

User avatar
bill6502
Developer
Posts: 1724
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: XMLTV grabber returned error code 1

Post by bill6502 » Thu Jul 23, 2020 8:48 pm

-v system

Italics in the previous response. FYI, mythAnyProgram --help works.

mtbdrew
Junior
Posts: 50
Joined: Tue Jul 22, 2014 1:10 pm
United States of America

Re: XMLTV grabber returned error code 1

Post by mtbdrew » Thu Jul 23, 2020 8:57 pm

Okay got that to work so little more detailed output:

2020-07-23 15:53:17.153461 I Opening blocking connection to master backend
2020-07-23 15:53:18.469252 I Updating source #1 (SD) with grabber tv_grab_zz_sdjson_sqlite
2020-07-23 15:53:18.471232 I Found 33 channels for source 1 which use grabber
2020-07-23 15:53:18.471504 I Starting process signal handler
2020-07-23 15:53:18.471561 I Starting IO manager (read)
2020-07-23 15:53:18.472586 I Managed child (PID: 44968) has started! * command=tv_grab_zz_sdjson_sqlite --capabilities, timeout=25
2020-07-23 15:53:18.472731 I Starting process manager
2020-07-23 15:53:18.473216 I Starting IO manager (write)
2020-07-23 15:53:19.175279 I Managed child (PID: 44968) has exited! command=tv_grab_zz_sdjson_sqlite --capabilities, status=0, result=0
2020-07-23 15:53:19.222612 I Grabber has capabilities: baseline manualconfig preferredmethod lineups apiconfig
2020-07-23 15:53:19.223840 I Managed child (PID: 44970) has started! * command=tv_grab_zz_sdjson_sqlite --preferredmethod, timeout=15
2020-07-23 15:53:19.926564 I Managed child (PID: 44970) has exited! command=tv_grab_zz_sdjson_sqlite --preferredmethod, status=0, result=0
2020-07-23 15:53:19.973641 I Grabber prefers method: allatonce
2020-07-23 15:53:19.974823 I XMLTV config file is: /home/mythtv/.mythtv/SD.xmltv
2020-07-23 15:53:19.980355 I Managed child (PID: 44972) has started! * command=nice tv_grab_zz_sdjson_sqlite --config-file '/home/mythtv/.mythtv/SD.xmltv' --output /tmp/mythPSj3YC --quiet, timeout=0
2020-07-23 15:53:20.723178 I Managed child (PID: 44972) has exited! command=nice tv_grab_zz_sdjson_sqlite --config-file '/home/mythtv/.mythtv/SD.xmltv' --output /tmp/mythPSj3YC --quiet, status=256, result=1
2020-07-23 15:53:20.728671 E XMLTV grabber returned error code 1
2020-07-23 15:53:20.733098 I Managed child (PID: 44974) has started! * command=/usr/share/mythtv/metadata/Movie/tmdb3.py -v, timeout=0
2020-07-23 15:53:20.793640 I Managed child (PID: 44974) has exited! command=/usr/share/mythtv/metadata/Movie/tmdb3.py -v, status=0, result=0
2020-07-23 15:53:20.831047 I Managed child (PID: 44976) has started! * command=/usr/share/mythtv/metadata/Television/ttvdb.py -v, timeout=0
2020-07-23 15:53:21.072097 I Managed child (PID: 44976) has exited! command=/usr/share/mythtv/metadata/Television/ttvdb.py -v, status=0, result=0
2020-07-23 15:53:21.077838 E Malformed XML file, missing </tv> element, at line 1, Premature end of document.
2020-07-23 15:53:22.398459 E Failed to fetch some program info

mtbdrew
Junior
Posts: 50
Joined: Tue Jul 22, 2014 1:10 pm
United States of America

Re: XMLTV grabber returned error code 1

Post by mtbdrew » Thu Jul 23, 2020 9:26 pm

2020-07-23 15:53:21.077838 E Malformed XML file, missing </tv> element, at line 1, Premature end of document

So what XML file is this referring too?

User avatar
bill6502
Developer
Posts: 1724
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: XMLTV grabber returned error code 1

Post by bill6502 » Thu Jul 23, 2020 9:57 pm

I just did a run and all's well for me.

The file saved in /tmp. Run the grabber manually and then look in the output like this:

Code: Select all

tv_grab_zz_sdjson_sqlite --config-file '/home/mythtv/.mythtv/SD.xmltv' --output /tmp/JustMeTesting
By running the grabber manually, the file won't be deleted (so you can look at it) but don't
forget to remove it when done.

The XML tags should all match. If you want a 3rd party check, in Ubuntu package libxml2-utils
has xmllint and it can be run like: xmllint --noout /tmp/JustMeTesting.

But the missing tag may be an error from Schedules Direct and you have to open a ticket there.
Or, it could be an problem on your host, e.g. out of disk space.

mtbdrew
Junior
Posts: 50
Joined: Tue Jul 22, 2014 1:10 pm
United States of America

Re: XMLTV grabber returned error code 1

Post by mtbdrew » Thu Jul 23, 2020 11:47 pm

tv_grab_zz_sdjson_sqlite --config-file '/home/mythtv/.mythtv/SD.xmltv' --output /tmp/JustMeTesting

This runs fine with no errors. Seems like only when mythtv runs it or using the sudo -H -u mythtv bash -c "mythfilldatabase -v system" command line format does the error occur.

I tried tv_grab_zz_sdjson_sqlite --config-file '/home/mythtv/.mythtv/SD.xmltv' --output /tmp/JustMeTesting as both mythtv user and my local and they both ran fine.

mtbdrew
Junior
Posts: 50
Joined: Tue Jul 22, 2014 1:10 pm
United States of America

Re: XMLTV grabber returned error code 1

Post by mtbdrew » Thu Jul 23, 2020 11:58 pm

Okay tried something different:

First ran
sudo su - mythtv

Then ran the command (after adding mythtv to sudo)
sudo -H -u mythtv bash -c "mythfilldatabase -v system"

This did not give the original error message however it did give a bunch of:
Unknown xmltv channel identifier: I90202.json.schedulesdirect.org - Skipping channel.
After those however the script finished running and now System Status for mythfilldatabase does not show "Re: XMLTV grabber returned error code 1" and now has 18 days of schedule.

User avatar
bill6502
Developer
Posts: 1724
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: XMLTV grabber returned error code 1

Post by bill6502 » Fri Jul 24, 2020 12:15 am

Unknown xmltv channel identifier: I90202.json.schedulesdirect.org - Skipping channel is
likely caused when the mythconverg DB doesn't have that identifier, but the grabber's
DB does have the channel (xmltvid) and it is marked as selected. Set selected to 0
and the message should go away.

The JustMeTesting file should still be there and you can look at the end of it. Does it have
</tv> as the last line. Probably not, as that was the error reported.

The "double su" shouldn't have had affect. I use (with long switch names): sudo --login --user=mythtv mythfilldatabase
You don't need the -v system switch unless you want to see the grabber command.

It's more likely something got fixed.

mtbdrew
Junior
Posts: 50
Joined: Tue Jul 22, 2014 1:10 pm
United States of America

Re: XMLTV grabber returned error code 1

Post by mtbdrew » Fri Jul 24, 2020 3:09 am

Not sure exactly what you mean:
"mythconverg DB doesn't have that identifier, but the grabber's
DB does have the channel (xmltvid) and it is marked as selected. Set selected to 0
and the message should go away."

Yes the </tv> is at the end

Definitely couldn't run the command until I added mythtv sudo, tried several times and they all failed.

User avatar
bill6502
Developer
Posts: 1724
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: XMLTV grabber returned error code 1

Post by bill6502 » Fri Jul 24, 2020 1:11 pm

I added color to my previous response in case someone else asks the same question
about identifier. It's just the text used by the error message. Right, in the channel table,
the column is xmltvid. Not that users need to access the DB directly.

For example:

Code: Select all

$ sudo su - myhttv
$ echo $HOME
/home/mythtv
$ mythfilldatabase
...
2020-07-24 07:59:52.204109 I  XMLTV config file is: /home/mythtv/.mythtv/OTA.xmltv
...
Last edited by bill6502 on Fri Jul 24, 2020 3:47 pm, edited 1 time in total.
Reason: Code section is an example.

mtbdrew
Junior
Posts: 50
Joined: Tue Jul 22, 2014 1:10 pm
United States of America

Re: XMLTV grabber returned error code 1

Post by mtbdrew » Fri Jul 24, 2020 3:16 pm

I don't have this file:

/home/mythtv/.mythtv/OTA.xmltv

So where and how do you deselect the stations "Set selected to 0"

User avatar
bill6502
Developer
Posts: 1724
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: XMLTV grabber returned error code 1

Post by bill6502 » Fri Jul 24, 2020 4:07 pm

That's just my system. From your initial post, SD is the name of your source and
that's how the file name in ~/.mythtv is developed (source name + .xmltv).

See https://www.mythtv.org/wiki/XMLTV#Chann ... shortcut_2 . Or,
near end of the section, you can see SQL examples. You can put the lines
in a file or (as user mythtv) use: sqlite3 $HOME/.xmltv/SchedulesDirect.DB

But something isn't making sense to me. Your log says you're using the SQLite
version (tv_grab_zz_sdjson_sqlite). But your SD.xmltv file doesn't have the path to
the SQLite DB. Here's an EXAMPLE picture of a files used by the SQLite grabber:

Code: Select all

Example for distributions that store MythTV data relative to ~mythtv/.mythtv,

/
└── home
    └── mythtv
        ├── .mythtv
        │   ├── OTA.xmltv # Which contains:
        │   │       database=/home/mythtv/.xmltv/SchedulesDirect.DB
        │   │       lineup=USA-OTA-90210
        │   │       mythtv-categories=enabled
        │   │
        │   └── CABLE.xmltv # Which contains:
        │           database=/home/mythtv/.xmltv/SchedulesDirect.DB
        │           lineup=USA-IL90210-X
        │           mythtv-categories=enabled
        │
        └── .xmltv
            └── SchedulesDirect.DB

Note that nothing is stored under the login user's .mythtv or .xmltv
Last edited by bill6502 on Fri Jul 24, 2020 7:40 pm, edited 1 time in total.
Reason: Highlight the example is for the SQLite grabber

wesnewell
Senior
Posts: 669
Joined: Mon Jun 23, 2014 6:54 pm
Location: Wylie TX, USA
United States of America

Re: XMLTV grabber returned error code 1

Post by wesnewell » Fri Jul 24, 2020 4:42 pm

If that doesn't work copy this to both /home/mythtv/.mythtv/SD.xmltv and /home/<user name>/.mythtv/SD.xmltv if you want to run mythfilldatabase from that user terminal.

cache=/home/mythtv/.xmltv/tv_grab_zz_sdjson.cache
channel-id-format=default
previously-shown-format=date
username=your sd username
password=your sd password
mode=lineup
lineup=USA-OTA-76078

Run mythfilldatabase from either user prompt. This has worked for me for years. It is the regular grabber. not the sqlite one. I've never run the sqlite version.
BE/FE-Asrock AB350 Pro Ryzen 3 3200G, 6 atsc tuners. FE's-GF8200's Athlon II, Ryzen 3 2200G. Mythtv user since 2005.

Post Reply