folders optional
This commit is contained in:
@@ -92,13 +92,13 @@ class Mirva:
|
|||||||
path_list = [i["path"] for i in self.config["FOLDERS"]]
|
path_list = [i["path"] for i in self.config["FOLDERS"]]
|
||||||
if self.options.add_back:
|
if self.options.add_back:
|
||||||
if not ".." in path_list:
|
if not ".." in path_list:
|
||||||
self.config["FOLDERS"].insert(0, {"path": "..", "title": "Back", "thumb": '[guess]'})
|
self.config["FOLDERS"].insert(0, {"path": "..", "title": "Back", "thumb": "[guess]"})
|
||||||
config_changed = True
|
|
||||||
|
|
||||||
for d in self.folder_list:
|
|
||||||
if not d in path_list:
|
|
||||||
self.config["FOLDERS"].append({"path": d, "title": d, "thumb": '[guess]'})
|
|
||||||
config_changed = True
|
config_changed = True
|
||||||
|
if self.options.add_folders:
|
||||||
|
for d in self.folder_list:
|
||||||
|
if not d in path_list:
|
||||||
|
self.config["FOLDERS"].append({"path": d, "title": d, "thumb": "[guess]"})
|
||||||
|
config_changed = True
|
||||||
|
|
||||||
## IMAGES
|
## IMAGES
|
||||||
if not "IMAGES" in self.config:
|
if not "IMAGES" in self.config:
|
||||||
@@ -232,6 +232,12 @@ class Mirva:
|
|||||||
action="store_true",
|
action="store_true",
|
||||||
help="Add 'Back' link to parent folder.",
|
help="Add 'Back' link to parent folder.",
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--add-folders",
|
||||||
|
default=False,
|
||||||
|
action="store_true",
|
||||||
|
help="Add links to subfolders.",
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--purge",
|
"--purge",
|
||||||
default=False,
|
default=False,
|
||||||
@@ -378,8 +384,7 @@ Released : 20110306
|
|||||||
).format(image=image, title=title, content=content, med_dir=self.medium_dir)
|
).format(image=image, title=title, content=content, med_dir=self.medium_dir)
|
||||||
|
|
||||||
def get_folder(self, path, title, thumb):
|
def get_folder(self, path, title, thumb):
|
||||||
|
if thumb == "[guess]":
|
||||||
if thumb == '[guess]':
|
|
||||||
try:
|
try:
|
||||||
img = (
|
img = (
|
||||||
"style=\"background-image: url('"
|
"style=\"background-image: url('"
|
||||||
@@ -389,7 +394,11 @@ Released : 20110306
|
|||||||
self.resource_dir,
|
self.resource_dir,
|
||||||
"med",
|
"med",
|
||||||
sorted(
|
sorted(
|
||||||
[f for f in os.listdir(os.path.join(path, self.resource_dir, "med")) if f.endswith(".jpg")]
|
[
|
||||||
|
f
|
||||||
|
for f in os.listdir(os.path.join(path, self.resource_dir, "med"))
|
||||||
|
if f.endswith(".jpg")
|
||||||
|
]
|
||||||
)[0],
|
)[0],
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user