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 3d85f7b84d
commit 17a53345eb

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); 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) { // For now, let's just return the show ID and basic info since we can't get detailed info
const showData = response.data.data[0]; // This is a limitation of the API approach we're using
return {
// Process seasons - TVDB v4 API returns seasons in the show data success: true,
// Note: The API structure might be different for seasons, so we'll return empty seasons data: {
// and let the UI handle the display properly id: showId,
const seasons = []; name: 'Unknown Show', // We'll need to get this from search
status: null,
return { firstAired: null,
success: true, overview: 'Show details not available',
data: { image: null,
id: showData.id, slug: null,
name: showData.name, seasons: []
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) { } 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);