X-Git-Url: https://git.mdrn.pl/audio.git/blobdiff_plain/c84a8c9ad465608d565821914169f19f30b3b2c3..811a5e0c009907cba39afcd954b3644f46adcec7:/src/archive/forms.py diff --git a/src/archive/forms.py b/src/archive/forms.py index 22c426e..3b68c28 100644 --- a/src/archive/forms.py +++ b/src/archive/forms.py @@ -7,6 +7,7 @@ from django.utils.translation import gettext_lazy as _ import mutagen from django.utils.encoding import force_bytes +from youtube.utils import get_duration from archive.models import Audiobook from archive.settings import FILES_PATH, NEW_PATH from archive.utils import ExistingFile, sha1_file @@ -31,6 +32,7 @@ class AudiobookForm(forms.ModelForm): # save the file in model abs_path = os.path.join(NEW_PATH, path) + m.duration = get_duration(abs_path) m.source_file.save( path, ExistingFile(abs_path))