• Updates a track's non-skipped playback count

    Parameters

    Returns boolean

    Boolean indicating success or failure

    export function updateNotSkippedTrack(track: SkippedTrack): boolean {
    try {
    // Get current tracks
    const tracks = getSkippedTracks();

    // Find existing track or add new one
    const existingIndex = tracks.findIndex((t) => t.id === track.id);
    if (existingIndex >= 0) {
    // Update with incremented not-skipped count
    const existing = tracks[existingIndex];
    tracks[existingIndex] = {
    ...existing,
    name: track.name || existing.name,
    artist: track.artist || existing.artist,
    notSkippedCount: (existing.notSkippedCount || 0) + 1,
    };
    } else {
    // Add new track with only not-skipped count
    tracks.push({
    ...track,
    skipCount: 0,
    notSkippedCount: 1,
    lastSkipped: "",
    skipTimestamps: [],
    });
    }

    return saveSkippedTracks(tracks);
    } catch (error) {
    console.error("Failed to update not-skipped track:", error);
    return false;
    }
    }