git.fiddlerwoaroof.com
Browse code

various conf changes

Ed L authored on 11/10/2015 01:34:41
Showing 9 changed files
... ...
@@ -1,6 +1,4 @@
1 1
 output/index.html
2
-output/rss20.xml
3
-output/status-log.html
4 2
 .*.sw?
5 3
 *.pyc
6 4
 rawdog.log
... ...
@@ -439,3 +439,18 @@ feed 1h http://beiboot-petri.blogspot.co.at/feeds/posts/default
439 439
 feed 1h http://josbrunonis.blogspot.co.at/feeds/posts/default
440 440
 feed 1h http://pblosser.blogspot.com/feeds/posts/default
441 441
 feed 1h http://catholicheritage.blogspot.co.at/feeds/posts/default
442
+feed 1h http://feeds.feedburner.com/catholicnewsagency/dailynews
443
+feed 1h http://feeds.feedburner.com/catholicnewsagency/dailynews-vatican
444
+feed 1h http://feeds.feedburner.com/catholicnewsagency/dailygospel
445
+feed 1h http://feeds.feedburner.com/catholicnewsagency/saintoftheday
446
+feed 1h http://feeds.feedburner.com/zenit/english
447
+feed 1h http://feeds.feedburner.com/NCRegisterDailyBlog
448
+feed 1h http://www.catholicnews.com/rss/cns-movie-reviews.xml
449
+feed 1h http://www.catholicnews.com/rss/cns-vatican-news.xml
450
+feed 1h http://www.catholicnews.com/rss/cns-top-story.xml
451
+feed 1h http://scottdodge.blogspot.co.at/feeds/posts/default
452
+feed 1h http://blog.etheldredasplace.net/feed/
453
+feed 1h http://maryvictrix.com/feed/
454
+feed 1h http://teaattrianon.blogspot.com/feeds/posts/default
455
+feed 1h http://yvesdaoudal.hautetfort.com/index.rss
456
+feed 1h https://ethikapolitika.org/feed/
442 457
new file mode 100644
... ...
@@ -0,0 +1,12 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<browserconfig>
3
+  <msapplication>
4
+    <tile>
5
+      <square70x70logo src="/mstile-70x70.png"/>
6
+      <square150x150logo src="/mstile-150x150.png"/>
7
+      <square310x310logo src="/mstile-310x310.png"/>
8
+      <wide310x150logo src="/mstile-310x150.png"/>
9
+      <TileColor>#2b5797</TileColor>
10
+    </tile>
11
+  </msapplication>
12
+</browserconfig>
... ...
@@ -3,14 +3,17 @@
3 3
  * The .xmlbutton was stolen from the default stylesheet.
4 4
  * Samuel Hym <Samuel.Hym@gmail.com> */
5 5
 
