aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclarkzjw <[email protected]>2018-01-11 20:54:06 +0800
committerclarkzjw <[email protected]>2018-01-11 20:54:06 +0800
commit866436c73338c2d0caa0cb35dff4949048943fee (patch)
tree7c8a37f83f755c7badd982d1bb2f950c40556393
parent78760ab08d1d2ca51004934ac8ff690be38fd7ce (diff)
downloadblog.jinwei.me-866436c73338c2d0caa0cb35dff4949048943fee.tar.gz
+ add rss
-rw-r--r--Dockerfile2
-rw-r--r--Makefile5
-rw-r--r--_posts/2017/12/movies.rst2
-rw-r--r--rss.py15
-rw-r--r--rss.xml94
5 files changed, 105 insertions, 13 deletions
diff --git a/Dockerfile b/Dockerfile
index be6aae8..9560268 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -14,7 +14,7 @@ ADD . /app
14 14
15WORKDIR /app 15WORKDIR /app
16 16
17RUN /bin/bash -c "source /app/.venv/bin/activate && make html" 17RUN /bin/bash -c "source /app/.venv/bin/activate && make html && make rss"
18 18
19 19
20FROM alpine:latest 20FROM alpine:latest
diff --git a/Makefile b/Makefile
index 6a109aa..223cadf 100644
--- a/Makefile
+++ b/Makefile
@@ -12,9 +12,12 @@ BUILDDIR = _build
12help: 12help:
13 @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 13 @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14 14
15rss:
16 python rss.py > rss.xml
17
15.PHONY: help Makefile 18.PHONY: help Makefile
16 19
17# Catch-all target: route all unknown targets to Sphinx using the new 20# Catch-all target: route all unknown targets to Sphinx using the new
18# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 21# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19%: Makefile 22%: Makefile
20 @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file 23 @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
diff --git a/_posts/2017/12/movies.rst b/_posts/2017/12/movies.rst
index 94ecee5..6be761d 100644
--- a/_posts/2017/12/movies.rst
+++ b/_posts/2017/12/movies.rst
@@ -6,7 +6,7 @@
62017观影记录 62017观影记录
7=================== 7===================
8 8
9:Publish Date: 2010-01-01 9:Publish Date: 2017-12-30
10 10
112017年马上就结束了。掐指一算,2017年看了好多电影。包括线上和线下电影院的。 112017年马上就结束了。掐指一算,2017年看了好多电影。包括线上和线下电影院的。
12 12
diff --git a/rss.py b/rss.py
index faa004c..fdf4b53 100644
--- a/rss.py
+++ b/rss.py
@@ -26,12 +26,6 @@ def render_template(cwd, template_path, context):
26 return env.get_template(template_path).render(context) 26 return env.get_template(template_path).render(context)
27 27
28 28
29def _remove_attrs(soup):
30 for tag in soup.findAll(True):
31 tag.attrs = None
32 return soup
33
34
35def main(): 29def main():
36 30
37 filenames = glob.glob("./_build/html/_posts/*/*/*.html") 31 filenames = glob.glob("./_build/html/_posts/*/*/*.html")
@@ -41,11 +35,12 @@ def main():
41 35
42 for p in filenames: 36 for p in filenames:
43 soup = BeautifulSoup(open(p), "html5lib") 37 soup = BeautifulSoup(open(p), "html5lib")
44 body = soup.find_all("div", class_="body") 38 body = soup.find_all("div", class_="body")[0].text
39
45 posts.append({ 40 posts.append({
46 "title": soup.title.string, 41 "title": soup.title.string,
47 "body": body[0].text, 42 "body": body,
48 "date_rss": "", 43 "date_rss": body[body.find("Publish Date:")+13:body.find("Publish Date:")+23],
49 "permalink": "/".join(p.split("/")[3:]) 44 "permalink": "/".join(p.split("/")[3:])
50 }) 45 })
51 46
@@ -53,7 +48,7 @@ def main():
53 "site": { 48 "site": {
54 "name": "Hello World", 49 "name": "Hello World",
55 "url": "https://blog.jinwei.me", 50 "url": "https://blog.jinwei.me",
56 "tagline": "Freedom is my birthright and I shall have it." 51 "tagline": "Freedom is my birth right and I shall have it."
57 }, 52 },
58 "posts": posts 53 "posts": posts
59 } 54 }
diff --git a/rss.xml b/rss.xml
new file mode 100644
index 0000000..6e8bbcd
--- /dev/null
+++ b/rss.xml
@@ -0,0 +1,94 @@
1['./_build/html/_posts/2017/12/movies.html']
2<?xml version="1.0" encoding="UTF-8"?>
3<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
4 <channel>
5 <title>Hello World</title>
6 <link>https://blog.jinwei.me</link>
7 <description>Freedom is my birth right and I shall have it.</description>
8 <atom:link href="https://blog.jinwei.me/rss" rel="self" type="application/rss+xml" />
9
10 <item>
11 <title>2017观影记录 — Hello World</title>
12 <description>
13
14
152017观影记录¶
16
17
18
19
20Publish Date:2010-01-01
21
22
23
242017年马上就结束了。掐指一算,2017年看了好多电影。包括线上和线下电影院的。
25线下电影院观影记录(按时间顺序,以中国大陆上映时的片名为准):
26
27星球大战外传:侠盗一号 (Rogue One: A Star Wars Story)
28太空旅客 (Passengers)
29降临 (Arrival)
30极限特工:终极回归 (xXx: The Return of Xander Cage)
31生化危机6:终章 (Resident Evil: The Final Chapter)
32金刚狼3:殊死一战 (Logan)
33攻壳机动队 (Ghost in the Shell)
34速度与激情8 (The Fate of the Furious)
35拆弹专家
36大护法
37战狼2
38星际特工:千星之城 (Valérian et la Cité des mille planètes)
39看不见的客人 (Contratiempo)
40英伦对决 (The Foreigner)
41天才枪手 (ฉลาดเกมส์โกง)
42王牌特工2:黄金圈 (Kingsman: The Golden Circle)
43全球风暴 (Geostorm)
44东方快车谋杀案 (Murder on the Orient Express)
45雷神3:诸神黄昏 (Thor: Ragnarok)
46追捕
47至暗时刻 (Darkest Hour)
48寻梦环游记 (Coco)
49至爱梵高·星空之谜 (Loving Vincent)
50芳华
51
52线上观影记录(包括BT下载以及Netflix,包括电影/纪录片/部分美剧,不完全):
53
54Blade Runner (1982)
55Blade Runner 2049
56Love Actually
57World War Z
58Dunkirk
59Everst
60霸王别姬
61Titanic
62隧道 (터널)
63London Has Fallen
64出租车司机 (택시운전사)
65Ocean’s Eleven
66Ocean’s Twelve
67Shooter
68Knight Day
692001: A Space Odyssey
70Minority Report
71Deep Impact
72Area 51
73San Andreas
74I, Origin
75Particle Fever
76City 40
77Stranger Things
78House Of Cards, Season 1
79
80现在回忆一下,很多电影的质量其实很一般,属于看完之后走出电影院差不多就能忘记剧情的那种。这种电影很多都是所谓的「商业大片」,追求特效和画面,完全不考虑剧情的质量和观众的观影感受。
81简单分析了一下,线下观影的统计
82
836月居然一部都没看,是因为工作太饱和了还是因为没有好看的电影呢?
84
85
86
87 </description>
88 <pubDate>2010-01-01</pubDate>
89 <link>https://blog.jinwei.me/_posts/2017/12/movies.html</link>
90 <guid isPermaLink="true">https://blog.jinwei.me/_posts/2017/12/movies.html</guid>
91 </item>
92
93 </channel>
94</rss>
Powered by cgit v1.2.3 (git 2.41.0)