-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from jonasundderwolf/refactor-format
refactor: Modify format handling to avoid permanent migrations
- Loading branch information
Showing
19 changed files
with
367 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
__version__ = "1.0.1" | ||
__version__ = "1.1.0" | ||
|
||
default_app_config = "django_video_encoder.apps.DjangoVideoEncoderConfig" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class DjangoVideoEncoderConfig(AppConfig): | ||
name = "django_video_encoder" | ||
verbose_name = "Django Video Encoder" | ||
|
||
def ready(self): | ||
# Add System checks | ||
from .checks import check__formats # NOQA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from django.conf import settings | ||
from django.core import checks | ||
|
||
from django_video_encoder.models import Format | ||
|
||
|
||
@checks.register | ||
def check__formats(app_configs, **kwargs): | ||
if not hasattr(settings, "DJANGO_VIDEO_ENCODER_FORMATS"): | ||
return [checks.Error("No DJANGO_VIDEO_ENCODER_FORMATS defined in settings")] | ||
errors = [] | ||
encoder_list = [format for format, __ in Format.VIDEO_CODEC_CHOICES] | ||
for format in settings.DJANGO_VIDEO_ENCODER_FORMATS.values(): | ||
if "video_codec" not in format: | ||
errors.append( | ||
checks.Error(f"Format dict {format} has no defined `video_codec`") | ||
) | ||
continue | ||
if not format["video_codec"] in encoder_list: | ||
errors.append( | ||
checks.Error( | ||
f"Requested codec {format['video_codec']} is not defined in " | ||
f"{encoder_list}" | ||
) | ||
) | ||
return errors |
Oops, something went wrong.