]> bicyclesonthemoon.info Git - ott/bsta/blobdiff - ong.1.pl
Adapted for new config tool.
[ott/bsta] / ong.1.pl
index 8da5522c916b0a5c66eb07957f25d8b270b5e677..1eeb352697786e5e531f09c0c45d4730639538bf 100644 (file)
--- a/ong.1.pl
+++ b/ong.1.pl
@@ -1,37 +1,36 @@
-###PERL;
-#
+###RUN_PERL: #!/usr/bin/perl
+
 # ong.pl is generated from ong.1.pl.
-# 29.06.2017
 #
 # The ONG bot
 #
-#    Copyright (C) 2016-2017  Balthasar Szczepański
+# Copyright (C) 2016, 2017, 2023  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 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.
+# 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/>.
+# 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;
+###PERL_LIB: use lib /botm/lib/bsta
 use bsta_lib qw(entityencode readdatafile writedatafile urlencode);
 use File::Copy;
 
-###DATA_PATH;
-###WWW_PATH;
-###SETTINGS_PATH;
-###STATE_PATH;
-###DEFAULT_PATH;
-###LIST_PATH;
+###PERL_DATA_PATH:          DATA_PATH    = /botm/data/bsta
+###PERL_DATA_DEFAULT_PATH:  DATA_DEFAULT_PATH = /botm/data/bsta/default
+###PERL_DATA_SETTINGS_PATH: DATA_SETTINGS_PATH = /botm/data/bsta/settings
+###PERL_DATA_STATE_PATH:    DATA_STATE_PATH    = /botm/data/bsta/state
+###PERL_WWW_PATH:           WWW_PATH           = /botm/www/1190/bsta/
+###PERL_DATA_LIST_PATH:     DATA_LIST_PATH     = /botm/data/bsta/list
 
 my %framedata;
 my %nextframedata;
@@ -58,10 +57,10 @@ $ongtime = int($time / 3600) * 3600;
 print $time.' - '.$ongtime."\n";
 
 delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
-###PATH;
+###PERL_SET_PATH: $ENV{'PATH'} = /usr/local/bin:/usr/bin:/bin;
 
 
-if (open ($statefile,"+<",STATE_PATH)){
+if (open ($statefile,"+<",DATA_STATE_PATH)){
        if (flock($statefile,2)) {
                %state=readdatafile($statefile);
                $ongstate=int($state{'state'});
@@ -71,7 +70,7 @@ if (open ($statefile,"+<",STATE_PATH)){
                        print 'ongtime: '.$nextong."\n";
                        
                        if($ongtime >= $nextong) {
-                               %settings=readdatafile(SETTINGS_PATH);
+                               %settings=readdatafile(DATA_SETTINGS_PATH);
                                $static=int($settings{'ongtime'});
                                $dynamic=int($settings{'dynamicongtime'});
                                $last=int($settings{'last'});
@@ -95,15 +94,15 @@ if (open ($statefile,"+<",STATE_PATH)){
                                if($ongstate == 2) {
                                        print 'next frame: '.$frame."\n";
                                        %framedata=readdatafile(DATA_PATH.$frame);
-                                       %default=readdatafile(DEFAULT_PATH);
-                                       %gotolist=readdatafile(LIST_PATH);
+                                       %default=readdatafile(DATA_DEFAULT_PATH);
+                                       %gotolist=readdatafile(DATA_LIST_PATH);
                                        
                                        $framedata{'ongtime'}=$time;
                                        $framedata{'timer'}=$dynamic;
                                        $gotolist{'title-'.$frame}=$framedata{'title'};
                                        $gotolist{'ongtime-'.$frame}=$framedata{'ongtime'};
                                        writedatafile(DATA_PATH.$frame,%framedata);
-                                       writedatafile(LIST_PATH,%gotolist);
+                                       writedatafile(DATA_LIST_PATH,%gotolist);
                                        
                                        foreach my $ind (keys %default) {
                                                unless(defined($framedata{$ind})){