• Login
  • Register
  • Login Register
    Login
    Username/Email:
    Password:
    Or login with a social network below
  • Forum
  • Website
  • GitHub
  • Status
  • Translation
  • Features
  • Team
  • Rules
  • Help
  • Feeds
User Links
  • Login
  • Register
  • Login Register
    Login
    Username/Email:
    Password:
    Or login with a social network below

    Useful Links Forum Website GitHub Status Translation Features Team Rules Help Feeds
    Jellyfin Forum Support General Questions Featured Content Bar

    Poll: does anyone want a featured content bar?
    You do not have permission to vote in this poll.
    Yes
    87.50%
    42 87.50%
    No
    6.25%
    3 6.25%
    Don't care
    6.25%
    3 6.25%
    Total 48 vote(s) 100%
    * You voted for this item. [Show Results]

     
    • 3 Vote(s) - 5 Average

    Featured Content Bar

    is anyone currently working on a featured content bar?
    SethBacon
    Offline

    Member

    Posts: 51
    Threads: 3
    Joined: 2023 Nov
    Reputation: 5
    Country:Canada
    #12
    2023-11-12, 09:04 AM (This post was last modified: 2023-11-12, 09:40 AM by SethBacon. Edited 3 times in total.)
    Not a linux guy, ive been editing the slideshow js directly; I've managed to get it selectable by remote with

    slide.setAttribute('tabindex', '0');

    slide.addEventListener('keydown', function(event) {
    switch(event.keyCode) {
    case 13: // Enter key
    // Code to handle the selection
    window.location.href = this.href;
    break;
    // Add cases for other keys if needed
    }
    });

    Didn't feel like worth a full fork, but heres my slideshow.html
    Changes:
    -Reads list.txt (ignoring labels after id codes), if list.txt is not present, grabs 200 movies from server and randomizes a selection of them to display (because i cant find an API call for random selection)
    -Fetches the plot through API - movie.Overview
    -Accessible / Clickable in webUI (see video)
    -Offset top border & title font to match my JF theme (ymmv)
    -Text bottom justified (this number of chrs looks good on my desktop widescreen and on my phone, though ive set my slide frame to 350px tall)
    -Config vars grouped at beginning of JS
    -Various visual changes

    Issues:
    Pressing the webui back button (or remote controll back) after selecting a slide and going to its page will lock up JF. Using browser back button works fine, or pressing the webui home button works fine. I tried different referral options but no luck so far.

    My border highlight for the selection of the frame doesnt seem to be working, I have a hard time testing this accessibility on desktop.

    I dont know how you got this to work on Jellyfin for Android TV, it wont pick up Any server css for me.

    <!DOCTYPE html>
    <html>
    <head>
    <title>Jellyfin Featured Slideshow</title>
    <link href="https://fonts.googleapis.com/css2?family=Noto+Sans&display=swap" rel="stylesheet">
    <style>
    /* CSS styles for the slideshow elements */
    body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    }
    .slide {
    position: relative;
    width: 100vw;
    height: 100vh;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    cursor: pointer; /* Indicates the element is clickable */
    outline: none; /* Custom focus style will be used */
    }
    .slide:focus {
    outline: 2px solid #fff; /* Visual focus indicator */
    }
    .backdrop {
    position: absolute;
    top: 50px;
    left: 0;
    width: 100%;
    height: calc(100% - 50px);
    object-fit: cover;
    object-position: center 20%;
    border-radius: 5px;
    z-index: 1;
    }
    .logo {
    position: absolute;
    top: 65%;
    left: 10px;
    transform: translateY(-50%);
    max-height: 50%;
    max-width: 30%;
    width: auto;
    z-index: 3;
    }
    .featured-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50px;
    background-color: transparent;
    font-family: 'Noto Sans', sans-serif;
    color: #D3D3D3;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    z-index: 2;
    }
    .plot {
    position: absolute;
    bottom: 0px;
    left: 0; /* Align to the left edge */
    right: 0; /* Stretch to the right edge */
    color: white;
    width: 100%; /* Full width */
    font-family: 'Noto Sans', sans-serif;
    font-size: 15px;
    background: linear-gradient(to top, rgba(0, 0, 0, 1) 20%, rgba(0, 0, 0, 0) 100%);
    padding: 10px;
    border-radius: 5px;
    z-index: 4;
    box-sizing: border-box;
    }
    </style>
    </head>
    <body>

    <!-- Container for dynamic slides -->
    <div id="slides-container"></div>

    <!-- JavaScript for fetching movies and creating the slideshow -->
    <script>
    // Configuration variables
    let title = 'Spotlight'; // Default title
    const userId = '0e0755005f074a59bc0108cc2c3e650b'; // Replace with your User ID
    const token = 'de81a85d55024d7b9fa7b11031de7539'; // Replace with your API token
    const shuffleInterval = 10000; // Time in milliseconds between slide changes (25000ms = 25 seconds)
    const listFileName = 'list.txt'; // Name of the file containing the list of movie IDs

    function shuffleArray(array) {
    for (let i = array.length - 1; i > 0; i--) {
    const j = Math.floor(Math.random() * (i + 1));
    [array[i], array[j]] = [array[j], array[i]];
    }
    return array;
    }

    function truncateText(element, maxLength) {
    var truncated = element.innerText;

    if (truncated.length > maxLength) {
    truncated = truncated.substr(0, maxLength) + '...';
    }
    element.innerText = truncated;
    }

    function createSlideForMovie(movie, title) {
    const container = document.getElementById('slides-container');
    const slideElement = createSlideElement(movie, title);
    container.appendChild(slideElement);
    }

    function createSlideElement(movie, title) {
    const itemId = movie.Id;
    const plot = movie.Overview;

    const slide = document.createElement('a');
    slide.className = 'slide';
    slide.href = /#!/details?id=${itemId};
    slide.target = '_top';
    slide.rel = 'noreferrer';
    slide.setAttribute('tabindex', '0'); // Make the slide focusable

    // Key event listener for remote control input
    slide.addEventListener('keydown', function(event) {
    if (event.keyCode === 13) { // Enter key
    window.location.href = this.href;
    }
    });

    const backdrop = document.createElement('img');
    backdrop.className = 'backdrop';
    backdrop.src = /Items/${itemId}/Images/Backdrop/0;
    backdrop.alt = 'Backdrop';

    const logo = document.createElement('img');
    logo.className = 'logo';
    logo.src = /Items/${itemId}/Images/Logo;
    logo.alt = 'Logo';

    const featuredContent = document.createElement('div');
    featuredContent.className = 'featured-content';
    featuredContent.textContent = title;

    const plotElement = document.createElement('div');
    plotElement.className = 'plot';
    plotElement.textContent = plot;

    // Truncate the text of this specific plot element
    truncateText(plotElement, 240); // Adjust 240 to your preferred character limit

    slide.appendChild(backdrop);
    slide.appendChild(logo);
    slide.appendChild(featuredContent);
    slide.appendChild(plotElement);

    return slide;
    }

    function initializeSlideshow() {
    var slides = document.querySelectorAll(".slide");
    var currentSlide = 0;
    var shuffledIndexes = shuffleArray(Array.from({ length: slides.length }, (_, i) => i));

    function showSlide(index) {
    for (var i = 0; i < slides.length; i++) {
    slides[i].style.display = "none";
    }
    slides[shuffledIndexes[index]].style.display = "block";
    }

    function nextSlide() {
    currentSlide = (currentSlide + 1) % slides.length;
    showSlide(currentSlide);
    }

    showSlide(currentSlide);
    setInterval(nextSlide, shuffleInterval);
    }

    function fetchMovies() {
    const noCacheUrl = listFileName + '?' + new Date().getTime();

    fetch(noCacheUrl)
    .then(response => {
    if (response.ok) {
    return response.text();
    } else {
    throw new Error('list.txt not found, fetching movies from server.');
    }
    })
    .then(text => {
    const lines = text.split('\n').filter(Boolean);
    title = lines.shift() || 'Spotlight'; // Set the global title

    const movieIds = lines.map(line => line.substring(0, 32));
    return Promise.all(movieIds.map(id => fetchMovieDetails(id)));
    })
    .then(movies => {
    movies.forEach(movie => createSlideForMovie(movie, title));
    initializeSlideshow();
    })
    .catch(error => {
    console.error(error);
    fetchMoviesFromServer(); // Fallback to fetching movies from the server
    });
    }

    function fetchMovieDetails(movieId) {
    return fetch(/Users/${userId}/Items/${movieId}, {
    headers: {
    'Authorization': MediaBrowser Client="Jellyfin Web", Device="YourDeviceName", DeviceId="YourDeviceId", Version="YourClientVersion", Token="${token}"
    }
    })
    .then(response => response.json())
    .then(movie => {
    console.log("Movie Title:", movie.Name);
    console.log("Movie Overview:", movie.Overview);
    return movie;
    });
    }

    function fetchMoviesFromServer() {
    title = 'Spotlight'; // Reset title to 'Spotlight' when fetching from server
    fetch(/Users/${userId}/Items?IncludeItemTypes=Movie,Series&Recursive=true&Limit=300, {
    headers: {
    'Authorization': MediaBrowser Client="Jellyfin Web", Device="YourDeviceName", DeviceId="YourDeviceId", Version="YourClientVersion", Token="${token}"
    }
    })
    .then(response => response.json())
    .then(data => {
    const movies = data.Items;
    const shuffledMovies = shuffleArray(movies);
    const selectedMovieIds = shuffledMovies.slice(0, 30).map(movie => movie.Id);
    return Promise.all(selectedMovieIds.map(id => fetchMovieDetails(id)));
    })
    .then(movies => {
    movies.forEach(movie => createSlideForMovie(movie, 'Spotlight'));
    initializeSlideshow();
    })

    .catch(error => console.error('Error fetching movies:', error));
    }

    fetchMovies();
    </script>
    </body>
    </html>
    1
    « Next Oldest | Next Newest »

    Users browsing this thread: 2 Guest(s)


    Messages In This Thread
    Featured Content Bar - by BobHasNoSoul - 2023-10-28, 11:28 PM
    RE: Featured Content Bar - by SethBacon - 2023-11-07, 07:43 AM
    RE: Featured Content Bar - by BobHasNoSoul - 2023-11-07, 06:53 PM
    RE: Featured Content Bar - by SethBacon - 2023-11-07, 08:25 PM
    RE: Featured Content Bar - by BobHasNoSoul - 2023-11-07, 10:18 PM
    RE: Featured Content Bar - by BobHasNoSoul - 2023-11-08, 07:17 PM
    RE: Featured Content Bar - by Milko - 2023-11-09, 02:59 AM
    RE: Featured Content Bar - by BobHasNoSoul - 2023-11-09, 07:47 AM
    RE: Featured Content Bar - by Joshua26 - 2024-09-09, 08:55 AM
    RE: Featured Content Bar - by SethBacon - 2023-11-10, 01:28 PM
    RE: Featured Content Bar - by BobHasNoSoul - 2023-11-10, 07:52 PM
    RE: Featured Content Bar - by grabbend - 2023-11-13, 07:49 PM
    RE: Featured Content Bar - by BobHasNoSoul - 2023-11-14, 07:59 AM
    RE: Featured Content Bar - by grabbend - 2024-01-19, 11:16 AM
    RE: Featured Content Bar - by BobHasNoSoul - 2023-11-11, 09:08 AM
    RE: Featured Content Bar - by SethBacon - 2023-11-12, 09:04 AM
    RE: Featured Content Bar - by SethBacon - 2023-11-12, 09:22 AM
    RE: Featured Content Bar - by SethBacon - 2023-11-12, 09:28 AM
    RE: Featured Content Bar - by BobHasNoSoul - 2023-11-12, 09:36 PM
    RE: Featured Content Bar - by SethBacon - 2023-11-12, 10:11 PM
    RE: Featured Content Bar - by 1hitsong - 2023-11-13, 01:02 AM
    RE: Featured Content Bar - by SethBacon - 2023-11-13, 02:05 AM
    RE: Featured Content Bar - by BobHasNoSoul - 2023-11-13, 06:36 PM
    RE: Featured Content Bar - by SethBacon - 2023-11-13, 07:37 PM
    RE: Featured Content Bar - by M0RPH3US - 2024-05-28, 06:04 PM
    RE: Featured Content Bar - by ferferga - 2023-11-16, 07:23 PM
    RE: Featured Content Bar - by SethBacon - 2023-11-17, 02:42 AM
    RE: Featured Content Bar - by esol693 - 2024-01-19, 08:06 AM
    RE: Featured Content Bar - by Hectik - 2024-06-13, 11:42 AM
    RE: Featured Content Bar - by mikesulsenti - 2024-01-19, 08:49 AM
    RE: Featured Content Bar - by SethBacon - 2024-05-28, 09:24 PM
    RE: Featured Content Bar - by ceaton - 2024-06-06, 05:14 PM
    RE: Featured Content Bar - by TheDreadPirate - 2024-06-06, 05:24 PM
    RE: Featured Content Bar - by SethBacon - 2024-06-11, 03:21 AM
    RE: Featured Content Bar - by M0RPH3US - 2024-06-11, 10:21 AM
    RE: Featured Content Bar - by M0RPH3US - 2024-06-28, 07:57 AM
    RE: Featured Content Bar - by Ted Hinklater - 2024-09-04, 12:13 PM
    RE: Featured Content Bar - by M0RPH3US - 2024-09-04, 06:11 PM
    RE: Featured Content Bar - by Ted Hinklater - 2024-09-04, 06:46 PM
    RE: Featured Content Bar - by Hectik - 2024-06-13, 09:41 AM
    RE: Featured Content Bar - by Canadane - 2024-07-06, 11:40 PM
    RE: Featured Content Bar - by Sash - 2024-08-13, 12:32 PM
    RE: Featured Content Bar - by Ted Hinklater - 2024-08-13, 01:00 PM
    RE: Featured Content Bar - by Sash - 2024-08-13, 01:36 PM
    RE: Featured Content Bar - by Ted Hinklater - 2024-08-13, 01:40 PM
    RE: Featured Content Bar - by Sash - 2024-08-13, 01:45 PM
    RE: Featured Content Bar - by Ted Hinklater - 2024-09-04, 10:22 PM
    RE: Featured Content Bar - by M0RPH3US - 2024-09-05, 07:06 AM
    RE: Featured Content Bar - by Ted Hinklater - 2024-09-05, 03:27 PM
    RE: Featured Content Bar - by M0RPH3US - 2024-09-06, 01:23 PM
    RE: Featured Content Bar - by Ted Hinklater - 2024-09-07, 11:19 AM
    RE: Featured Content Bar - by elgato_dark - 2024-09-07, 05:19 AM
    RE: Featured Content Bar - by xiNe - 2024-09-08, 09:14 PM
    RE: Featured Content Bar - by sheakspeer - 2024-09-13, 01:31 PM
    RE: Featured Content Bar - by TheDreadPirate - 2024-09-13, 01:44 PM
    RE: Featured Content Bar - by A Silly Goose - 2024-09-15, 03:48 PM
    RE: Featured Content Bar - by Ted Hinklater - 2024-09-15, 03:55 PM
    RE: Featured Content Bar - by A Silly Goose - 2024-09-16, 12:59 AM
    RE: Featured Content Bar - by vbxlive - 2024-09-17, 05:58 AM
    RE: Featured Content Bar - by SethBacon - 2024-09-17, 06:39 AM
    RE: Featured Content Bar - by vbxlive - 2024-09-17, 08:17 AM
    RE: Featured Content Bar - by Ted Hinklater - 2024-09-18, 12:40 AM
    RE: Featured Content Bar - by vbxlive - 2024-09-18, 02:11 AM
    RE: Featured Content Bar - by Ted Hinklater - 2024-09-18, 11:33 PM
    RE: Featured Content Bar - by SethBacon - 2024-09-17, 04:02 AM
    RE: Featured Content Bar - by SethBacon - 2024-09-17, 09:40 AM
    RE: Featured Content Bar - by SethBacon - 2024-09-18, 01:42 AM
    RE: Featured Content Bar - by SethBacon - 2024-09-18, 10:42 PM
    RE: Featured Content Bar - by EduardoUK - 2024-09-28, 03:02 PM
    RE: Featured Content Bar - by Ted Hinklater - 2024-09-28, 03:58 PM
    RE: Featured Content Bar - by EduardoUK - 2024-09-28, 04:22 PM
    RE: Featured Content Bar - by TheDreadPirate - 2024-09-28, 04:39 PM
    RE: Featured Content Bar - by EduardoUK - 2024-09-28, 05:00 PM
    RE: Featured Content Bar - by EduardoUK - 2024-09-28, 09:18 PM
    RE: Featured Content Bar - by EduardoUK - 2024-10-01, 10:20 AM
    RE: Featured Content Bar - by sweetroll - 2024-10-29, 06:09 AM
    RE: Featured Content Bar - by vbxlive - 2024-09-30, 09:50 AM
    RE: Featured Content Bar - by Ted Hinklater - 2024-09-30, 02:08 PM
    RE: Featured Content Bar - by jennystreaming - 2024-09-30, 07:58 PM
    RE: Featured Content Bar - by vbxlive - 2024-10-01, 05:01 AM
    RE: Featured Content Bar - by Ted Hinklater - 2024-10-01, 12:48 PM
    RE: Featured Content Bar - by EduardoUK - 2024-10-05, 10:10 AM
    RE: Featured Content Bar - by SethBacon - 2024-10-07, 05:00 AM
    RE: Featured Content Bar - by M0RPH3US - 2024-10-09, 09:19 AM
    RE: Featured Content Bar - by Ted Hinklater - 2024-11-15, 09:02 PM
    RE: Featured Content Bar - by vortex91 - 2024-12-03, 12:52 AM
    RE: Featured Content Bar - by Anatole - 2024-12-07, 04:27 PM
    RE: Featured Content Bar - by stephenshutters - 2024-12-22, 08:14 PM
    RE: Featured Content Bar - by harrenkyym - 2024-12-23, 02:18 PM
    RE: Featured Content Bar - by Ted Hinklater - 2025-01-13, 05:39 PM
    RE: Featured Content Bar - by GkhnG - 2025-03-28, 03:36 PM

    • View a Printable Version
    • Subscribe to this thread
    Forum Jump:

    Home · Team · Help · Contact
    © Designed by D&D - Powered by MyBB
    L


    Jellyfin

    The Free Software Media System

    Linear Mode
    Threaded Mode