Simplified show details implementation to avoid API parameter errors
This commit is contained in:
parent
3d85f7b84d
commit
17a53345eb
54
main.js
54
main.js
@ -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}`,
|
// For now, let's just return the show ID and basic info since we can't get detailed info
|
||||||
'Content-Type': 'application/json',
|
// This is a limitation of the API approach we're using
|
||||||
'Accept': 'application/json'
|
return {
|
||||||
},
|
success: true,
|
||||||
params: {
|
data: {
|
||||||
id: showId
|
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) {
|
} 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);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user