B: switched to using config service in tmdb service
This commit is contained in:
1 parent
2d7bf91543
commit
cc1d1cdadf
2 files changed
+18
-5
No files matched your search
@@ -1,11 +1,14 @@
|
||||
const axios = require('axios');
|
||||
const { logToFile } = require('./logService');
|
||||
const tmdb_apiKey = "5323ef3dc430df54dcb9e58c37fd22bb";
|
||||
const configService = require('./configService');
|
||||
|
||||
const TMDB_APIURL = configService.getTmdbApiUrl();
|
||||
const TMDB_APIKEY = configService.getTmdbApiKey();
|
||||
|
||||
async function fetchEntryData(tmdb_id, is_tvserie) {
|
||||
try {
|
||||
let type = is_tvserie ? "tv" : "movie";
|
||||
let url = `http://api.themoviedb.org/3/${type}/${tmdb_id}?api_key=${tmdb_apiKey}&language=en-US`
|
||||
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)
|
||||
@@ -28,7 +31,7 @@ async function fetchEntryData(tmdb_id, is_tvserie) {
|
||||
async function fetchSeasonData(tmdbTvId, seasonNumber) {
|
||||
// fetching the informations
|
||||
try {
|
||||
let url = `http://api.themoviedb.org/3/tv/${tmdbTvId}/season/${seasonNumber}?api_key=${tmdb_apiKey}&language=en-US`
|
||||
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)
|
||||
@@ -50,7 +53,7 @@ async function fetchSeasonData(tmdbTvId, seasonNumber) {
|
||||
async function fetchEntryMedia(tmdb_id, is_tvserie) {
|
||||
try {
|
||||
let type = is_tvserie ? "tv" : "movie";
|
||||
let url = `http://api.themoviedb.org/3/${type}/${tmdb_id}/images?api_key=${tmdb_apiKey}`
|
||||
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)
|
||||
@@ -71,7 +74,7 @@ async function fetchEntryMedia(tmdb_id, is_tvserie) {
|
||||
|
||||
async function fetchCollectionData(collectionId) {
|
||||
try {
|
||||
let url = `http://api.themoviedb.org/3/collection/${collectionId}?api_key=${tmdb_apiKey}&language=en-US`
|
||||
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)
|
||||
|
||||
Reference in new issue
Block a user