Jump to content

Support in Collections TMDB lists too, not only TMDB Movie Sets


olympus1

Recommended Posts

olympus1

Hi, I have a request.

Is it possible to support all kind of lists from TMDB and not only movie sets?

Now, let's say I make a collection in Emby and add the TheMovieDb Id of it.

For example I add 8091, the Alien Collection, then Emby adds the link in the interface

https://www.themoviedb.org/collection/8091

Any chance to include support for all kind TMDB Lists too?

Basically support not only tmdbcolid, but something like tmdblistid too?

For example if I set the TheMovieDb List Id as 10, the Top 50 Grossing Films of All Time, then Emby would add this link in the interface

https://www.themoviedb.org/list/10

Now it opens the link below and it is not what I would like to be opened.

https://www.themoviedb.org/collection/10

TMDB lists are very powerful and a good asset for my own custom Emby collections.

Thank you in advance.

Edited by olympus1
  • Like 3
  • Agree 1
Link to comment
Share on other sites

olympus1

I understand that this request may not be something many people would care about and adding a new id for collections would be a lot to ask.

So I have another suggestion which would be easier to be implemented and wouldn't require to add tmdblistlid.

How about just making tmdbcolid "smarter" when it adds the "https://www.themoviedb.org/collection/" to the id?

I added as TheMovieDb Id for a list the word list as prefix and used redirector extension and made it to work in my browser.

I used the following redirector settings

Redirect: https://www.themoviedb.org/collection/list(\d+)

to: https://www.themoviedb.org/list/$1

How about just checking the id and if it starts with list before the number remove the word list and add "https://www.themoviedb.org/list/" and when it is a number only add "https://www.themoviedb.org/collection/"?

I managed to make it work this way by using the redirector extension in my browser, but I would prefer obviously if Emby could detect itself if the tmdb id of the collection is a movie set or a list.

Link to comment
Share on other sites

olympus1
On 6/8/2023 at 1:16 AM, Luke said:

Hi, yes this has come up before. Always a possibility. Thanks.

Thank you for you reply. I understand that this is definately not a top priority feature request.

So I made a javascript script myself for that. You can add any custom link you want to any collection with it.

I am basically changing my request:) Allow Emby to add any kind of custom link user wants to a collection... No need to bother with ids etc, just allowing to add custom http links for collections.

The link could be a TMDB list, a user created Trakt list that updates regurally, an IMDB link, a TVDB list link (btw TVDB seems to be the only site that releases official lists of franchises) so user would be able to be informed from his links about new items he could add to his lists.

I created a script for myself for that, but obviously I would prefer being able to do that directly to Emby without the need of scripts.

This is my script, it includes custom links of DC Extended Universe and Marvel Cinematic Universe to TheMovieDb, Trakt and TheTVDB.

The inventory variable can be edited and add any kind of collections and links user wants.

I hope someday I want need this script and I would be able to do that directly in Emby:)

Thank you again for your reply Luke.

// ==UserScript==
// @name        Emby - Collection Custom Links
// @version     1.0.0
// @namespace   http://tampermonkey.net/
// @require     http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @require     https://gist.github.com/raw/2625891/waitForKeyElements.js
// @include     *:8096/web/index.html*
// @grant       none
// ==/UserScript==

waitForKeyElements ("h1.itemName-primary", index);

function index(jNode) {

    var inventory = [

        {
            'name': 'DC Extended Universe',
            'TheMovieDb': 'https://www.themoviedb.org/list/3',
            'Trakt': 'https://trakt.tv/users/mende666/lists/dc-extended-universe-regular-updates?sort=released,asc',
            'TheTVDB': 'https://thetvdb.com/lists/dc-extended-universe'
        },

        {
            'name': 'Marvel Cinematic Universe',
            'TheMovieDb': 'https://www.themoviedb.org/list/1',
            'Trakt': 'https://trakt.tv/users/donxy/lists/marvel-cinematic-universe?sort=released,asc',
            'TheTVDB': 'https://thetvdb.com/lists/marvel-cinematic-universe'
        },

    ];

    matchItemInfo(inventory);

}


async function matchItemInfo(inventory){

    let CustomLinks = document.querySelectorAll("div[is='emby-scroller']:not(.hide) #embyCollectionCustomLink")[0];

    if (CustomLinks) {
        return;
    }

    let itemInfo = await getItemInfo();

    if (itemInfo === undefined || itemInfo === null) {
        return;
    }

    let itemType = itemInfo.Items[0].Type;

    if (itemType !== 'BoxSet') {
        return;
    }

    let itemName = itemInfo.Items[0].Name;

    if (itemName === undefined || itemName === null) {
        return;
    }

    let item = inventory.find(function findItem(item) {return item.name === itemName;});

    if (item === undefined || item === null) {
        return;
    }

    var links = '';

    for (var key in item) {
        if (item.hasOwnProperty(key)) {
            if (key !== 'name') {
                if (key !== '' && item[key] !== '') {
                links += '<a id="embyCollectionCustomLink" is="emby-linkbutton" class="raised item-tag-button nobackdropfilter emby-button" href="' + item[key] + '" target="_blank"><i class="md-icon button-icon button-icon-left">link</i>' + key + '</a>';
                }
            }
        }
    }

    if (links === '') {
        return;
    }

    var linkName = document.querySelectorAll(".sectionTitle")[14];

    if (linkName === undefined || linkName === null) {
        linkName = 'Links';
        }
    else {
        linkName = linkName.textContent;
        }

    let linksSection = document.querySelectorAll("div[is='emby-scroller']:not(.hide) .linksSection")[0];

    if (linksSection) {

        let html = '<h2 class="sectionTitle padded-left padded-right" style="margin-bottom:.4em;">' + linkName + '</h2><div class="itemLinks padded-left padded-right focusable" data-focusabletype="nearest">' + links + '</div>';

        linksSection.insertAdjacentHTML('afterend', html);
    }

}


async function getItemInfo(){

    let itemId = /\?id=(\d*)/.exec(window.location.hash)[1];
    let accessToken = ApiClient.accessToken();
    let serverAddress = ApiClient._serverAddress;
    let userId = ApiClient._serverInfo.UserId;

    if (accessToken === undefined || accessToken === null) {
        return;
    }
    if (serverAddress === undefined || serverAddress === null) {
        return;
    }
    if (itemId === undefined || itemId === null) {
        return;
    }

    let itemUrl = serverAddress + '/emby/Items?Ids=' + itemId + '&X-Emby-Token=' + accessToken
    let response = await fetch(itemUrl);

    if (response.ok) {
        return await response.json();
    }
    else {
        return;
    }
}

 

Edited by olympus1
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...