Skip to content
This repository has been archived by the owner on Dec 9, 2023. It is now read-only.

Commit

Permalink
update logging
Browse files Browse the repository at this point in the history
  • Loading branch information
LukePulverenti committed Aug 29, 2020
1 parent 5800b42 commit 3b8aa73
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
20 changes: 4 additions & 16 deletions apiclient.js
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ class ApiClient {

fetchWithFailover(request, enableReconnection, signal) {

console.log(`Requesting ${request.url}`);
console.log(`apiclient.fetchWithFailover ${request.url}`);

request.timeout = 30000;
const instance = this;
Expand Down Expand Up @@ -1463,11 +1463,7 @@ class ApiClient {

} else {

return this.ajax({
type: "GET",
url: this.getUrl("LiveTv/Programs", options),
dataType: "json"
});
return this.getJSON(this.getUrl("LiveTv/Programs", options));
}
}

Expand All @@ -1480,11 +1476,7 @@ class ApiClient {

if (this.isMinServerVersion('4.4.3')) {

return this.ajax({
type: "GET",
url: this.getUrl("LiveTv/EPG", options),
dataType: "json"
}).then(modifyEpgResponse.bind(this));
return this.getJSON(this.getUrl("LiveTv/EPG", options)).then(modifyEpgResponse.bind(this));
}

const serverId = this.serverId();
Expand Down Expand Up @@ -1545,11 +1537,7 @@ class ApiClient {
}

getLiveTvRecommendedPrograms(options = {}) {
return this.ajax({
type: "GET",
url: this.getUrl("LiveTv/Programs/Recommended", options),
dataType: "json"
});
return this.getJSON(this.getUrl("LiveTv/Programs/Recommended", options));
}

getLiveTvRecordings(options, signal) {
Expand Down
16 changes: 13 additions & 3 deletions connectionmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,8 @@ function ensureConnectUser(instance, credentials) {

function validateAuthentication(instance, server, serverUrl) {

console.log('connectionManager.validateAuthentication: ' + serverUrl);

return ajax({

type: "GET",
Expand Down Expand Up @@ -691,6 +693,8 @@ function afterConnectValidated(
verifyLocalAuthentication,
options) {

console.log('connectionManager.afterConnectValidated: ' + serverUrl);

options = options || {};

if (verifyLocalAuthentication && server.AccessToken) {
Expand Down Expand Up @@ -740,6 +744,8 @@ function afterConnectValidated(
return Promise.resolve(result);
};

console.log('connectionManager.afterConnectValidated result.State: ' + (result.State || ''));

if (result.State === 'SignedIn') {
afterConnected(instance, result.ApiClient, options);

Expand All @@ -752,6 +758,8 @@ function afterConnectValidated(

function onSuccessfulConnection(instance, server, systemInfo, connectionMode, serverUrl, options) {

console.log('connectionManager.onSuccessfulConnection: ' + serverUrl);

const credentials = instance.credentialProvider().credentials();
options = options || {};
if (credentials.ConnectAccessToken && options.enableAutoLogin !== false) {
Expand Down Expand Up @@ -779,12 +787,14 @@ function onSuccessfulConnection(instance, server, systemInfo, connectionMode, se
}
}

function resolveIfAvailable(instance, url, server, result, connectionMode, serverUrl, options) {
function resolveIfAvailable(instance, url, server, result, connectionMode, options) {

console.log('connectionManager.resolveIfAvailable: ' + url);

const promise = instance.validateServerAddress ? instance.validateServerAddress(instance, ajax, url) : Promise.resolve();

return promise.then(() => {
return onSuccessfulConnection(instance, server, result, connectionMode, serverUrl, options);
return onSuccessfulConnection(instance, server, result, connectionMode, url, options);
}, () => {
console.log('minServerVersion requirement not met. Server version: ' + result.Version);
return {
Expand Down Expand Up @@ -1166,7 +1176,7 @@ export default class ConnectionManager {
updateServerInfo(server, result);
}

return resolveIfAvailable(instance, serverUrl, server, result, connectionMode, serverUrl, options);
return resolveIfAvailable(instance, serverUrl, server, result, connectionMode, options);
}

}, function () {
Expand Down

0 comments on commit 3b8aa73

Please sign in to comment.