Skip to content

Commit

Permalink
Minor Changes
Browse files Browse the repository at this point in the history
Read me updates, and file comment updates.
  • Loading branch information
Anqui3tas committed Jan 15, 2025
1 parent f9f1daa commit 8d008c0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
22 changes: 7 additions & 15 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,9 @@ <h2 class="text-3xl font-extrabold text-white sm:text-4xl"><span class="block">S
</div>
<script>
document.addEventListener("DOMContentLoaded", function() {
const apiKey = 'ee48e99897613a53c20631a1da5fb117'; // Replace with your ready only TMDB API Key
const apiKey = 'ee48e99897613a53c20631a1da5fb117'; // place your API Key here
const apiURL = `https://api.themoviedb.org/3/trending/all/day?api_key=${apiKey}`;
const imageBaseURL = 'https://image.tmdb.org/t/p/original'; // Keep original size for large images
const imageBaseURL = 'https://image.tmdb.org/t/p/original';
const container = document.getElementById("background-container");
const overlay = document.getElementById("black-overlay");
let images = [];
Expand All @@ -303,33 +303,25 @@ <h2 class="text-3xl font-extrabold text-white sm:text-4xl"><span class="block">S
async function fetchImages() {
try {
const response = await fetch(apiURL);

if (!response.ok) {
throw new Error('Network response was not ok ' + response.statusText);
}

const data = await response.json();

console.log('Fetched data:', data); // Check the structure of the data

// Adjust the mapping based on the data structure
console.log('Fetched data:', data);
images = data.results.map(item => {
// Check if backdrop_path exists
if (item.backdrop_path) {
return `${imageBaseURL}${item.backdrop_path}`;
}
// Check if known_for exists and is an array
if (Array.isArray(item.known_for) && item.known_for.length > 0) {
const knownForBackdrop = item.known_for[0].backdrop_path;
return knownForBackdrop ? `${imageBaseURL}${knownForBackdrop}` : null; // Return URL if exists
return knownForBackdrop ? `${imageBaseURL}${knownForBackdrop}` : null;
}
return null; // Return null if no backdrop path found
}).filter(path => path); // Filter out null values

return null;
}).filter(path => path);
if (images.length > 0) {
preloadImage(images[0], () => {
container.style.backgroundImage = `url("${images[0]}")`;
setInterval(changeBackground, 6000); // Change every 6 seconds
setInterval(changeBackground, 6000); // Change every X seconds
});
} else {
console.error('No images found');
Expand Down
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Once installed, you can:
- Update links to direct to your own docker instance of Icarus Request.
- Update images to match your instance.
- Background automatically updates with current images from theMovieDB, simply add your own API key.
- get-movies.php allows you to store the api key securely on a php capable server. (I used IIS for a home test)

## Contributing

Expand All @@ -43,4 +44,5 @@ This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md

**Icarus Media Server**
Powered by LanteaCorp
Created by Triangle Studios - a LanteaCorp Entertainment company
Visit us at [icarus.lanteacorp.com](https://icarus.lanteacorp.com)

0 comments on commit 8d008c0

Please sign in to comment.