Normalize to double quotes across all files with Prettier
This commit is contained in:
1 parent
73bff72cec
commit
a5659cf4c8
190 files changed
+9523
-8859
No files matched your search
@@ -1,6 +1,6 @@
|
||||
const axios = require('axios');
|
||||
const { logToFile } = require('./logService');
|
||||
const configService = require('./configService');
|
||||
const axios = require("axios");
|
||||
const { logToFile } = require("./logService");
|
||||
const configService = require("./configService");
|
||||
|
||||
const TMDB_APIURL = configService.getTmdbApiUrl();
|
||||
const TMDB_APIKEY = configService.getTmdbApiKey();
|
||||
@@ -8,44 +8,41 @@ const TMDB_APIKEY = configService.getTmdbApiKey();
|
||||
async function fetchEntryData(tmdb_id, is_tvserie) {
|
||||
try {
|
||||
let type = is_tvserie ? "tv" : "movie";
|
||||
let url = `${TMDB_APIURL}${type}/${tmdb_id}?api_key=${TMDB_APIKEY}&language=en-US`
|
||||
logToFile(`Fetching Entry Data From: ${url}`)
|
||||
let url = `${TMDB_APIURL}${type}/${tmdb_id}?api_key=${TMDB_APIKEY}&language=en-US`;
|
||||
logToFile(`Fetching Entry Data From: ${url}`);
|
||||
let data;
|
||||
await axios.get(url)
|
||||
.then((response) => {
|
||||
if (response.status != 200) {
|
||||
logToFile(`Error Fetching Data From: ${url}`)
|
||||
return console.log('Error fetching the data.')
|
||||
};
|
||||
data = response.data;
|
||||
})
|
||||
await axios.get(url).then((response) => {
|
||||
if (response.status != 200) {
|
||||
logToFile(`Error Fetching Data From: ${url}`);
|
||||
return console.log("Error fetching the data.");
|
||||
}
|
||||
data = response.data;
|
||||
});
|
||||
|
||||
return data;
|
||||
} catch (error) {
|
||||
console.log('Error fetching the entry data.', error)
|
||||
console.log("Error fetching the entry data.", error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function fetchSeasonData(tmdbTvId, seasonNumber) {
|
||||
// fetching the informations
|
||||
try {
|
||||
let url = `${TMDB_APIURL}tv/${tmdbTvId}/season/${seasonNumber}?api_key=${TMDB_APIKEY}&language=en-US`
|
||||
logToFile(`Fetching Season Data From: ${url}`)
|
||||
let url = `${TMDB_APIURL}tv/${tmdbTvId}/season/${seasonNumber}?api_key=${TMDB_APIKEY}&language=en-US`;
|
||||
logToFile(`Fetching Season Data From: ${url}`);
|
||||
let data;
|
||||
await axios.get(url)
|
||||
.then((response) => {
|
||||
if (response.status != 200) {
|
||||
logToFile(`Error Fetching Data From: ${url}`)
|
||||
return console.log('Error fetching the data.')
|
||||
};
|
||||
data = response.data;
|
||||
})
|
||||
await axios.get(url).then((response) => {
|
||||
if (response.status != 200) {
|
||||
logToFile(`Error Fetching Data From: ${url}`);
|
||||
return console.log("Error fetching the data.");
|
||||
}
|
||||
data = response.data;
|
||||
});
|
||||
|
||||
return data;
|
||||
} catch (error) {
|
||||
console.log('Error fetching the data.')
|
||||
console.log("Error fetching the data.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -53,42 +50,44 @@ async function fetchSeasonData(tmdbTvId, seasonNumber) {
|
||||
async function fetchEntryMedia(tmdb_id, is_tvserie) {
|
||||
try {
|
||||
let type = is_tvserie ? "tv" : "movie";
|
||||
let url = `${TMDB_APIURL}${type}/${tmdb_id}/images?api_key=${TMDB_APIKEY}`
|
||||
logToFile(`Fetching Entry Media Data From: ${url}`)
|
||||
let url = `${TMDB_APIURL}${type}/${tmdb_id}/images?api_key=${TMDB_APIKEY}`;
|
||||
logToFile(`Fetching Entry Media Data From: ${url}`);
|
||||
let data;
|
||||
await axios.get(url)
|
||||
.then((response) => {
|
||||
if (response.status != 200) {
|
||||
logToFile(`Error Fetching Data From: ${url}`)
|
||||
return console.log('Error fetching the data.')
|
||||
};
|
||||
data = response.data;
|
||||
})
|
||||
await axios.get(url).then((response) => {
|
||||
if (response.status != 200) {
|
||||
logToFile(`Error Fetching Data From: ${url}`);
|
||||
return console.log("Error fetching the data.");
|
||||
}
|
||||
data = response.data;
|
||||
});
|
||||
|
||||
return data;
|
||||
} catch (error) {
|
||||
console.log('Error fetching the entry media.', error)
|
||||
console.log("Error fetching the entry media.", error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchCollectionData(collectionId) {
|
||||
try {
|
||||
let url = `${TMDB_APIURL}collection/${collectionId}?api_key=${TMDB_APIKEY}&language=en-US`
|
||||
logToFile(`Fetching Collection Data From: ${url}`)
|
||||
let url = `${TMDB_APIURL}collection/${collectionId}?api_key=${TMDB_APIKEY}&language=en-US`;
|
||||
logToFile(`Fetching Collection Data From: ${url}`);
|
||||
let data;
|
||||
await axios.get(url)
|
||||
.then((response) => {
|
||||
if (response.status != 200) return console.log('Error fetching collection data from tmdb:', response);
|
||||
data = response.data;
|
||||
})
|
||||
await axios.get(url).then((response) => {
|
||||
if (response.status != 200)
|
||||
return console.log(
|
||||
"Error fetching collection data from tmdb:",
|
||||
response,
|
||||
);
|
||||
data = response.data;
|
||||
});
|
||||
|
||||
return data;
|
||||
} catch (error) {
|
||||
if (response.status != 200) {
|
||||
logToFile(`Error Fetching Data From: ${url}`)
|
||||
return console.log('Error fetching the data.')
|
||||
};
|
||||
logToFile(`Error Fetching Data From: ${url}`);
|
||||
return console.log("Error fetching the data.");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -105,24 +104,23 @@ async function fetchEntryCredits(tmdb_id, is_tvserie) {
|
||||
let url = `${TMDB_APIURL}${type}/${tmdb_id}/credits?api_key=${TMDB_APIKEY}&language=en-US`;
|
||||
|
||||
if (is_tvserie) {
|
||||
url = `${TMDB_APIURL}${type}/${tmdb_id}/aggregate_credits?api_key=${TMDB_APIKEY}&language=en-US`
|
||||
url = `${TMDB_APIURL}${type}/${tmdb_id}/aggregate_credits?api_key=${TMDB_APIKEY}&language=en-US`;
|
||||
}
|
||||
|
||||
logToFile(`Fetching Entry Credits From: ${url}`);
|
||||
|
||||
let data;
|
||||
await axios.get(url)
|
||||
.then((response) => {
|
||||
if (response.status != 200) {
|
||||
logToFile(`Error Fetching Credits From: ${url}`);
|
||||
return console.log('Error fetching the credits data.');
|
||||
};
|
||||
data = response.data;
|
||||
});
|
||||
await axios.get(url).then((response) => {
|
||||
if (response.status != 200) {
|
||||
logToFile(`Error Fetching Credits From: ${url}`);
|
||||
return console.log("Error fetching the credits data.");
|
||||
}
|
||||
data = response.data;
|
||||
});
|
||||
|
||||
return data;
|
||||
} catch (error) {
|
||||
console.log('Error fetching the entry credits.', error);
|
||||
console.log("Error fetching the entry credits.", error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -138,18 +136,17 @@ async function fetchPersonDetails(tmdb_id) {
|
||||
logToFile(`Fetching Person Details From: ${url}`);
|
||||
|
||||
let data;
|
||||
await axios.get(url)
|
||||
.then((response) => {
|
||||
if (response.status != 200) {
|
||||
logToFile(`Error Fetching Person Details From: ${url}`);
|
||||
return console.log('Error fetching the person data.');
|
||||
};
|
||||
data = response.data;
|
||||
});
|
||||
await axios.get(url).then((response) => {
|
||||
if (response.status != 200) {
|
||||
logToFile(`Error Fetching Person Details From: ${url}`);
|
||||
return console.log("Error fetching the person data.");
|
||||
}
|
||||
data = response.data;
|
||||
});
|
||||
|
||||
return data;
|
||||
} catch (error) {
|
||||
console.log('Error fetching the person details.', error);
|
||||
console.log("Error fetching the person details.", error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -197,7 +194,7 @@ async function fetchUpcoming(page = 1) {
|
||||
const response = await axios.get(url);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.log('Error fetching upcoming movies.', error);
|
||||
console.log("Error fetching upcoming movies.", error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -209,7 +206,7 @@ async function searchMulti(query, page = 1) {
|
||||
const response = await axios.get(url);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.log('Error searching TMDB.', error);
|
||||
console.log("Error searching TMDB.", error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -221,7 +218,7 @@ async function searchPeople(query, page = 1) {
|
||||
const response = await axios.get(url);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.log('Error searching TMDB people.', error);
|
||||
console.log("Error searching TMDB people.", error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -233,7 +230,7 @@ async function fetchPopularPeople(page = 1) {
|
||||
const response = await axios.get(url);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.log('Error fetching popular people.', error);
|
||||
console.log("Error fetching popular people.", error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -245,7 +242,7 @@ async function fetchPersonCombinedCredits(tmdb_id) {
|
||||
const response = await axios.get(url);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.log('Error fetching person combined credits.', error);
|
||||
console.log("Error fetching person combined credits.", error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -265,7 +262,4 @@ module.exports = {
|
||||
searchMulti,
|
||||
searchPeople,
|
||||
fetchPopularPeople,
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
Reference in new issue
Block a user