comparison fetch_feeds.tcl @ 265:908edc54005a

feeds: Move configuration to separate file.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 23 Jan 2015 10:15:38 +0200
parents bbc7860c22a6
children 96310b1c88fa
comparison
equal deleted inserted replaced
264:d2f65cd528c6 265:908edc54005a
2 # 2 #
3 # NOTICE! Change above path to correct tclsh binary path! 3 # NOTICE! Change above path to correct tclsh binary path!
4 # 4 #
5 ########################################################################## 5 ##########################################################################
6 # 6 #
7 # FeedCheck fetcher v0.8 by Matti 'ccr' Hamalainen <ccr@tnsp.org> 7 # FeedCheck fetcher v0.9 by Matti 'ccr' Hamalainen <ccr@tnsp.org>
8 # (C) Copyright 2008-2013 Tecnic Software productions (TNSP) 8 # (C) Copyright 2008-2015 Tecnic Software productions (TNSP)
9 # 9 #
10 # This script is freely distributable under GNU GPL (version 2) license. 10 # This script is freely distributable under GNU GPL (version 2) license.
11 # 11 #
12 ########################################################################## 12 ##########################################################################
13 package require sqlite3 13 package require sqlite3
14 source [file dirname [info script]]/util_convert.tcl 14 source [file dirname [info script]]/utillib.tcl
15 15
16 # SQLite3 database, MUST be set to same as in feeds.tcl 16 ### The configuration should be in config.feeds in same directory
17 set feeds_dbfile "/home/niinuska/bot/feeds.sqlite" 17 ### as this script. Or change the line below to point where ever
18 18 ### you wish. See "config.feeds.example" for an example config file.
19 # Use a HTTP proxy? 1 = yes, 0 = no 19 source [file dirname [info script]]/config.feeds
20 set http_proxy 0
21
22 # HTTP proxy address and port
23 set http_proxy_host "cache.inet.fi"
24 set http_proxy_port 800
25 20
26 21
27 ########################################################################## 22 ##########################################################################
28 23
29 set feeds_ent_str "&#45;|-|&#39;|'|—|-|&rlm;||&#8212;|-|&#8211;|--|&#x202a;||&#x202c;|" 24 set feeds_ent_str "&#45;|-|&#39;|'|—|-|&rlm;||&#8212;|-|&#8211;|--|&#x202a;||&#x202c;|"
34 append feeds_ent_str "|&#124;|-|&#8217;|'|&uuml;|ü|&Uuml;|Ü|&bull;|*|&euro;|€" 29 append feeds_ent_str "|&#124;|-|&#8217;|'|&uuml;|ü|&Uuml;|Ü|&bull;|*|&euro;|€"
35 append feeds_ent_str "|&rdquo;|\"" 30 append feeds_ent_str "|&rdquo;|\""
36 set html_ent [split [encoding convertfrom "utf-8" $feeds_ent_str] "|"] 31 set html_ent [split [encoding convertfrom "utf-8" $feeds_ent_str] "|"]
37 32
38 package require http 33 package require http
39 ::http::config -urlencoding iso8859-1 -useragent "Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 5.0) Opera 9.5" 34 if {[info exists http_user_agent] && $http_user_agent != ""} {
40 if {$http_proxy != 0} { 35 ::http::config -urlencoding iso8859-1 -useragent $http_user_agent
36 } else {
37 ::http::config -urlencoding iso8859-1 -useragent "Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 5.0) Opera 9.5"
38 }
39 if {$http_use_proxy != 0} {
41 ::http::config -proxyhost $http_proxy_host -proxyport $http_proxy_port 40 ::http::config -proxyhost $http_proxy_host -proxyport $http_proxy_port
41 }
42
43 if {$http_tls_support != 0} {
44 package require tls
45 ::http::register https 443 [list ::tls::socket -request 1 -require 1 -tls1 1 -cadir $http_tls_cadir]
42 } 46 }
43 47
44 48
45 proc convert_ent {udata} { 49 proc convert_ent {udata} {
46 global html_ent 50 global html_ent