annotate config.feeds.example @ 550:85fe3bc36307

Rename *_logmsg settings to *_log_enable.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 08 Jul 2020 22:55:56 +0300
parents c6f389bef58e
children 0ce432c3f03f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
265
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 ##########################################################################
266
8f5daf6631d9 Add comment.
Matti Hamalainen <ccr@tnsp.org>
parents: 265
diff changeset
2 #
8f5daf6631d9 Add comment.
Matti Hamalainen <ccr@tnsp.org>
parents: 265
diff changeset
3 # Feeds script and fetcher script configuration
8f5daf6631d9 Add comment.
Matti Hamalainen <ccr@tnsp.org>
parents: 265
diff changeset
4 #
265
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5 ##########################################################################
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7 # SQLite3 database
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8 set feeds_dbfile "/home/niinuska/bot/feeds.sqlite"
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10
549
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
11 proc feeds_cmd_pub_last {unick uhost uhand uchan utext} {
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
12 return [feeds_cmd $unick $uhost $uhand $uchan "last $utext" 1]
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
13 }
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
14
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
15 proc feeds_cmd_msg_last {unick uhost uhand utext} {
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
16 return [feeds_cmd $unick $uhost $uhand "PRIV" "last $utext" 0]
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
17 }
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
18
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
19
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
20 proc feeds_cmd_pubm_last {unick uhost uhand uchan utext} {
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
21 return [feeds_cmd $unick $uhost $uhand $uchan "last [feeds_cmdm_split $utext]" 1]
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
22 }
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
23
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
24 proc feeds_cmd_msgm_last {unick uhost uhand utext} {
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
25 return [feeds_cmd_msg $unick $uhost $uhand "PRIV" "last [feeds_cmdm_split $utext]" 0]
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
26 }
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
27
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
28
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
29 # Initialization proc called only by feeds.tcl
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
30 proc feeds_init { } {
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
31 # Bind commands
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
32 bind pubm - !feed* feeds_cmd_pubm
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
33 bind pub - !last feeds_cmd_pub_last
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
34 bind pubm - !lates* feeds_cmd_pubm_last
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
35
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
36 bind msgm - !feed* feeds_cmd_msgm
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
37 bind msg - !last feeds_cmd_msg_last
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
38 bind msgm - !lates* feeds_cmd_msgm_last
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
39 }
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
40
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
41
527
461be6f596bd Add comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 526
diff changeset
42 # Proc for fetching the feeds data, called by fetch_feeds.tcl
484
35d7be5db18b fetch_feeds: Move the actual calling of fetching functions to the
Matti Hamalainen <ccr@tnsp.org>
parents: 362
diff changeset
43 proc feeds_fetch { } {
35d7be5db18b fetch_feeds: Move the actual calling of fetching functions to the
Matti Hamalainen <ccr@tnsp.org>
parents: 362
diff changeset
44 #fetch_poliisi "http://www.poliisi.fi/oulu/tiedotteet/1/0?all1/0" "Poliisi/Oulu" "http://www.poliisi.fi"
35d7be5db18b fetch_feeds: Move the actual calling of fetching functions to the
Matti Hamalainen <ccr@tnsp.org>
parents: 362
diff changeset
45
35d7be5db18b fetch_feeds: Move the actual calling of fetching functions to the
Matti Hamalainen <ccr@tnsp.org>
parents: 362
diff changeset
46 fetch_halla_aho
35d7be5db18b fetch_feeds: Move the actual calling of fetching functions to the
Matti Hamalainen <ccr@tnsp.org>
parents: 362
diff changeset
47
35d7be5db18b fetch_feeds: Move the actual calling of fetching functions to the
Matti Hamalainen <ccr@tnsp.org>
parents: 362
diff changeset
48 fetch_adventurers
35d7be5db18b fetch_feeds: Move the actual calling of fetching functions to the
Matti Hamalainen <ccr@tnsp.org>
parents: 362
diff changeset
49
35d7be5db18b fetch_feeds: Move the actual calling of fetching functions to the
Matti Hamalainen <ccr@tnsp.org>
parents: 362
diff changeset
50 fetch_oots
35d7be5db18b fetch_feeds: Move the actual calling of fetching functions to the
Matti Hamalainen <ccr@tnsp.org>
parents: 362
diff changeset
51
35d7be5db18b fetch_feeds: Move the actual calling of fetching functions to the
Matti Hamalainen <ccr@tnsp.org>
parents: 362
diff changeset
52 add_rss_feed "https://effi.org/feed/" "EFFI" ""
35d7be5db18b fetch_feeds: Move the actual calling of fetching functions to the
Matti Hamalainen <ccr@tnsp.org>
parents: 362
diff changeset
53 }
35d7be5db18b fetch_feeds: Move the actual calling of fetching functions to the
Matti Hamalainen <ccr@tnsp.org>
parents: 362
diff changeset
54
35d7be5db18b fetch_feeds: Move the actual calling of fetching functions to the
Matti Hamalainen <ccr@tnsp.org>
parents: 362
diff changeset
55
265
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
56 # How often to check for newly added feed items from the database?
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
57 # (in minutes) This has nothing to do how often the backend script
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
58 # is run and actually scans / pulls the feeds, that is done in CRON.
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
59 # See get_feeds.tcl for more information.
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
60 set feeds_check_period 5
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
61
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
62
351
0f55bbb7fea3 feeds: Improve safety checks and add new configuration setting.
Matti Hamalainen <ccr@tnsp.org>
parents: 266
diff changeset
63 # Limit / number of new feed items allowed to be published
0f55bbb7fea3 feeds: Improve safety checks and add new configuration setting.
Matti Hamalainen <ccr@tnsp.org>
parents: 266
diff changeset
64 # after which situation is considered unsynchronized / spam and
0f55bbb7fea3 feeds: Improve safety checks and add new configuration setting.
Matti Hamalainen <ccr@tnsp.org>
parents: 266
diff changeset
65 # none of the new items are published.
362
e5a9aaf250b3 feeds: Lower the default feeds item limit value in example configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 351
diff changeset
66 set feeds_sync_limit 10
351
0f55bbb7fea3 feeds: Improve safety checks and add new configuration setting.
Matti Hamalainen <ccr@tnsp.org>
parents: 266
diff changeset
67
0f55bbb7fea3 feeds: Improve safety checks and add new configuration setting.
Matti Hamalainen <ccr@tnsp.org>
parents: 266
diff changeset
68
265
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
69 # Set channels and feed filters here:
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
70 # "#channel" "feedname|feedname2"
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
71 # feednames can use matching, e.g. "mtv3*" would match all beginning with "mtv3"
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
72 array set feeds_channels {
549
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
73 "#mazmlame" "the adventurers|oots|mestari|effi"
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
74 "#fireball" "mestari|effi"
265
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
75 }
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
76
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
77
526
eb9921ae5c7a feeds: Add feeds_logmsg setting.
Matti Hamalainen <ccr@tnsp.org>
parents: 484
diff changeset
78 # 1 = Enable logging of various script actions into bot's log
eb9921ae5c7a feeds: Add feeds_logmsg setting.
Matti Hamalainen <ccr@tnsp.org>
parents: 484
diff changeset
79 # 0 = Don't.
550
85fe3bc36307 Rename *_logmsg settings to *_log_enable.
Matti Hamalainen <ccr@tnsp.org>
parents: 549
diff changeset
80 set feeds_log_enable 1
526
eb9921ae5c7a feeds: Add feeds_logmsg setting.
Matti Hamalainen <ccr@tnsp.org>
parents: 484
diff changeset
81
527
461be6f596bd Add comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 526
diff changeset
82
461be6f596bd Add comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 526
diff changeset
83 # What IRC "command" should we use to send messages:
461be6f596bd Add comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 526
diff changeset
84 # (Valid alternatives are "PRIVMSG" and "NOTICE")
265
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
85 set feeds_preferredmsg "PRIVMSG"
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
86
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
87
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
88 ###
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
89 ### HTTP options
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
90 ###
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
91 # Set to 1 if you want to enable use of HTTP proxy.
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
92 # If you do, you MUST set the proxy settings below too.
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
93 set http_use_proxy 0
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
94
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
95 # Proxy host and port number (only used if enabled above)
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
96 set http_proxy_host ""
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
97 set http_proxy_port 8080
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
98
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
99 # Enable TLS/SSL support. You need to set http_tls_cadir.
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
100 set http_tls_support 1
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
101 set http_tls_cadir "/usr/share/ca-certificates/mozilla"
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
102
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
103 # Set 'user agent' string for HTTP. If empty or not set, default will be used.
908edc54005a feeds: Move configuration to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
104 #set http_user_agent "Mozilla"
549
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
105
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
106
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
107 ###
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
108 ### Messages
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
109 ###
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
110
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
111 array set feeds_messages {
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
112
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
113 "usage_full" {"usage_help"}
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
114 "usage_help" "@cmd@ \[latest \[<feed>\]|list|history\]"
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
115
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
116 "chk_unsync_entries" "Epäsynkki."
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
117 "chk_new_entries" "@1@ uutta."
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
118 "chk_entry" "@1@: @4@ \002@2@\002 -- @3@"
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
119
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
120 "search_latest_feed" "Uusin '@1@' / @2@: @3@ -- @4@"
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
121 "search_no_matches" "Ei osumia haulla '@1@'."
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
122
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
123 "history_list" "Feedien historia: @1@"
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
124 "history_list_item" "@1@ (@2@)"
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
125 "history_list_sep" ", "
c6f389bef58e feeds: Largely refactor feeds.tcl, bump version to 2.0.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
126 }