mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-12 03:56:15 -08:00
fix: only sync Stalker playlists to SQLite and normalize playlist ID
- Add check for macAddress and portalUrl to ensure only Stalker playlists are synced to the SQLite database - Normalize playlist._id to string before passing to IPC handlers Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0643acac3a
commit
8aac765694
1 file changed
+16
-4
@@ -587,14 +587,23 @@ export const StalkerStore = signalStore(
|
||||
patchState(store, { currentPlaylist: playlist });
|
||||
|
||||
// Ensure Stalker playlist exists in SQLite for playback positions
|
||||
if (playlist && dataService.isElectron && playlist._id) {
|
||||
// Only sync if this is actually a Stalker playlist (has macAddress and portalUrl)
|
||||
if (
|
||||
playlist &&
|
||||
dataService.isElectron &&
|
||||
playlist._id &&
|
||||
playlist.macAddress &&
|
||||
playlist.portalUrl
|
||||
) {
|
||||
try {
|
||||
const playlistId = String(playlist._id);
|
||||
// Check if playlist exists in SQLite
|
||||
const existing = await window.electron.dbGetPlaylist(playlist._id);
|
||||
const existing =
|
||||
await window.electron.dbGetPlaylist(playlistId);
|
||||
if (!existing) {
|
||||
// Create playlist in SQLite
|
||||
await window.electron.dbCreatePlaylist({
|
||||
id: playlist._id,
|
||||
id: playlistId,
|
||||
name: playlist.title || '',
|
||||
macAddress: playlist.macAddress || '',
|
||||
url: playlist.portalUrl || '',
|
||||
@@ -602,7 +611,10 @@ export const StalkerStore = signalStore(
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error syncing Stalker playlist to SQLite:', error);
|
||||
console.error(
|
||||
'Error syncing Stalker playlist to SQLite:',
|
||||
error
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user