From 0864572930952987a8b8b417c90bb7ef467b760e Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sat, 13 Aug 2022 18:09:53 -0700 Subject: [PATCH] Alphabetize _reload_audio_metadata. --- etiquette/objects.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) 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: