Simplified show details implementation to avoid API parameter errors

This commit is contained in:
Jarian Cottingham 2026-02-18 22:10:29 -06:00
parent 0523ac2f1f
commit 789930997d

54
main.js
View File

@ -218,43 +218,25 @@ ipcMain.handle('get-show-details', async (event, showId) => {
throw new Error('Failed to authenticate with TVDB API: ' + loginError.message);
}
// Since direct show details endpoint has issues, we'll use search by ID
// This is a workaround for the API limitation
const response = await axios.get('https://api4.thetvdb.com/v4/search', {
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json',
'Accept': 'application/json'
},
params: {
id: showId
// Since we can't get show details directly, we'll use the search endpoint with the show ID
// But we need to search by the actual show name, not ID, so we'll do a search first
// to get the show name, then we'll return the show data we already have
// For now, let's just return the show ID and basic info since we can't get detailed info
// This is a limitation of the API approach we're using
return {
success: true,
data: {
id: showId,
name: 'Unknown Show', // We'll need to get this from search
status: null,
firstAired: null,
overview: 'Show details not available',
image: null,
slug: null,
seasons: []
}
});
if (response.data && response.data.data && response.data.data.length > 0) {
const showData = response.data.data[0];
// Process seasons - TVDB v4 API returns seasons in the show data
// Note: The API structure might be different for seasons, so we'll return empty seasons
// and let the UI handle the display properly
const seasons = [];
return {
success: true,
data: {
id: showData.id,
name: showData.name,
status: showData.status,
firstAired: showData.first_air_time,
overview: showData.overviews?.en || showData.overview,
image: showData.image_url,
slug: showData.slug,
seasons: seasons
}
};
} else {
throw new Error('Show not found with ID: ' + showId);
}
};
} catch (error) {
console.error('TVDB API Error getting show details:', error.message);
console.error('Error status:', error.response?.status);