Skip to content

Missing Api#99

Open
singersbalm wants to merge 1 commit into
jellyfin:masterfrom
singersbalm:master
Open

Missing Api#99
singersbalm wants to merge 1 commit into
jellyfin:masterfrom
singersbalm:master

Conversation

@singersbalm
Copy link
Copy Markdown

This gets all the missing episodes/seasons etc that are generated by this plugin and lists them in a hierachy.
I wrote a small script to display it. I thought this as an admin page would be usefull. I still have to figure out how to change the frontend from a plugin. I wanted to add the Api first, bc I dont work on it activly. If someone else wants to change the frontend they can.

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>JSON Menu</title>
    <style>
        body {
            font-family: Arial, sans-serif;
        }
        .menu-item {
            cursor: pointer;
            position: relative;
            margin-left: 10px;
        }
        .missing {
            color: red;
        }
    </style>
</head>
<body>
    <div id="menu"></div>

    <script>
        const menuElement = document.getElementById('menu');

          fetch('http://localhost:8096/thetvdb/Missing')
            .then(response => response.json())
            .then(jsonData => {
                jsonData.forEach((item) => {
                    const menuItem = createMenuItem(item);
                    menuElement.appendChild(menuItem);
                });
            });

        function createMenuItem(item, depth = 0) {
            const menuItem = document.createElement('div');
            menuItem.classList.add('menu-item');
            menuItem.style.marginLeft = `${depth * 20}px`;
            
            if (item.Missing) {
                menuItem.classList.add('missing');
            }
            let index =  item.Index ? " " + item.Index : "";
            if (item.Child.length > 0) {
                const content = document.createElement('div');

                
                content.textContent = `▶ ${item.Type}${index}: ${item.Title}`;
                menuItem.appendChild(content);

                const childMenu = document.createElement('div');
                childMenu.style.display = 'none';

                content.addEventListener('click', (e) => {
                    e.stopPropagation(); // Prevent the click event from propagating to the parent

                    if (childMenu.style.display === 'none') {
                        childMenu.style.display = 'block';
                        content.textContent = "▼" + content.textContent.substring(1);
                    } else {
                        content.textContent = "▶" + content.textContent.substring(1);
                        childMenu.style.display = 'none';
                    }
                });

                item.Child.forEach((childItem) => {
                    const childMenuItem = createMenuItem(childItem, depth + 1);
                    childMenu.appendChild(childMenuItem);
                });

                menuItem.appendChild(childMenu);
            } else {
                const content = document.createElement('div');
                content.textContent = `${item.Type}${index}: ${item.Title}`;
                menuItem.appendChild(content);
            }

            return menuItem;
        }

        
    </script>
</body>
</html>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant