Remove build index.html and Add folder ignore
This commit is contained in:
parent
99d7295f0c
commit
9e61df8669
3 changed files with 39 additions and 26 deletions
|
|
@ -25,10 +25,12 @@ class Fragments:
|
||||||
self.ignore = ['.ignore']
|
self.ignore = ['.ignore']
|
||||||
|
|
||||||
self.ignore_file = '.ignore'
|
self.ignore_file = '.ignore'
|
||||||
self.index_file = 'test_data/index.json'
|
self.index_file = 'index.json'
|
||||||
|
|
||||||
if os.path.isfile(self.index_file):
|
def init_json(self, directory):
|
||||||
with open(self.index_file) as json_file:
|
index_path = os.path.join(directory, self.index_file)
|
||||||
|
if os.path.isfile(index_path):
|
||||||
|
with open(index_path) as json_file:
|
||||||
self.json_data = json.load(json_file)
|
self.json_data = json.load(json_file)
|
||||||
|
|
||||||
self.temp_data = {"fragments":[]}
|
self.temp_data = {"fragments":[]}
|
||||||
|
|
@ -92,9 +94,19 @@ class Fragments:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def preindex(self, directory):
|
def preindex(self, directory):
|
||||||
|
self.init_json(directory)
|
||||||
for root, dirs, files in os.walk(directory):
|
for root, dirs, files in os.walk(directory):
|
||||||
self.add_ignore(root)
|
self.add_ignore(root)
|
||||||
|
|
||||||
|
print(root)
|
||||||
|
|
||||||
arr = root.split("/")
|
arr = root.split("/")
|
||||||
|
|
||||||
|
print(arr[2])
|
||||||
|
|
||||||
|
if arr[2] in self.ignore:
|
||||||
|
pass # ignore 폴더 처리
|
||||||
|
else:
|
||||||
# 2뎁스까지만 인덱스 함.
|
# 2뎁스까지만 인덱스 함.
|
||||||
if arr.__len__() < 4:
|
if arr.__len__() < 4:
|
||||||
# files index
|
# files index
|
||||||
|
|
@ -112,6 +124,8 @@ class Fragments:
|
||||||
for d in dirs:
|
for d in dirs:
|
||||||
if self.has_meta(root, d):
|
if self.has_meta(root, d):
|
||||||
self.occupancy(root, d)
|
self.occupancy(root, d)
|
||||||
|
elif d in self.ignore:
|
||||||
|
pass
|
||||||
else:
|
else:
|
||||||
self.add_timetable(root, d)
|
self.add_timetable(root, d)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
# 2020. 10. 26
|
# 2020. 10. 26
|
||||||
from distribusi.cli import build_argparser, distribusify
|
from distribusi.cli import build_argparser, distribusify
|
||||||
from distribusi import fragments
|
from distribusi import fragments
|
||||||
from distribusi.distribusi import build_index
|
|
||||||
|
|
||||||
parser = build_argparser()
|
parser = build_argparser()
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
@ -14,5 +13,3 @@ freg.preindex(data_path)
|
||||||
freg.postindex()
|
freg.postindex()
|
||||||
|
|
||||||
distribusify(args, data_path, freg)
|
distribusify(args, data_path, freg)
|
||||||
|
|
||||||
build_index(args, data_path, freg)
|
|
||||||
|
|
@ -6,3 +6,5 @@ participants.html
|
||||||
fragment.html
|
fragment.html
|
||||||
home.html
|
home.html
|
||||||
intorudction.json
|
intorudction.json
|
||||||
|
src
|
||||||
|
index.json
|
||||||
Loading…
Reference in a new issue