Fixes a bug with indexing

This commit is contained in:
2025-08-12 08:46:00 -06:00
parent f695b71dce
commit b204ae5508
2 changed files with 24 additions and 7 deletions

View File

@@ -329,7 +329,9 @@ class Comic(ImageRepo, ABC):
:param strip: The comic strip to index
"""
with self._index_lock:
self.strip_index[strip.identifier] = strip.get_filename()
if not self.identifier in self.strip_index:
self.strip_index[self.identifier] = {}
self.strip_index[self.identifier][strip.identifier] = strip.get_filename()
def is_strip_present(self, base_path: Path, suffix: str, identifier) -> bool:
"""
@@ -340,9 +342,11 @@ class Comic(ImageRepo, ABC):
:param identifier: The identifier to check.
:returns: True if the strip file has been saved.
"""
if not identifier in self.strip_index:
if not self.identifier in self.strip_index:
return False
path = Path(base_path, self.strip_index[identifier] + suffix)
if not identifier in self.strip_index[self.identifier]:
return False
path = Path(base_path, self.strip_index[self.identifier][identifier] + suffix)
return path.exists()

View File

@@ -1,9 +1,22 @@
#!/bin/bash
# Copyright (c) 2025 Markil 3
# This CLI tool allows for the download and packaging of various internet comics into .cbz files.
# Copyright (C) 2025 Markil 3
# http://www.singlepilot.net
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
path=$(dirname $(realpath $0))
source "$path/venv/bin/activate"
"$path/xkcd.py" --output /mnt/MEDIA/Comics/xkcd -l
"$path/existential_comics.py" --output /mnt/MEDIA/Comics/existential_comics -l
"$path/bluesky.py" --handle fieldexplores.bsky.social --output /mnt/MEDIA/Comics/field_explores
python3 . --output /mnt/MEDIA/Comics/ -l xkcd.com existentialcomics.com bsky.app/profile/fieldexplores.bsky.social