@@ -75,7 +75,6 @@ <h3>Upload a Music/Video File</h3>
7575 </ div >
7676
7777 < div class ="upload-form " style ="margin-bottom:2em; ">
78-
7978 < h3 > Add a Clip from Google Drive</ h3 >
8079 < form action ="{{ url_for('public_clips') }} " method ="post ">
8180 < input type ="hidden " name ="action " value ="drive_link ">
@@ -91,7 +90,6 @@ <h3>Add a Clip from Google Drive</h3>
9190 </ p >
9291 < p > < button type ="submit "> Add Drive Content</ button > </ p >
9392 </ form >
94-
9593 </ div >
9694
9795 {% if message %}
@@ -102,38 +100,39 @@ <h3>Add a Clip from Google Drive</h3>
102100 {% if clips and clips|length > 0 %}
103101 {% for id, filename, title, description in clips %}
104102 {% set is_drive = 'drive.google.com' in filename %}
105- {% set is_video = filename.endswith('.mp4') or filename.endswith('.webm') or filename.endswith('.mov') %}
106- {% set is_audio = filename.endswith('.mp3') or filename.endswith('.wav') or filename.endswith('.m4a') or filename.endswith('.ogg') %}
103+ {% set is_split = '||' in filename %}
104+ {% if is_split %}
105+ {% set preview_url = filename.split('||')[0] %}
106+ {% set download_url = filename.split('||')[1] %}
107+ {% else %}
108+ {% set preview_url = url_for('uploaded_file', filename=filename) %}
109+ {% set download_url = url_for('uploaded_file', filename=filename) %}
110+ {% endif %}
111+
107112 < div class ="section ">
108113 < b > {{ title }}</ b > < br >
109114 < small > {{ description }}</ small > < br >
110-
115+
111116 {% if is_drive %}
112- < iframe src ="{{ filename }} " width ="380 " height ="240 " allow ="autoplay " allowfullscreen style ="margin-top:0.7em; "> </ iframe >
113- < source src ="{{ filename }} ">
114- Your browser does not support the video tag.
115- </ video >
116- {% elif is_drive %}
117- < audio controls style ="margin-top:0.7em; width: 260px; ">
118- < source src ="{{ filename }} ">
119- Your browser does not support the audio element.
120- </ audio >
121- {% elif is_video %}
122- < video controls width ="380 " style ="margin-top:0.7em; ">
123- < source src ="{{ url_for('uploaded_file', filename=filename) }} ">
124- Your browser does not support the video tag.
125- </ video >
126- {% elif is_audio %}
127- < audio controls style ="margin-top:0.7em; width: 260px; ">
128- < source src ="{{ url_for('uploaded_file', filename=filename) }} ">
129- Your browser does not support the audio element.
130- </ audio >
117+ < iframe src ="{{ preview_url }} " width ="380 " height ="240 " allow ="autoplay " allowfullscreen style ="margin-top:0.7em; "> </ iframe >
131118 {% else %}
132- < span title ="Unrecognized file type "> {{ filename }}</ span >
119+ {% set is_video = filename.endswith('.mp4') or filename.endswith('.webm') or filename.endswith('.mov') %}
120+ {% set is_audio = filename.endswith('.mp3') or filename.endswith('.wav') or filename.endswith('.m4a') or filename.endswith('.ogg') %}
121+ {% if is_video %}
122+ < video controls width ="380 " style ="margin-top:0.7em; ">
123+ < source src ="{{ preview_url }} ">
124+ Your browser does not support the video tag.
125+ </ video >
126+ {% elif is_audio %}
127+ < audio controls style ="margin-top:0.7em; width: 260px; ">
128+ < source src ="{{ preview_url }} ">
129+ Your browser does not support the audio element.
130+ </ audio >
131+ {% endif %}
133132 {% endif %}
134133
135134 < br >
136- < a href ="{{ url_for('uploaded_file', filename=filename) if not is_drive else filename }} " download > Download</ a >
135+ < a href ="{{ download_url }} " target =" _blank " > Download</ a >
137136 {% if admin %}
138137 < form action ="{{ url_for('delete_clip', clip_id=id) }} " method ="post " style ="display:inline; " onsubmit ="return confirm('Are you sure you want to delete this clip?'); ">
139138 < button type ="submit " class ="delete-btn "> Delete</ button >
0 commit comments