6
-body {
6
+* {
7
+  box-sizing: border-box;
7 8
   font-family: Caudex,Georgia,Serif;
8 9
   -webkit-font-feature-settings: 'liga' 1, 'onum' 1, 'kern' 1;
9 10
   -moz-font-feature-settings: 'liga' 1, 'onum' 1, 'kern' 1;
10 11
   -o-font-feature-settings: 'liga' 1, 'onum' 1, 'kern' 1;
11 12
   text-rendering: geometricPrecision;
12
-  box-sizing: border-box;
13
-  max-width: 1100px;
13
+}
14
+
15
+body {
16
+  width: 96vw;
14 17
   margin: 0px auto;
15 18
   padding: 0px 1em;
16 19
 }
... ...
@@ -35,25 +38,24 @@ h2 {
35 38
 
36 39
 div.col {
37 40
   overflow: hidden;
41
+  padding: 1em;
38 42
 }
39 43
 
40
-div.col::after {
44
+body::after, div.col::after {
41 45
   content: " ";
42 46
   clear: both;
43 47
   display: block;
44
-
45 48
 }
46 49
 
47 50
 @media (min-width: 700px) {
51
+  div.col + .col {
52
+    border-left: thin solid #ccc;
53
+  }
48 54
   div.col {
49
-    width: 30%;
50
-    margin-right: 3%;
55
+    width: 30vw;
51 56
     float: left;
52
-  }
53
-
54
-  div.col:nth-child(3n+2) {
55
-    margin-right: 0%;
56
-    float:right;
57
+    margin-bottom: -99999px;
58
+    padding-bottom: 99999px;
57 59
   }
58 60
 }
59 61
 
... ...
@@ -65,10 +67,10 @@ div.col::after {
65 67
 }
66 68
 
67 69
 article {
70
+  padding: 0.5em  0px  1em;
68 71
   min-height: 2.2em;
69
-  padding: 1.5em 0em;
70 72
 }
71 73
 
72 74
 article + article {
73
-  border-top: thin dashed black;
75
+  border-top: thin dashed #ccc;
74 76
 }
75 77
new file mode 100644
... ...
@@ -0,0 +1,41 @@
1
+{
2
+	"name": "Catholic News",
3
+	"icons": [
4
+		{
5
+			"src": "\/android-chrome-36x36.png",
6
+			"sizes": "36x36",
7
+			"type": "image\/png",
8
+			"density": "0.75"
9
+		},
10
+		{
11
+			"src": "\/android-chrome-48x48.png",
12
+			"sizes": "48x48",
13
+			"type": "image\/png",
14
+			"density": "1.0"
15
+		},
16
+		{
17
+			"src": "\/android-chrome-72x72.png",
18
+			"sizes": "72x72",
19
+			"type": "image\/png",
20
+			"density": "1.5"
21
+		},
22
+		{
23
+			"src": "\/android-chrome-96x96.png",
24
+			"sizes": "96x96",
25
+			"type": "image\/png",
26
+			"density": "2.0"
27
+		},
28
+		{
29
+			"src": "\/android-chrome-144x144.png",
30
+			"sizes": "144x144",
31
+			"type": "image\/png",
32
+			"density": "3.0"
33
+		},
34
+		{
35
+			"src": "\/android-chrome-192x192.png",
36
+			"sizes": "192x192",
37
+			"type": "image\/png",
38
+			"density": "4.0"
39
+		}
40
+	]
41
+}
... ...
@@ -7,19 +7,76 @@ from StringIO import StringIO
7 7
 title_list = """
8 8
 <!DOCTYPE html>
9 9
 <html lang="en">
10
-<head>
11
-  <meta charset="UTF-8">
12
-  <meta name="viewport" content="width=device-width, initial-scale=1">
13
-  <title>Catholic Feeds - Headlines</title>
14
-  <link rel="stylesheet" href="headline-style.css">
15
-</head>
16
-<body>
17
- <h1>Headlines</h1>
18
- <main>
19
- %s
20
- </main>
21
-</body>
22
-</html>
10
+  <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# join-marrow: http://ogp.me/ns/fb/join-marrow#">
11
+    <meta property="og:type" content="join-marrow:headlines" />
12
+    <meta property="og:title" content="Current Headlines" />
13
+    <meta property="og:site_name" content="Catholic News" />
14
+    <meta property="og:url" content="http://planet.joinmarrow.com/headlines" />
15
+    <meta property="og:image" content="http://planet.joinmarrow.com/planet.joinmarrow.png" />
16
+    <meta property="og:image:width"  content="512" />
17
+    <meta property="og:image:height" content="512" />
18
+    <meta property="og:description" content="Headlines from a collection of Catholic blogs. Visit us to take the pulse of the Catholic internet" />
19
+    <meta property="fb:app_id" content="897925460261572" />
20
+    <base target="_blank" />
21
+    <meta http-equiv="refresh" content="900"> <!-- refresh every 15 minutes -->
22
+
23
+    <link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-57x57.png">
24
+    <link rel="apple-touch-icon" sizes="60x60" href="/apple-touch-icon-60x60.png">
25
+    <link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-72x72.png">
26
+    <link rel="apple-touch-icon" sizes="76x76" href="/apple-touch-icon-76x76.png">
27
+    <link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114x114.png">
28
+    <link rel="apple-touch-icon" sizes="120x120" href="/apple-touch-icon-120x120.png">
29
+    <link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144x144.png">
30
+    <link rel="apple-touch-icon" sizes="152x152" href="/apple-touch-icon-152x152.png">
31
+    <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon-180x180.png">
32
+    <link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32">
33
+    <link rel="icon" type="image/png" href="/favicon-194x194.png" sizes="194x194">
34
+    <link rel="icon" type="image/png" href="/favicon-96x96.png" sizes="96x96">
35
+    <link rel="icon" type="image/png" href="/android-chrome-192x192.png" sizes="192x192">
36
+    <link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16">
37
+    <link rel="manifest" href="/manifest.json">
38
+    <meta name="msapplication-TileColor" content="#2b5797">
39
+    <meta name="msapplication-TileImage" content="/mstile-144x144.png">
40
+    <meta name="theme-color" content="#ffffff">
41
+
42
+    <meta charset="UTF-8">
43
+    <meta name="viewport" content="width=device-width, initial-scale=1">
44
+
45
+    <title>Catholic Feeds - Headlines</title>
46
+    <link rel="stylesheet" href="headline-style.css">
47
+    <!-- Piwik -->
48
+    <script type="text/javascript">
49
+      var _paq = _paq || [];
50
+      _paq.push(['trackPageView']);
51
+      _paq.push(['enableLinkTracking']);
52
+      (function() {
53
+       var u="//piwik.elangley.org/";
54
+       _paq.push(['setTrackerUrl', u+'piwik.php']);
55
+       _paq.push(['setSiteId', 1]);
56
+       var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
57
+       g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
58
+       })();
59
+     </script>
60
+     <noscript><p><img src="//piwik.elangley.org/piwik.php?idsite=1" style="border:0;" alt="" /></p></noscript>
61
+     <!-- End Piwik Code -->
62
+
63
+   </head>
64
+   <body>
65
+     <div id="fb-root"></div>
66
+     <script>(function(d, s, id) {
67
+       var js, fjs = d.getElementsByTagName(s)[0];
68
+       if (d.getElementById(id)) return;
69
+       js = d.createElement(s); js.id = id;
70
+       js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5&appId=897925460261572";
71
+       fjs.parentNode.insertBefore(js, fjs);
72
+       }(document, 'script', 'facebook-jssdk'));</script>
73
+
74
+     <h1>Headlines</h1>
75
+     <main>
76
+     %s
77
+     </main>
78
+   </body>
79
+ </html>
23 80
 """
24 81
 
25 82
 colTemplate = """
... ...
@@ -29,10 +86,10 @@ colTemplate = """
29 86
 """
30 87
 
31 88
 item = """
32
-<article>
33
-<a href="%s" rel="nofollow">
34
-<h2>%s</h2>
35
-<span class="source">%s %s</span>
89
+<article data-v="%(score)s" data-date="%(date)s">
90
+<a href="%(url)s" rel="nofollow">
91
+<h2>%(title)s</h2>
92
+<span class="source">%(author)s %(feed)s</span>
36 93
 </a>
37 94
 </article>
38 95
 """
... ...
@@ -42,11 +99,12 @@ def safe_strftime(obj, format):
42 99
    ASCII-encoded HTML."""
43 100
    u = unicode(obj.strftime(format), get_system_encoding())
44 101
    return encode_references(u)
102
+import itertools
45 103
 
46 104
 class HeadlineOutput:
47 105
   def __init__(self):
48 106
     self.filename = "output/headlines.html"
49
-    self.headlines = 200
107
+    self.headlines = 120
50 108
     self.titles = []
51 109
 
52 110
   def config_option(self, config, name, value):
... ...
@@ -61,16 +119,59 @@ class HeadlineOutput:
61 119
 
62 120
   def output_write_files(self, rawdog, config, articles, article_dates):
63 121
     output = title_list
64
-    items = [[]]
65
-    for article in list(reversed(sorted(articles, key=article_dates.get)))[:self.headlines]:
122
+    items = [[], [], []]
123
+    titles = []
124
+    articles = list(reversed(sorted(articles, key=article_dates.get)))
125
+    article_info = []
126
+    title_words = {}
127
+    authors = {}
128
+    for article in articles:
66 129
       ei = article.entry_info
67 130
       articleTitle = ei['title']
68 131
       articleLink = ei['link']
69 132
       articleAuthor = "%s &mdash;" % ei.get('author', "")
70 133
       feedTitle = rawdog.feeds[article.feed].feed_info['title']
71
-      items[-1].append(item % (articleLink, articleTitle,articleAuthor,  feedTitle))
72
-      if len(items[-1]) >= self.headlines/3:
73
-        items.append([]);
134
+
135
+      for word in articleTitle.split():
136
+        if len(word) <= 3:
137
+          title_words[word] = 0
138
+        else:
139
+          title_words[word] = title_words.get(word, 0) + 1
140
+
141
+      authors[articleAuthor] = 1
142
+      article_info.append(dict(url=articleLink,title=articleTitle,author=articleAuthor,feed=feedTitle,date=datetime.datetime.fromtimestamp(article_dates[article]).isoformat(), article=article))
143
+
144
+    reftime = time.time()
145
+    article_info = article_info[:self.headlines]
146
+    def sort_key(x):
147
+      words = x['title'].split()
148
+      score = 0
149
+      score += authors.get(x['author'],0)
150
+      for word in words:
151
+        score += title_words.get(word,0)
152
+      score += (reftime - article_dates[x['article']]) / 10000
153
+      x['score'] = score
154
+      return score
155
+
156
+    article_info = sorted(article_info, key=sort_key)
157
+    buckets = {}
158
+    #for itm in article_info:
159
+    #  buckets.setdefault(sort_key(itm),[]).append(itm)
160
+
161
+    #article_info = []
162
+    #keys = itertools.cycle(sorted(buckets.keys()))
163
+    #while buckets != {}:
164
+    #  key = keys.next()
165
+    #  cur_list = buckets.get(key)
166
+    #  if cur_list is None: continue
167
+    #  article_info.append(cur_list.pop(0))
168
+    #  if cur_list == []:
169
+    #    del buckets[key]
170
+
171
+
172
+    print map(sort_key, article_info)
173
+    for idx, article_datum in enumerate(article_info[:self.headlines]):
174
+      items[idx % 3].append(item % article_datum)
74 175
       
75 176
     while len(items) > 3:
76 177
       print "This should be empty:", items.pop()
... ...
@@ -78,7 +179,7 @@ class HeadlineOutput:
78 179
     with open(self.filename, "w") as f:
79 180
       print "Writing headlines to: %s" % self.filename
80 181
       f.write(output.encode('utf-8'))
81
-    return True
182
+    return False
82 183
 
83 184
 
84 185
 
... ...
@@ -1,3 +1,4 @@
1
+
1 2
 server {
2 3
 	 server_name planet.joinmarrow.com;
3 4
 	 access_log /var/log/nginx/planet.joinmarrow.com.access.log combined;
... ...
@@ -5,7 +6,7 @@ server {
5 6
 
6 7
 	 root /home/edwlan/.rawdog/output;
7 8
     try_files $uri.html $uri $uri/ @notfound;
8
-	 index index.html;
9
+	 index headlines.html;
9 10
 
10 11
     listen 80;
11 12
 #	 auth_basic "Restricted";
... ...
@@ -9,29 +9,47 @@
9 9
     <link rel="stylesheet" href="style.css" type="text/css">
10 10
     <link rel="alternate" href="http://planet.joinmarrow.com/rss20.xml" type="application/rss+xml" title="Catholic Feeds">
11 11
     <title>Catholic Feeds!</title>
12
-  </head>
13
-  <body id="rawdog">
14
-    <div id="header">
15
-      <h1>Various Catholic Feeds</h1>
16
-    </div>
17
-    <div id="items">
18
-      __items__
19
-    </div>
20
-    <h2 id="feedstatsheader">Feeds</h2>
21
-    <div id="feedstats">
22
-      __feeds__
23
-    </div>
24
-    <div id="footer">
25
-      <p id="aboutrawdog">Generated by
26
-      <a href="http://offog.org/code/rawdog.html">rawdog</a>
27
-      version __version__
28
-      by <a href="mailto:ats@offog.org">Adam Sampson</a>.</p>
29
-    </div>
30
-    <div id="calendar">
31
-      <div class="titlebar">Archives...</div>
32
-      <div class="content">
33
-        __dated_output_calendars__
34
-      </div>
35
-    </div>
36
-  </body>
37
-</html>
12
+   </head>
13
+   <body id="rawdog">
14
+     <div id="header">
15
+       <h1>Various Catholic Feeds</h1>
16
+     </div>
17
+     <div id="items">
18
+       __items__
19
+     </div>
20
+     <h2 id="feedstatsheader">Feeds</h2>
21
+     <div id="feedstats">
22
+       __feeds__
23
+     </div>
24
+     <div id="footer">
25
+       <p id="aboutrawdog">Generated by
26
+       <a href="http://offog.org/code/rawdog.html">rawdog</a>
27
+       version __version__
28
+       by <a href="mailto:ats@offog.org">Adam Sampson</a>.</p>
29
+     </div>
30
+     <div id="calendar">
31
+       <div class="titlebar">Archives...</div>
32
+       <div class="content">
33
+         __dated_output_calendars__
34
+       </div>
35
+     </div>
36
+     <!-- Piwik -->
37
+     <script type="text/javascript">
38
+       var _paq = _paq || [];
39
+       _paq.push(["setDocumentTitle", document.domain + "/" + document.title]);
40
+       _paq.push(["setCookieDomain", "*.joinmarrow.com"]);
41
+       _paq.push(["setDomains", ["*.joinmarrow.com"]]);
42
+       _paq.push(['trackPageView']);
43
+       _paq.push(['enableLinkTracking']);
44
+       (function() {
45
+        var u="//piwik.elangley.org/";
46
+        _paq.push(['setTrackerUrl', u+'piwik.php']);
47
+        _paq.push(['setSiteId', 2]);
48
+        var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
49
+        g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
50
+        })();
51
+      </script>
52
+      <noscript><p><img src="//piwik.elangley.org/piwik.php?idsite=2" style="border:0;" alt="" /></p></noscript>
53
+      <!-- End Piwik Code -->
54
+    </body>
55
+ </html>