Skip to content

Commit 026588f

Browse files
committed
GH-65: Check for the existence of the base option
1 parent efa909b commit 026588f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/thumbnails/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
DEFAULT_BASE = ""
1+
DEFAULT_BASE = None
22
DEFAULT_SKIP = False
33
DEFAULT_OUTPUT = None
44
DEFAULT_FORMAT = "vtt"

src/thumbnails/thumbnail.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def format_time(secs):
119119
return ("0%s.000" % delta)[:12]
120120

121121
metadata = ["WEBVTT\n\n"]
122-
prefix = self.base or os.path.relpath(self.thumbnail_dir)
122+
prefix = self.base if self.base is not None else os.path.relpath(self.thumbnail_dir)
123123
route = os.path.join(prefix, extract_name(self.filepath) + ".png")
124124
route = pathlib.Path(route).as_posix()
125125

@@ -157,8 +157,8 @@ def generate(self):
157157
with Progress("Saving thumbnail metadata at '%s'" % self.metadata_path):
158158
for frame, start, *_ in self.thumbnails():
159159
frame = os.path.join(self.thumbnail_dir, os.path.basename(frame))
160-
base = os.path.join(self.base, os.path.basename(self.thumbnail_dir))
161-
prefix = base if self.base else os.path.relpath(self.thumbnail_dir)
160+
base = os.path.join(self.base or "", os.path.basename(self.thumbnail_dir))
161+
prefix = base if self.base is not None else os.path.relpath(self.thumbnail_dir)
162162
route = os.path.join(prefix, os.path.basename(frame))
163163
route = pathlib.Path(route).as_posix()
164164
thumbnail_data = {

0 commit comments

Comments
 (0)