Spaces:
Running
Running
Commit
·
6fdb1da
1
Parent(s):
0aa883f
fix
Browse files- templates/film_details_page.html +14 -18
templates/film_details_page.html
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
<meta charset="UTF-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<title>Film Details</title>
|
7 |
-
<script src="https://
|
8 |
<style>
|
9 |
body {
|
10 |
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
@@ -124,7 +124,6 @@
|
|
124 |
<div class="genres" id="film-genres"></div>
|
125 |
<div class="metadata-container" id="film-metadata"></div>
|
126 |
<a href="#" class="play-button" id="play-button" onclick="playFilm()">Play</a>
|
127 |
-
<p id="progress" style="margin-top: 20px; text-align: center;"></p>
|
128 |
</div>
|
129 |
</div>
|
130 |
<script>
|
@@ -172,27 +171,24 @@
|
|
172 |
metadataContainer.appendChild(createMetadataElement('Director', metadata.director));
|
173 |
metadataContainer.appendChild(createMetadataElement('Country', metadata.country));
|
174 |
metadataContainer.appendChild(createMetadataElement('Release Date', metadata.first_air_time));
|
|
|
|
|
|
|
175 |
}
|
176 |
|
177 |
-
function playFilm() {
|
178 |
const title = "{{ title }}";
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
socket.on('download_progress', function(data) {
|
185 |
-
if (data.error) {
|
186 |
-
progressElement.textContent = 'Error: ' + data.error;
|
187 |
-
} else if (data.status) {
|
188 |
-
progressElement.textContent = 'Status: ' + data.status;
|
189 |
} else {
|
190 |
-
|
191 |
-
if (data.progress === 100) {
|
192 |
-
window.location.href = `/cached_films/${encodeURIComponent(title)}`;
|
193 |
-
}
|
194 |
}
|
195 |
-
})
|
|
|
|
|
196 |
}
|
197 |
|
198 |
const urlParams = new URLSearchParams(window.location.search);
|
|
|
4 |
<meta charset="UTF-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<title>Film Details</title>
|
7 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.0/socket.io.min.js" integrity="sha384-13fTj1YYl5Xk8bo8dqPG7ZNmTPukjZ08s5hlIBvbxkQa2ClOsuT9hALo5eUn53I1" crossorigin="anonymous"></script>
|
8 |
<style>
|
9 |
body {
|
10 |
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
|
124 |
<div class="genres" id="film-genres"></div>
|
125 |
<div class="metadata-container" id="film-metadata"></div>
|
126 |
<a href="#" class="play-button" id="play-button" onclick="playFilm()">Play</a>
|
|
|
127 |
</div>
|
128 |
</div>
|
129 |
<script>
|
|
|
171 |
metadataContainer.appendChild(createMetadataElement('Director', metadata.director));
|
172 |
metadataContainer.appendChild(createMetadataElement('Country', metadata.country));
|
173 |
metadataContainer.appendChild(createMetadataElement('Release Date', metadata.first_air_time));
|
174 |
+
|
175 |
+
const playButton = document.getElementById('play-button');
|
176 |
+
playButton.href = `#`; // Will be handled by JavaScript
|
177 |
}
|
178 |
|
179 |
+
async function playFilm() {
|
180 |
const title = "{{ title }}";
|
181 |
+
try {
|
182 |
+
const response = await fetch(`/api/cache_film/${encodeURIComponent(title)}`);
|
183 |
+
const data = await response.json();
|
184 |
+
if (data.success) {
|
185 |
+
window.location.href = `/film_player/${encodeURIComponent(title)}`;
|
|
|
|
|
|
|
|
|
|
|
186 |
} else {
|
187 |
+
alert('Error caching film: ' + data.error);
|
|
|
|
|
|
|
188 |
}
|
189 |
+
} catch (error) {
|
190 |
+
alert('Error: ' + error.message);
|
191 |
+
}
|
192 |
}
|
193 |
|
194 |
const urlParams = new URLSearchParams(window.location.search);
|