From 6594777e0faa855dd109c459ca98975781d1750f Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 18 Dec 2021 05:13:46 +0200 Subject: [PATCH] fsdfsd --- files/classes/submission.py | 5 +++++ files/templates/CHRISTMAS/submission.html | 16 +++++++++------- .../templates/CHRISTMAS/submission_listing.html | 4 +++- files/templates/formatting.html | 7 +------ files/templates/submission.html | 13 ++----------- files/templates/submission_listing.html | 12 ++---------- 6 files changed, 22 insertions(+), 35 deletions(-) diff --git a/files/classes/submission.py b/files/classes/submission.py index 69cd36ce7..7460e03a5 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -397,6 +397,11 @@ class Submission(Base): return title + @property + @lazy + def is_video(self): + return self.url and any((self.url.lower().endswith(x) for x in ('.mp4','.webm','.mov'))) + @property @lazy def is_image(self): diff --git a/files/templates/CHRISTMAS/submission.html b/files/templates/CHRISTMAS/submission.html index bc857a518..399ce5500 100644 --- a/files/templates/CHRISTMAS/submission.html +++ b/files/templates/CHRISTMAS/submission.html @@ -304,6 +304,8 @@ {% if p.is_image %} (image post) + {% elif p.is_video %} + (video post) {% elif p.realurl(v) %} ({{p.domain}}) @@ -352,13 +354,13 @@ {% endif %}
{% if p.is_image %} - - Unable to load image - - {% elif p.url and p.url.lower().endswith('.mp4') %} - + + Unable to load image + + {% elif p.is_video %} + {% endif %} {{p.realbody(v) | safe}} diff --git a/files/templates/CHRISTMAS/submission_listing.html b/files/templates/CHRISTMAS/submission_listing.html index 7275847fd..d91fd25f4 100644 --- a/files/templates/CHRISTMAS/submission_listing.html +++ b/files/templates/CHRISTMAS/submission_listing.html @@ -149,6 +149,8 @@ {% if p.is_image %} (image post) + {% if p.is_video %} + (video post) {% elif p.realurl(v) %} ({{p.domain}}) @@ -285,7 +287,7 @@ {% endif %} {% if not p.club or v and (v.paid_dues or v.id == p.author_id) %} - {% if p.url and p.url.lower().endswith('.mp4') %} + {% if p.is_video %}

-							{% elif p.url and p.url.lower().endswith('.mp4') %}
+							{% elif p.is_video %}
 								

-							{% elif p.url and p.url.lower().endswith('.webm') %}
-								
-
- -
-
-

 							{% endif %}
 							{{p.realbody(v) | safe}}
 
diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html
index 3338aac2e..390dd8c48 100644
--- a/files/templates/submission_listing.html
+++ b/files/templates/submission_listing.html
@@ -185,7 +185,7 @@
 				{{p.author.username}}{% if p.author.customtitle %}  {% if p.author.quadrant %}{% endif %}{{p.author.customtitle | safe}}{% endif %}
 				 {{p.age_string}}
 				 
-				({% if p.is_image %}image post{% elif p.realurl(v) %}{{p.domain}}{% else %}text post{% endif %})
+				({% if p.is_image %}image post{% elif p.is_video %}video post{% elif p.realurl(v) %}{{p.domain}}{% else %}text post{% endif %})
 				{% if p.edited_utc %}
 					  Edited {{p.edited_string}}
 				{% endif %}
@@ -506,20 +506,12 @@
 				Unable to load image
 			
 		
-	{% endif %}
-
-	{% if p.url and p.url.lower().endswith('.mp4') %}
+	{% elif p.is_video %}
 		
- {% elif p.url and p.url.lower().endswith('.webm') %} -
- -
{% elif p.embed_url and p.domain in ['youtu.be','youtube.com'] and p.embed_url.startswith(' {{p.embed_url | safe}}