Coder Social home page Coder Social logo

Comments (5)

ChrisAlderson avatar ChrisAlderson commented on June 29, 2024

Already aware, I believe @vankasteelj would update his trakt.tv module to get the images from another source, but just to be sure I'll create a module for the Fanart.tv API so we can use that.

from popcorn-api.

vankasteelj avatar vankasteelj commented on June 29, 2024

I won't update trakt.tv, except remove the images call and so on. The module rests entirely on trakt, so I won't start making calls elsewhere

However, if you wish, you may take a look at trakt.tv addons, like I did for onDeskToWatch and matcher, this way you should be able to interface easily trakt and fanart.tv.

In my tests on Butter, I used fanart.tv :

Common.getImage = function (id, type) {
    var url = 'http://webservice.fanart.tv/v3/';
    var cat = type.indexOf('movie') !== -1 ? 'movies/' : 'tv/';
    var api = <your-api-key>

    return require('got')(url + cat + id + '?api_key=' + api,{json:true}).then(function (res) {
        console.log(res.body)
        var images = {};
        var holder = 'images/posterholder.png';
        if (type.indexOf('movie') !== -1) { //movie
            images.poster = res.body.movieposter ? res.body.movieposter[0].url : holder;
            images.background = res.body.moviebackground ? res.body.moviebackground[0].url : res.body.hdmovieclearart ? res.body.hdmovieclearart[0].url : holder;
        } else { // show
            images.poster = res.body.tvposter ? res.body.tvposter[0].url : holder;
            images.background = res.body.showbackground ? res.body.showbackground[0].url : res.body.clearart ? res.body.clearart[0].url : holder;
        }
        return images;
    }).catch(function(err) {
        console.error(err);
        return {
            clearart: null,
            poster: 'images/posterholder.png',
            background: null
        };
    });
};

but it often answers badly (timeout or such), so I would recommend fallbacks to omdb and/or tvdb

from popcorn-api.

ChrisAlderson avatar ChrisAlderson commented on June 29, 2024

Alright thanks for the answer @vankasteelj.

from popcorn-api.

ChrisAlderson avatar ChrisAlderson commented on June 29, 2024

Got a fanart.tv-api module so now it's time to implement.

from popcorn-api.

ChrisAlderson avatar ChrisAlderson commented on June 29, 2024

Fixed with: 85d4666

from popcorn-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.