#!/usr/bin/perl

$doit=shift || 0;

@files=qw(tv_grab_it_dvb/sky_it.themes tv_grab_it_dvb/channel_ids tv_grab_it_dvb/sky_it.dict tv_grab_uk_bleb/icon_urls tv_augment/augment.rules tv_augment/augment.conf xmltv-lineups.xsd tv_grab_eu_epgdata/channel_ids tv_grab_uk_tvguide/tv_grab_uk_tvguide.map.conf xmltv.dtd tv_grab_is/category_map tv_grab_it/channel_ids tv_grab_huro/catmap.cz tv_grab_huro/catmap.sk tv_grab_huro/jobmap tv_grab_huro/catmap.ro tv_grab_huro/catmap.hu);

foreach (@files) {
   $orig=$_;
   s/^tv_grab_//;
   s/^tv_//;
   $new="xmltv-nightly/$_";
   $new="xmltv-nightly/grab/$_"   if $orig =~ /tv_grab/;
   $new="xmltv-nightly/filter/$_" if $orig =~ /tv_augment/;
   $diff="miss";
   if (-e $new) {
     system("diff -q $new $orig >/dev/null");
     $diff="upd";
     $diff="   " unless $?;
     system("cp $new $orig") if $?>0 && $doit;
   }
   printf "%s %-30s %-30s\n",$diff,$orig,$new;
}
