mirror of
https://github.com/mediacms-io/mediacms.git
synced 2025-11-05 23:18:53 -05:00
fix: delete media (#1366)
This commit is contained in:
parent
817e16ac60
commit
7a1b32f1ba
@ -124,7 +124,9 @@ migrations_1 | Created admin user with password: gwg1clfkwf
|
|||||||
|
|
||||||
or if you have set the ADMIN_PASSWORD variable on docker-compose file you have used (example `docker-compose.yaml`), that variable will be set as the admin user's password
|
or if you have set the ADMIN_PASSWORD variable on docker-compose file you have used (example `docker-compose.yaml`), that variable will be set as the admin user's password
|
||||||
|
|
||||||
`Note`: if you want to use the automatic transcriptions, run `docker-compose -f docker-compose.yaml -f docker-compose.full.yaml up` instead, as this is using a separate image.
|
`Note`: if you want to use the automatic transcriptions, you have to do one of the following:
|
||||||
|
* either use the docker-compose.full.yaml, so in this case run `docker-compose -f docker-compose.yaml -f docker-compose.full.yaml up`
|
||||||
|
* or edit the docker-compose.yaml file and set the image for the celery_worker service as mediacms/mediacms:full instead of mediacms/mediacms:latest
|
||||||
|
|
||||||
|
|
||||||
### Update
|
### Update
|
||||||
@ -1008,7 +1010,7 @@ When the whisper transcribe task is triggered for a media file, MediaCMS runs th
|
|||||||
|
|
||||||
### Configuration
|
### Configuration
|
||||||
|
|
||||||
Transcription functionality is available only for the Docker installation. To enable this feature, you must use the `docker-compose.full.yaml` file, as it contains an image with the necessary requirements.
|
Transcription functionality is available only for the Docker installation. To enable this feature, you must either use the `docker-compose.full.yaml` file, as it contains an image with the necessary requirements, or you can also set that celery_worker service is usine mediacms:full image instead of mediacms:latest.
|
||||||
|
|
||||||
By default, all users have the ability to send a request for a video to be transcribed, as well as transcribed and translated to English. If you wish to change this behavior, you can edit the `settings.py` file and set `USER_CAN_TRANSCRIBE_VIDEO=False`.
|
By default, all users have the ability to send a request for a video to be transcribed, as well as transcribed and translated to English. If you wish to change this behavior, you can edit the `settings.py` file and set `USER_CAN_TRANSCRIBE_VIDEO=False`.
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
from crispy_forms.bootstrap import FormActions
|
from crispy_forms.bootstrap import FormActions
|
||||||
from crispy_forms.helper import FormHelper
|
from crispy_forms.helper import FormHelper
|
||||||
from crispy_forms.layout import Field, Layout, Submit
|
from crispy_forms.layout import HTML, Field, Layout, Submit
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
@ -241,6 +241,8 @@ class WhisperSubtitlesForm(forms.ModelForm):
|
|||||||
self.fields['allow_whisper_transcribe_and_translate'].widget.attrs['readonly'] = True
|
self.fields['allow_whisper_transcribe_and_translate'].widget.attrs['readonly'] = True
|
||||||
self.fields['allow_whisper_transcribe_and_translate'].widget.attrs['disabled'] = True
|
self.fields['allow_whisper_transcribe_and_translate'].widget.attrs['disabled'] = True
|
||||||
|
|
||||||
|
both_readonly = self.instance.allow_whisper_transcribe and self.instance.allow_whisper_transcribe_and_translate
|
||||||
|
|
||||||
self.helper = FormHelper()
|
self.helper = FormHelper()
|
||||||
self.helper.form_tag = True
|
self.helper.form_tag = True
|
||||||
self.helper.form_class = 'post-form'
|
self.helper.form_class = 'post-form'
|
||||||
@ -252,7 +254,13 @@ class WhisperSubtitlesForm(forms.ModelForm):
|
|||||||
CustomField('allow_whisper_transcribe_and_translate'),
|
CustomField('allow_whisper_transcribe_and_translate'),
|
||||||
)
|
)
|
||||||
|
|
||||||
self.helper.layout.append(FormActions(Submit('submit_whisper', 'Submit', css_class='primaryAction')))
|
if not both_readonly:
|
||||||
|
self.helper.layout.append(FormActions(Submit('submit_whisper', 'Submit', css_class='primaryAction')))
|
||||||
|
else:
|
||||||
|
# Optional: Add a disabled button with explanatory text
|
||||||
|
self.helper.layout.append(
|
||||||
|
FormActions(Submit('submit_whisper', 'Submit', css_class='primaryAction', disabled=True), HTML('<small class="text-muted">Cannot submit - both options are already enabled</small>'))
|
||||||
|
)
|
||||||
|
|
||||||
def clean_allow_whisper_transcribe(self):
|
def clean_allow_whisper_transcribe(self):
|
||||||
# Ensure the field value doesn't change if it was originally True
|
# Ensure the field value doesn't change if it was originally True
|
||||||
|
|||||||
@ -235,6 +235,8 @@ class Media(models.Model):
|
|||||||
self.__original_media_file = self.media_file
|
self.__original_media_file = self.media_file
|
||||||
self.__original_thumbnail_time = self.thumbnail_time
|
self.__original_thumbnail_time = self.thumbnail_time
|
||||||
self.__original_uploaded_poster = self.uploaded_poster
|
self.__original_uploaded_poster = self.uploaded_poster
|
||||||
|
self.__original_allow_whisper_transcribe = self.allow_whisper_transcribe
|
||||||
|
self.__original_allow_whisper_transcribe_and_translate = self.allow_whisper_transcribe_and_translate
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
if not self.title:
|
if not self.title:
|
||||||
@ -275,6 +277,17 @@ class Media(models.Model):
|
|||||||
if self.thumbnail_time != self.__original_thumbnail_time:
|
if self.thumbnail_time != self.__original_thumbnail_time:
|
||||||
self.__original_thumbnail_time = self.thumbnail_time
|
self.__original_thumbnail_time = self.thumbnail_time
|
||||||
self.set_thumbnail(force=True)
|
self.set_thumbnail(force=True)
|
||||||
|
|
||||||
|
transcription_changed = (
|
||||||
|
self.allow_whisper_transcribe != self.__original_allow_whisper_transcribe or self.allow_whisper_transcribe_and_translate != self.__original_allow_whisper_transcribe_and_translate
|
||||||
|
)
|
||||||
|
|
||||||
|
if transcription_changed and self.media_type == "video":
|
||||||
|
self.transcribe_function()
|
||||||
|
|
||||||
|
# Update the original values for next comparison
|
||||||
|
self.__original_allow_whisper_transcribe = self.allow_whisper_transcribe
|
||||||
|
self.__original_allow_whisper_transcribe_and_translate = self.allow_whisper_transcribe_and_translate
|
||||||
else:
|
else:
|
||||||
# media is going to be created now
|
# media is going to be created now
|
||||||
# after media is saved, post_save signal will call media_init function
|
# after media is saved, post_save signal will call media_init function
|
||||||
@ -989,8 +1002,6 @@ def media_save(sender, instance, created, **kwargs):
|
|||||||
tag.update_tag_media()
|
tag.update_tag_media()
|
||||||
|
|
||||||
instance.update_search_vector()
|
instance.update_search_vector()
|
||||||
if instance.media_type == "video":
|
|
||||||
instance.transcribe_function()
|
|
||||||
|
|
||||||
|
|
||||||
@receiver(pre_delete, sender=Media)
|
@receiver(pre_delete, sender=Media)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user