AnthonyMusgrove / Emby-ScripterX

Run custom external application or script (batch/bash/powershell/php/python/node.js/custom) on various events within the Emby Server.
https://emby-scripterx.com
78 stars 6 forks source link

ScripterX package - onMediaItemUpdated not working? #70

Open 1ucay opened 2 years ago

1ucay commented 2 years ago

Emby ScripterX: Tried to invoke function '_onMediaItemUpdated' on package with installationId 'b6956024-5963-4cb5-af49-0a74073abf6b' (function not implemented)

Package.js file

function _onMediaItemUpdated(context) {

    ScripterX.Log.Info("TEST - ID " + context.Token("%item.id%").value + " using original title " + context.Token("%item.originaltitle%").value + " with IMDB " + context.Token("%item.meta.imdb%").value );

    fetch(`https://api.allorigins.win/get?url=${encodeURIComponent('https://domain.com')}`).then(function(response){
        if (response.ok) return response.json()
        throw new Error('Network response was not ok.')
    }).then(function(data){
        ScripterX.Log.Info(data.contents);
    });

    ScripterX.Web.Get( ? ) 
    // I need download webpage (wihout CORS, but I can use https://api.allorigins.win/get?url=${encodeURIComponent('https://domain.com')

}