Autogen. missing category pages

This commit is contained in:
2022-07-08 16:45:17 +02:00
parent 2a8f563a63
commit bf438c75f3
2 changed files with 37 additions and 14 deletions

View File

@ -10,6 +10,7 @@
import json
import os
from datetime import datetime
from pathlib import Path
def ReadFile(p):
try:
@ -35,6 +36,13 @@ def FileToStr(File, Truncate=''):
def IgnoreFiles(Dir, Files):
return [f for f in Files if os.path.isfile(os.path.join(Dir, f))]
def LoadFromDir(Dir, Rglob):
Contents = {}
for File in Path(Dir).rglob(Rglob):
File = str(File)[len(Dir)+1:]
Contents.update({File: ReadFile('{}/{}'.format(Dir, File))})
return Contents
def StripExt(Path):
return ".".join(Path.split('.')[:-1])