diff --git a/etiquette/objects.py b/etiquette/objects.py index 10fa967..9f946f4 100644 --- a/etiquette/objects.py +++ b/etiquette/objects.py @@ -1216,6 +1216,21 @@ class Photo(ObjectBase): new_path.assert_not_exists() self.rename_file(new_path.absolute_path, move=True) + def _reload_audio_metadata(self): + if not constants.ffmpeg: + return + + try: + probe = constants.ffmpeg.probe(self.real_path.absolute_path) + except Exception: + traceback.print_exc() + return + + if not probe or not probe.audio: + return + + self.duration = probe.audio.duration + def _reload_image_metadata(self): try: image = PIL.Image.open(self.real_path.absolute_path) @@ -1243,21 +1258,6 @@ class Photo(ObjectBase): self.height = probe.video.video_height self.duration = probe.format.duration or probe.video.duration - def _reload_audio_metadata(self): - if not constants.ffmpeg: - return - - try: - probe = constants.ffmpeg.probe(self.real_path.absolute_path) - except Exception: - traceback.print_exc() - return - - if not probe or not probe.audio: - return - - self.duration = probe.audio.duration - @decorators.required_feature('photo.reload_metadata') @worms.atomic def reload_metadata(self, hash_kwargs=None) -> None: