mirror of
https://github.com/greflm13/StaticGalleryBuilder.git
synced 2026-02-05 11:09:26 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
7e23b3625a
|
@@ -40,6 +40,7 @@
|
||||
"--reverse-sort",
|
||||
"--regenerate-thumbnails",
|
||||
"--reread-metadata",
|
||||
"--folderthumbnails",
|
||||
],
|
||||
"console": "integratedTerminal",
|
||||
"name": "Testfolder",
|
||||
@@ -64,6 +65,7 @@
|
||||
"-m",
|
||||
// "--regenerate-thumbnails",
|
||||
// "--reread-metadata",
|
||||
"--folderthumbnails",
|
||||
],
|
||||
"console": "integratedTerminal",
|
||||
"name": "woek",
|
||||
@@ -99,7 +101,7 @@
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
},
|
||||
"[python]": {
|
||||
"editor.defaultFormatter": "ms-python.black-formatter",
|
||||
"editor.defaultFormatter": "charliermarsh.ruff",
|
||||
},
|
||||
"black-formatter.args": [
|
||||
"-l 260",
|
||||
@@ -151,6 +153,7 @@
|
||||
"yaml.schemas": {
|
||||
"https://raw.githubusercontent.com/pamburus/hl/master/schema/json/config.schema.json": "file:///home/user/git/github.com/greflm13/StaticGalleryBuilder/hl_config.yaml"
|
||||
},
|
||||
"ruff.lineLength": 180,
|
||||
},
|
||||
"tasks": {
|
||||
"version": "2.0.0",
|
||||
|
||||
20
builder.py
20
builder.py
@@ -3,6 +3,7 @@ import os
|
||||
import re
|
||||
import sys
|
||||
import shutil
|
||||
import urllib.error
|
||||
import urllib.parse
|
||||
import urllib.request
|
||||
from multiprocessing import Pool, freeze_support
|
||||
@@ -174,15 +175,18 @@ def main(args) -> None:
|
||||
|
||||
logger.info("getting logo from sorogon.eu")
|
||||
req = urllib.request.Request("https://files.sorogon.eu/logo.svg")
|
||||
with urllib.request.urlopen(req) as res:
|
||||
logo = res.read().decode()
|
||||
try:
|
||||
with urllib.request.urlopen(req, timeout=10) as res:
|
||||
logo = res.read().decode()
|
||||
|
||||
if logo.startswith("<?xml"):
|
||||
logo = re.sub(r"<\?xml.+\?>", "", logo).strip()
|
||||
if logo.startswith("<!--"):
|
||||
logo = re.sub(r"<!--.+-->", "", logo).strip()
|
||||
logo = logo.replace("\n", " ")
|
||||
logo = " ".join(logo.split())
|
||||
if logo.startswith("<?xml"):
|
||||
logo = re.sub(r"<\?xml.+\?>", "", logo).strip()
|
||||
if logo.startswith("<!--"):
|
||||
logo = re.sub(r"<!--.+-->", "", logo).strip()
|
||||
logo = logo.replace("\n", " ")
|
||||
logo = " ".join(logo.split())
|
||||
except urllib.error.URLError:
|
||||
logo = "</srgn>"
|
||||
|
||||
if args.reread_metadata:
|
||||
logger.warning("reread metadata flag is set to true, all image metadata will be reread")
|
||||
|
||||
Reference in New Issue
Block a user