-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmakeLists.py
More file actions
77 lines (54 loc) · 1.72 KB
/
makeLists.py
File metadata and controls
77 lines (54 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -------------------------
# (c) kelu124
# cc-by-sa/4.0/
# -------------------------
from bs4 import BeautifulSoup
import re
import os
import urllib2
import html2text
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
Messages = []
for root, directories, filenames in os.walk('./'):
for filename in filenames:
#print os.path.join(root,filename)
if ((".md" in filename) or (".txt" in filename)) and ("-data" in root) and ("the_trove-raw" not in root):
Messages.append(os.path.join(root,filename) )
Wiki = "# Items in the Wiki\n\n"
BC2 = "# Items in Basecamp 2\n\n"
BC3 = "# Items in Basecamp 3\n\n"
Slack = "# Items in Slack\n\n"
PDF = "# Items in PDFs\n\n"
for item in Messages:
item = item[2:]
nom = item.split("/")[-1].split(".")[0]
print item + " " + nom
if "bc2-data" in item:
BC2 += "* ["+nom+"](https://echopen.gitbooks.io/the_trove/content/"+item.split(".")[0]+".html)\n"
if "bc3-data" in item:
BC3 += "* ["+nom+"](https://echopen.gitbooks.io/the_trove/content/"+item.split(".")[0]+".html)\n"
if "pdf-data" in item:
PDF += "* ["+nom+"](https://echopen.gitbooks.io/the_trove/content/"+item.split(".")[0]+".html)\n"
if "slack-data" in item:
Slack += "* ["+nom+"](https://echopen.gitbooks.io/the_trove/content/"+item.split(".")[0]+".html)\n"
if "wiki-data" in item:
Wiki += "* ["+nom+"](https://echopen.gitbooks.io/the_trove/content/"+item.split(".")[0]+".html)\n"
file = open("wiki.md", 'w')
file.write(Wiki)
file.close()
file = open("bc2.md", 'w')
file.write(BC2)
file.close()
file = open("bc3.md", 'w')
file.write(BC3)
file.close()
file = open("pdf.md", 'w')
file.write(PDF)
file.close()
file = open("slack.md", 'w')
file.write(Slack)
file.close()