forked from kelu124/echomods
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathretire.py
59 lines (50 loc) · 1.45 KB
/
retire.py
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -------------------------
# (c) kelu124
# cc-by-sa/4.0/
# -------------------------
# Retirement
# -------------------------
'''Description: Retire old modules.'''
__author__ = "kelu124"
__copyright__ = "Copyright 2016, Kelu124"
__license__ = "cc-by-sa/4.0/"
import chardet
import os
import os.path, time
from glob import glob
import markdown
import re
import pyexiv2
import graphviz as gv
import functools
# Wand for SVG to PNG Conversion
from wand.api import library
import wand.color
import wand.image
import Image
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
from bs4 import BeautifulSoup
import urllib2
from datetime import datetime
path = "./"
results = [y for x in os.walk(path) for y in glob(os.path.join(x[0], '*.md'))]+[y for x in os.walk(path) for y in glob(os.path.join(x[0], '*.tpl'))]
ExcludeDirs = ["tools",".git","gh-pages","doc"]
f = [x for x in results if x.split("/")[1] not in ExcludeDirs]
for eachMd in f:
fileN = open(eachMd,"r+")
MDText = fileN.read()
print MDText
fileN.seek(0)
MDText = MDText.replace("(/tobo/","(/retired/tobo/")
MDText = MDText.replace("(/alt.tbo/","(/retired/alt.tbo/")
MDText = MDText.replace("(/cletus/","(/retired/cletus/")
MDText = MDText.replace("(/croaker/","(/retired/croaker/")
MDText = MDText.replace("(/loftus/","(/retired/loftus/")
MDText = MDText.replace("(/tomtom/","(/retired/tomtom/")
fileN.write(MDText)
fileN.truncate()
fileN.close()