Browse Source

Merge branch 'master' of github.com:AloisMahdal/minions

Alois Mahdal 10 years ago
parent
commit
c07ffdfc42
5 changed files with 28 additions and 6 deletions
  1. 4
    3
      README.md
  2. 5
    0
      TODO.md
  3. 11
    2
      bin/se
  4. 1
    1
      cgi-bin/htlog/htlog.cgi
  5. 7
    0
      etc/logrotate.d/htlogr

+ 4
- 3
README.md View File

@@ -91,9 +91,10 @@ Throw a word at it and by default, it will throw you back few Czech
91 91
 translations of it, one pair per line.  Sweet.  Also supports other languages
92 92
 (about 10 in total).
93 93
 
94
-Most useful options are --lines (default is 25) and --direction which supports
95
-direction keyword in form "LNcz.cz" or "LNcz.LN", where LN is 2-letter code
96
-(**not** ISO) of the other language.
94
+Most useful options are `--lines` (default is 25), `--long`, as shorthand
95
+to `--lines=50`, and `--direction`, which supports direction keyword in form
96
+"LNcz.cz" or "LNcz.LN", where LN is 2-letter code (**not** ISO) of the other
97
+language.
97 98
 
98 99
 Uses [www.slovnik.cz][2], so an Internet connection and [LWP::Simple][3] are
99 100
 needed.

+ 5
- 0
TODO.md View File

@@ -1,6 +1,11 @@
1 1
 TODO:
2 2
 =====
3 3
 
4
+Update
5
+------
6
+
7
+*   htlogr.pm according to htlogr.py
8
+
4 9
 Finish
5 10
 ------
6 11
 

+ 11
- 2
bin/se View File

@@ -14,12 +14,15 @@ sub usage;
14 14
 
15 15
 my $direction = 'encz.en';
16 16
 my $lines = 25;
17
+my $max_lines = 50;
18
+my $long = 0;
17 19
 my $man = 0;
18 20
 my $help = 0;
19 21
 my $host = 'www.slovnik.cz';
20 22
 
21 23
 GetOptions(
22
-    'lines|l=i'     => \$lines,
24
+    'long|l'     => \$long,
25
+    'lines|n=i'     => \$lines,
23 26
     'direction|d=s' => \$direction,
24 27
     'help|?|h'    => \$help,
25 28
     'man'       => \$man
@@ -27,6 +30,8 @@ GetOptions(
27 30
 pod2usage(1) if $help;
28 31
 pod2usage(-exitstatus => 0, -verbose => 2) if $man;
29 32
 
33
+$lines = $max_lines if $long;
34
+
30 35
 my $word = shift or usage;
31 36
 
32 37
 my $query  = sprintf(
@@ -115,7 +120,11 @@ one of following:
115 120
     lacz.la, lacz.cz, eocz.eo, eocz.cz, eosk.eo, eosk.sk,
116 121
     plcz.pl, plcz.cz
117 122
 
118
-=item B<-l> I<LINES>, B<--lines=>I<LINES>
123
+=item B<-l>, B<--long>
124
+
125
+Same as C<--lines=50>, which is maximum supported by API
126
+
127
+=item B<-n> I<LINES>, B<--lines=>I<LINES>
119 128
 
120 129
 Number of lines fetched fronm the service and displayed to stdout.
121 130
 Default is 25, but since www.slovnik.cz provides simplistic interface

+ 1
- 1
cgi-bin/htlog/htlog.cgi View File

@@ -18,7 +18,7 @@
18 18
 
19 19
 use CGI;
20 20
 
21
-my $LOG_FILE = 'htlog.log';
21
+my $LOG_FILE = '/var/log/htlogr.log';
22 22
 open my $fh, ">>", $LOG_FILE or die "cannot open log file for appending: $!";
23 23
 
24 24
 sub stamp {

+ 7
- 0
etc/logrotate.d/htlogr View File

@@ -0,0 +1,7 @@
1
+/var/log/htlogr.log {
2
+    weekly
3
+    rotate 8
4
+    compress
5
+    delaycompress
6
+    create 640 www-data adm
7
+}