Spaces:
Paused
Paused
Commit
·
4b1ee51
1
Parent(s):
4e15391
patch
Browse files- app.py +0 -1
- templates/index.html +31 -25
app.py
CHANGED
@@ -42,7 +42,6 @@ def authenticate_thetvdb():
|
|
42 |
response = requests.post(auth_url, json=auth_data, proxies=proxies)
|
43 |
response.raise_for_status()
|
44 |
response_data = response.json()
|
45 |
-
print("Auth Response Data:", response_data) # Debugging print statement
|
46 |
THETVDB_TOKEN = response_data['data']['token']
|
47 |
TOKEN_EXPIRY = datetime.now() + timedelta(days=30) # token is valid for 1 month
|
48 |
except requests.RequestException as e:
|
|
|
42 |
response = requests.post(auth_url, json=auth_data, proxies=proxies)
|
43 |
response.raise_for_status()
|
44 |
response_data = response.json()
|
|
|
45 |
THETVDB_TOKEN = response_data['data']['token']
|
46 |
TOKEN_EXPIRY = datetime.now() + timedelta(days=30) # token is valid for 1 month
|
47 |
except requests.RequestException as e:
|
templates/index.html
CHANGED
@@ -124,38 +124,44 @@
|
|
124 |
card.className = 'card';
|
125 |
|
126 |
const title = item.path.split('/').pop();
|
|
|
|
|
127 |
const img = document.createElement('img');
|
128 |
-
img.src =
|
|
|
129 |
card.appendChild(img);
|
130 |
|
131 |
const titleElement = document.createElement('h3');
|
132 |
titleElement.textContent = title;
|
133 |
card.appendChild(titleElement);
|
|
|
134 |
if (item.contents) {
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
|
145 |
-
|
146 |
-
|
147 |
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
</script>
|
|
|
|
|
|
124 |
card.className = 'card';
|
125 |
|
126 |
const title = item.path.split('/').pop();
|
127 |
+
const imgSrc = await fetchImage(title);
|
128 |
+
|
129 |
const img = document.createElement('img');
|
130 |
+
img.src = imgSrc;
|
131 |
+
img.alt = title;
|
132 |
card.appendChild(img);
|
133 |
|
134 |
const titleElement = document.createElement('h3');
|
135 |
titleElement.textContent = title;
|
136 |
card.appendChild(titleElement);
|
137 |
+
|
138 |
if (item.contents) {
|
139 |
+
const p = document.createElement('p');
|
140 |
+
p.textContent = `Contains ${item.contents.length} items`;
|
141 |
+
card.appendChild(p);
|
142 |
+
} else {
|
143 |
+
const link = document.createElement('a');
|
144 |
+
link.href = `/play/${encodeURIComponent(item.path)}`;
|
145 |
+
link.textContent = 'Play';
|
146 |
+
card.appendChild(link);
|
147 |
+
}
|
148 |
|
149 |
+
return card;
|
150 |
+
}
|
151 |
|
152 |
+
async function loadSection(endpoint, containerId) {
|
153 |
+
const data = await fetchData(endpoint);
|
154 |
+
const container = document.getElementById(containerId);
|
155 |
+
container.innerHTML = ''; // Clear previous content
|
156 |
+
for (const item of data) {
|
157 |
+
container.appendChild(await createCard(item));
|
158 |
+
}
|
159 |
+
}
|
160 |
|
161 |
+
document.addEventListener('DOMContentLoaded', () => {
|
162 |
+
loadSection('/films', 'films-grid');
|
163 |
+
loadSection('/tv', 'tv-grid');
|
164 |
+
});
|
165 |
+
</script>
|
166 |
+
</body>
|
167 |
+
</html>
|