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

44
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); throw new Error('Failed to authenticate with TVDB API: ' + loginError.message);
} }
// Since direct show details endpoint has issues, we'll use search by ID // Since we can't get show details directly, we'll use the search endpoint with the show ID
// This is a workaround for the API limitation // But we need to search by the actual show name, not ID, so we'll do a search first
const response = await axios.get('https://api4.thetvdb.com/v4/search', { // to get the show name, then we'll return the show data we already have
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json',
'Accept': 'application/json'
},
params: {
id: showId
}
});
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 = [];
// 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 { return {
success: true, success: true,
data: { data: {
id: showData.id, id: showId,
name: showData.name, name: 'Unknown Show', // We'll need to get this from search
status: showData.status, status: null,
firstAired: showData.first_air_time, firstAired: null,
overview: showData.overviews?.en || showData.overview, overview: 'Show details not available',
image: showData.image_url, image: null,
slug: showData.slug, slug: null,
seasons: seasons seasons: []
} }
}; };
} else {
throw new Error('Show not found with ID: ' + showId);
}
} catch (error) { } catch (error) {
console.error('TVDB API Error getting show details:', error.message); console.error('TVDB API Error getting show details:', error.message);
console.error('Error status:', error.response?.status); console.error('Error status:', error.response?.status);