aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorctucx <leah@antifa.jetzt>2020-06-17 01:19:13 +0200
committerctucx <leah@antifa.jetzt>2020-06-17 01:19:13 +0200
commita4f17414c016977282398d0b358f4e7901ea98dc (patch)
tree630c15fed6a8d12b73fda879c24b2065b8cf416f
parentfbe7a7ee76f741f8dcf6ca53bb06ff513e7d600b (diff)
downloadgallery-a4f17414c016977282398d0b358f4e7901ea98dc.tar.gz
gallery-a4f17414c016977282398d0b358f4e7901ea98dc.tar.bz2
gallery-a4f17414c016977282398d0b358f4e7901ea98dc.zip
temp fix
-rw-r--r--src/gallery.nim30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/gallery.nim b/src/gallery.nim
index cbbb045..7b4822f 100644
--- a/src/gallery.nim
+++ b/src/gallery.nim
@@ -100,28 +100,31 @@ proc placeAssets(targetDir: string, enableJS: bool) =
proc removeOrphans (sourceDir: string, targetDir: string) =
#Albums
- for element in walkDir(targetDir):
- if element.kind != pcDir: continue
+ for album in walkDir(targetDir):
+ if album.kind != pcDir: continue
var targetDir = targetDir
normalizePath(targetDir)
- var dirname = element.path.replace(targetDir & "/", "")
+
+ var dirname = album.path.replace(targetDir & "/", "")
if dirname == "thumbnails": continue
if dirname == "medium": continue
- if not dirExists(joinPath(sourceDir, dirname)):
- removeDir(joinPath(targetDir, dirname))
+ #echo dirname
+ #if not dirExists(joinPath(sourceDir, dirname)):
+ # removeDir(joinPath(targetDir, dirname))
#Photos
- for element in walkDir(joinPath(targetDir, "medium")):
- let (dir, name, ext) = splitFile(element.path)
+ for photo in walkDir(joinPath(targetDir, "medium")):
+ let (dir, name, ext) = splitFile(photo.path)
let filename = name & ext
- if not fileExists(joinPath(sourceDir, filename)):
- removeFile(joinPath(targetDir, name & ".html"))
- removeFile(joinPath(targetDir, "medium", filename))
- removeFile(joinPath(targetDir, "thumbnails", name & ".png"))
+ echo joinPath(sourceDir, filename)
+ #if not fileExists(joinPath(sourceDir, filename)):
+ # removeFile(joinPath(targetDir, name & ".html"))
+ # removeFile(joinPath(targetDir, "medium", filename))
+ # removeFile(joinPath(targetDir, "thumbnails", name & ".png"))
proc generateWebsite(sourceDir: string, targetDir: string, album: Album, config: JsonNode) =
@@ -151,8 +154,7 @@ proc generateWebsite(sourceDir: string, targetDir: string, album: Album, config:
for subalbum in album.subalbums:
generateWebsite(sourceDir, joinPath(targetDir, subalbum.name), subalbum, config)
- removeOrphans(joinPath(sourceDir, subalbum.name), joinPath(targetDir, subalbum.name))
-
+# removeOrphans(joinPath(sourceDir, subalbum.name), joinPath(targetDir, subalbum.name))
var thumbnail1 = "/no_images.svg"
var thumbnail2 = "/no_images.svg"
@@ -216,7 +218,7 @@ proc generateWebsite(sourceDir: string, targetDir: string, album: Album, config:
echo "Generate album page!\n"
writeFile(joinPath(targetDir, "index.html"), render(asset_album_html, templateContext))
- removeOrphans(sourceDir, targetDir)
+# removeOrphans(sourceDir, targetDir)
proc main =