Alphabetize _reload_audio_metadata.
This commit is contained in:
parent
d15e8325aa
commit
0864572930
1 changed files with 15 additions and 15 deletions
|
@ -1216,6 +1216,21 @@ class Photo(ObjectBase):
|
||||||
new_path.assert_not_exists()
|
new_path.assert_not_exists()
|
||||||
self.rename_file(new_path.absolute_path, move=True)
|
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):
|
def _reload_image_metadata(self):
|
||||||
try:
|
try:
|
||||||
image = PIL.Image.open(self.real_path.absolute_path)
|
image = PIL.Image.open(self.real_path.absolute_path)
|
||||||
|
@ -1243,21 +1258,6 @@ class Photo(ObjectBase):
|
||||||
self.height = probe.video.video_height
|
self.height = probe.video.video_height
|
||||||
self.duration = probe.format.duration or probe.video.duration
|
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')
|
@decorators.required_feature('photo.reload_metadata')
|
||||||
@worms.atomic
|
@worms.atomic
|
||||||
def reload_metadata(self, hash_kwargs=None) -> None:
|
def reload_metadata(self, hash_kwargs=None) -> None:
|
||||||
|
|
Loading…
Reference in a new issue