api fixes for config not loading during sycn on new threads

This commit is contained in:
CyferShepard
2025-03-30 13:52:43 +02:00
parent 1a57684624
commit 17fb7d6813
2 changed files with 56 additions and 14 deletions

View File

@@ -106,7 +106,10 @@ class EmbyAPI {
async getUsers() {
if (!this.configReady) {
return [];
const success = await this.#fetchConfig();
if (!success) {
return [];
}
}
try {
const url = `${this.config.JF_HOST}/Users`;
@@ -190,7 +193,10 @@ class EmbyAPI {
async getItemsFromParentId({ id, itemid, params, ws, syncTask, wsMessage }) {
if (!this.configReady) {
return [];
const success = await this.#fetchConfig();
if (!success) {
return [];
}
}
try {
let url = `${this.config.JF_HOST}/Items?ParentId=${id}`;
@@ -269,7 +275,10 @@ class EmbyAPI {
async getItemInfo({ itemID, userid }) {
if (!this.configReady) {
return [];
const success = await this.#fetchConfig();
if (!success) {
return [];
}
}
try {
if (!userid || userid == null) {
@@ -325,7 +334,10 @@ class EmbyAPI {
async getSeasons(SeriesId) {
if (!this.configReady) {
return [];
const success = await this.#fetchConfig();
if (!success) {
return [];
}
}
let url = `${this.config.JF_HOST}/Shows/${SeriesId}/Seasons`;
try {
@@ -344,7 +356,10 @@ class EmbyAPI {
async getEpisodes({ SeriesId, SeasonId }) {
if (!this.configReady) {
return [];
const success = await this.#fetchConfig();
if (!success) {
return [];
}
}
try {
let url = `${this.config.JF_HOST}/Shows/${SeriesId}/Episodes?seasonId=${SeasonId}`;
@@ -364,7 +379,10 @@ class EmbyAPI {
async getRecentlyAdded({ libraryid, limit = 20, userid }) {
if (!this.configReady) {
return [];
const success = await this.#fetchConfig();
if (!success) {
return [];
}
}
try {
if (!userid || userid == null) {
@@ -476,7 +494,10 @@ class EmbyAPI {
async StatsSubmitCustomQuery(query) {
if (!this.configReady) {
return [];
const success = await this.#fetchConfig();
if (!success) {
return [];
}
}
try {
let url = `${this.config.JF_HOST}/user_usage_stats/submit_custom_query`;

View File

@@ -107,7 +107,10 @@ class JellyfinAPI {
async getUsers() {
if (!this.configReady) {
return [];
const success = await this.#fetchConfig();
if (!success) {
return [];
}
}
try {
const url = `${this.config.JF_HOST}/Users`;
@@ -190,7 +193,10 @@ class JellyfinAPI {
async getItemsFromParentId({ id, itemid, params, ws, syncTask, wsMessage }) {
if (!this.configReady) {
return [];
const success = await this.#fetchConfig();
if (!success) {
return [];
}
}
try {
let url = `${this.config.JF_HOST}/Items?ParentId=${id}`;
@@ -267,7 +273,10 @@ class JellyfinAPI {
async getItemInfo({ itemID, userid }) {
if (!this.configReady) {
return [];
const success = await this.#fetchConfig();
if (!success) {
return [];
}
}
try {
if (!userid || userid == null) {
@@ -323,7 +332,10 @@ class JellyfinAPI {
async getSeasons(SeriesId) {
if (!this.configReady) {
return [];
const success = await this.#fetchConfig();
if (!success) {
return [];
}
}
let url = `${this.config.JF_HOST}/Shows/${SeriesId}/Seasons`;
try {
@@ -342,7 +354,10 @@ class JellyfinAPI {
async getEpisodes({ SeriesId, SeasonId }) {
if (!this.configReady) {
return [];
const success = await this.#fetchConfig();
if (!success) {
return [];
}
}
try {
let url = `${this.config.JF_HOST}/Shows/${SeriesId}/Episodes?seasonId=${SeasonId}`;
@@ -362,7 +377,10 @@ class JellyfinAPI {
async getRecentlyAdded({ libraryid, limit = 20, userid }) {
if (!this.configReady) {
return [];
const success = await this.#fetchConfig();
if (!success) {
return [];
}
}
try {
if (!userid || userid == null) {
@@ -474,7 +492,10 @@ class JellyfinAPI {
async StatsSubmitCustomQuery(query) {
if (!this.configReady) {
return [];
const success = await this.#fetchConfig();
if (!success) {
return [];
}
}
try {
let url = `${this.config.JF_HOST}/user_usage_stats/submit_custom_query`;