# Mythtv: grabbing
I use the excellent program tv\_grab\_nl\_py from <https://github.com/tvgrabbers/tvgrabnlpy>.
The developers devoted many manhours to create a program that
grabs the program info from several websites.
Documentation is adequate, no need to elaborate on that.

I use the following script to call the grabber and to insert
the information into mythbackend:


      #!/bin/bash
      #
      GRABBER=/usr/local/tvgrab/tv\_grab\_nl.py
      OUTPUT=/home/mythtv/.xmltv/xmltvdata
      LOGFILE=`mktemp --tmpdir mygrablog.XXXXX`
      chmod a+r $LOGFILE
      echo "mygrab logfile datum: `date`" > $LOGFILE
      touch $OUTPUT # to fix error in grabber
      logger "Starting $GRABBER"
      $GRABBER --output $OUTPUT  >> $LOGFILE 2>&1
      for id in 1 3 ; do
         /usr/bin/mythfilldatabase --only-update-guide \
         --file --sourceid $id --xmlfile $OUTPUT >> $LOGFILE 2>&1
      done
      mv -f $OUTPUT $OUTPUT.old
      logger "Grabbing ended."


Notice the `for id in 1 3 ; do`: I have digital and analog cards
in my setup. id 1 is for the analog and id 3 for the digital card.

How to find out which sourceid's you should use:


      mysql mythconverg -u mythtv -p
      select * from videosource;


See also: <https://www.mythtv.org/wiki/Mythfilldatabase>
