Skip to content

Commit

Permalink
Code cleaning for 3.9.0 (#1238)
Browse files Browse the repository at this point in the history
* Remove useless html comments
* Translate html comments
* Remove duplicated function get_storage_path_video from video.utils
* Replace '/' by os.path.join in video models
* Remove duplicated code in video-script?html
  • Loading branch information
Badatos authored Jan 10, 2025
1 parent 3e022c5 commit 7519483
Show file tree
Hide file tree
Showing 12 changed files with 13 additions and 36 deletions.
3 changes: 2 additions & 1 deletion pod/live/templates/live/event-info.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ <h3 class="meta-title">{% trans 'Type:' %}</h3>
</ul>
</div>

{% if event.is_draft == False or event.owner == request.user or request.user in event.additional_owners.all or request.user.is_superuser %} <!-- Début modale -->
{% if event.is_draft == False or event.owner == request.user or request.user in event.additional_owners.all or request.user.is_superuser %}
<!-- Start modal -->
<div class="modal fade" id="share" tabindex="-1" aria-labelledby="shareLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
Expand Down
3 changes: 1 addition & 2 deletions pod/main/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,9 @@
<body>
{% if PRE_HEADER_TEMPLATE %}{% include PRE_HEADER_TEMPLATE %}{% endif %}
<header>
<!-- barre nav-->
<nav class="pod-navbar navbar fixed-top m-0 p-1 p-md-2">
{% include 'navbar.html' %}
</nav><!-- fin barre nav-->
</nav>
{% include 'navbar_collapse.html' %}
</header>
{% block content %}
Expand Down
2 changes: 1 addition & 1 deletion pod/main/templates/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -402,5 +402,5 @@ <h5 class="offcanvas-title text-center">{% trans 'Your statistics' %}</h5>
{% endif %}
{% endif %}
</ul>
</div> <!-- FIN Container -->
</div> <!-- End container-fluid -->
{% endspaceless %}
4 changes: 2 additions & 2 deletions pod/playlist/templates/playlist/playlist-list-modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link rel="stylesheet" href="{% static 'playlist/css/playlist.css' %}?ver={{ VERSION }}">
{% endblock page_extra_head %}

<!-- DEBUT modal PLAYLIST -->
<!-- Start PLAYLIST modal -->
<div class="modal fade" id="playlist-modal" tabindex="-1" aria-labelledby="playlist-list-label" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
Expand Down Expand Up @@ -56,7 +56,7 @@ <h2 class="modal-title h3" id="playlist-list-label">
</div>
</div>
</div>
</div> <!-- modal end PLAYLIST -->
</div> <!-- End PLAYLIST modal -->
{% block more_script %}
<script src="{% static 'playlist/js/utils-playlist.js' %}?ver={{ VERSION }}"></script>
<script src="{% static 'playlist/js/playlist-modal.js' %}?ver={{ VERSION }}"></script>
Expand Down
3 changes: 1 addition & 2 deletions pod/video/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@
from django.utils.deconstruct import deconstructible
from django.utils.translation import ugettext_lazy as _
from django.template.defaultfilters import filesizeformat
from .models import Video, VideoVersion
from .models import Video, VideoVersion, get_storage_path_video
from .models import Channel
from .models import Theme
from .models import Type
from .models import Discipline
from .models import Notes, AdvancedNotes, NoteComments
from .utils import get_storage_path_video
from pod.video_encode_transcript.models import PlaylistVideo
from pod.video_encode_transcript import encode
from pod.video_encode_transcript.models import EncodingVideo, EncodingAudio
Expand Down
4 changes: 2 additions & 2 deletions pod/video/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,9 @@ def get_storage_path_video(instance, filename) -> str:
return os.path.join(
VIDEOS_DIR,
instance.owner.owner.hashkey,
"%s/%s.%s"
os.path.dirname(fname),
"%s.%s"
% (
os.path.dirname(fname),
slugify(os.path.basename(fname)),
extension,
),
Expand Down
2 changes: 1 addition & 1 deletion pod/video/templates/videos/video-all-info.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h1 class="page_title h2">
{% endif %}

<div class="ps-0 pe-0">
<div class="navbar d-flex flex-row-reverse p-0"> <!-- Début menu à popup -->
<div class="navbar d-flex flex-row-reverse p-0">
<ul class="nav nav-tabs" role="tablist" id="pod-infos-tabs">
{% tags_for_object video as tag_list %}
{% if third_app %}
Expand Down
1 change: 0 additions & 1 deletion pod/video/templates/videos/video-element.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
{% endif %}
{% if request.GET.loop and request.GET.loop == 'true' %} loop {% endif %} {% endspaceless %}
>
<!-- <source src="{{ video.get_playlist_master.source_file.url }}" type="{{ video.get_playlist_master.encoding_format }}"> -->
<p class="vjs-no-js">
{%blocktrans%}To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="https://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>{%endblocktrans%}
</p>
Expand Down
3 changes: 0 additions & 3 deletions pod/video/templates/videos/video-script.html
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,6 @@
player.vttThumbnails({
src: '{% if request.is_secure %}https://{% else %}http://{% endif %}{{request.get_host}}{{video.overview.url}}?date={{video.overview|file_date_created}}'
});
player.vttThumbnails({
src: '{% if request.is_secure %}https://{% else %}http://{% endif %}{{request.get_host}}{{video.overview.url}}?date={{video.overview|file_date_created}}'
});
{% endif %}

{% if video.overlay_set.all %}
Expand Down
1 change: 1 addition & 0 deletions pod/video/urls.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Esup-Pod Video Urls."""
from django.conf import settings
from django.conf.urls import url
from django.urls import include, path
Expand Down
20 changes: 1 addition & 19 deletions pod/video/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,25 +271,7 @@ def get_storage_path_video(instance, filename) -> str:
Instance needs to implement owner
"""
fname, dot, extension = filename.rpartition(".")
try:
fname.index("/")
return os.path.join(
VIDEOS_DIR,
instance.owner.owner.hashkey,
"%s/%s.%s"
% (
os.path.dirname(fname),
slugify(os.path.basename(fname)),
extension,
),
)
except ValueError:
return os.path.join(
VIDEOS_DIR,
instance.owner.owner.hashkey,
"%s.%s" % (slugify(fname), extension),
)
Video.get_storage_path_video(instance, filename)


def verify_field_length(field, field_name: str = "title", max_length: int = 100) -> list:
Expand Down
3 changes: 1 addition & 2 deletions pod/video_encode_transcript/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
from django.contrib.sites.models import Site
from django.dispatch import receiver
from django.db.models.signals import post_save
from pod.video.models import Video
from pod.video.utils import get_storage_path_video
from pod.video.models import Video, get_storage_path_video

ENCODING_CHOICES = getattr(
settings,
Expand Down

0 comments on commit 7519483

Please sign in to comment.