diff --git a/mirva/__init__.py b/mirva/__init__.py index e91c25f..8090ba2 100644 --- a/mirva/__init__.py +++ b/mirva/__init__.py @@ -1,5 +1,4 @@ -__version__ = "20220124.0" -__version__ = "20211114.0" +__version__ = "20220328.0" def get_version(): diff --git a/mirva/mirva.py b/mirva/mirva.py index 6077910..d6f32f9 100755 --- a/mirva/mirva.py +++ b/mirva/mirva.py @@ -18,7 +18,9 @@ class Mirva: self.medium_dir = os.path.join(self.resource_dir, "med") self.config_file = os.path.join(self.resource_dir, "config.cfg") self.config_backup = os.path.join(self.resource_dir, "config.cfg.bkp") - self.image_match = re.compile(".*\.jpg$|.*\.jpeg$|.*\.png$|.*\.gif$|.*\.tif$", re.I) + self.image_match = re.compile( + ".*\.jpg$|.*\.jpeg$|.*\.png$|.*\.gif$|.*\.tif$", re.I + ) self.video_match = re.compile(".*\.mp4$", re.I) self.get_options() os.chdir(self.options.folder) @@ -26,7 +28,9 @@ class Mirva: self.file_list = self.get_files() if self.options.config or not os.path.exists(self.config_file): self.create_config() - print("Config created: Exiting without gallery creation. Check config first.") + print( + "Config created: Exiting without gallery creation. Check config first." + ) return self.get_config() if self.options.exif: @@ -88,7 +92,6 @@ class Mirva: with open(self.config_file, "wt") as fp: self.config.write(fp) - def get_files(self): image_match = re.compile(".*\.jpg$|.*\.jpeg$|.*\.png$|.*\.gif$|.*\.tif$", re.I) files = [] @@ -109,7 +112,10 @@ class Mirva: ) # parser.add_argument("-v", default=False, action="store_true") parser.add_argument( - "--config", default=False, action="store_true", help="Write config and exit. Required if more images are added." + "--config", + default=False, + action="store_true", + help="Write config and exit. Required if more images are added.", ) parser.add_argument( "--force", @@ -207,7 +213,7 @@ Released : 20110306
-
@@ -229,7 +235,6 @@ Released : 20110306 image=image, title=title, content=content, med_dir=self.medium_dir ) - def is_created_with_mirva(self): with open("index.html", "rt") as fp: @@ -242,7 +247,9 @@ Released : 20110306 if os.path.exists("index.html"): if not self.is_created_with_mirva(): - print("index.html exists, and it's not written with Mirva. Not overwriting.") + print( + "index.html exists, and it's not written with Mirva. Not overwriting." + ) sys.exit(1) with open("index.html", "wt") as fp: @@ -326,14 +333,14 @@ Released : 20110306 sys.stdout.write("\n") def append_exif(self): - exif_format = ''' + exif_format = """ - ''' + """ for f in self.config: if f in self.file_list: @@ -341,16 +348,20 @@ Released : 20110306 sys.stdout.flush() file_size = human_size(f) p = subprocess.run( - ['identify','-format',exif_format.format(size=file_size),"{}[0]".format(f)], - capture_output = True + [ + "identify", + "-format", + exif_format.format(size=file_size), + "{}[0]".format(f), + ], + capture_output=True, ) - self.config[f]['description'] += p.stdout.decode('utf-8') + self.config[f]["description"] += p.stdout.decode("utf-8") sys.stdout.write("\n") self.write_config() - def human_size(file_name, precision=1): size = os.path.getsize(file_name)