###PERL;
#
# updlist.pl is generated from updlist.1.pl.
# 29.06.2017
#
# The framelist update bot
#
#    Copyright (C) 2016-2017  Balthasar Szczepański
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Affero General Public License as
#    published by the Free Software Foundation, either version 3 of the
#    License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.

use strict;
#use warnings;
###LIB;
use bsta_lib qw(readdatafile writedatafile);
use File::Copy;

###DATA_PATH;
###WWW_PATH;
###SETTINGS_PATH;
###STATE_PATH;
###DEFAULT_PATH;
###LIST_PATH;

my %framedata;
my %gotolist;

my $frame;

%gotolist=readdatafile(LIST_PATH);

for($frame=0; ; ++$frame) {
	%framedata=readdatafile(DATA_PATH.$frame);
	if($framedata{'ongtime'} eq '') {
		last;
	}
	
	print $frame.' '.$framedata{'ongtime'}.' '.$framedata{'title'}."\n";
	
	$gotolist{'title-'.$frame}=$framedata{'title'};
	$gotolist{'ongtime-'.$frame}=$framedata{'ongtime'};
}

writedatafile (LIST_PATH,%gotolist);
