Array of track data with skip statistics
export function getSkippedTracks(): SkippedTrack[] {
try {
if (fs.existsSync(skippedTracksFilePath)) {
const fileContent = fs.readFileSync(skippedTracksFilePath, "utf-8");
const tracks = JSON.parse(fileContent) as SkippedTrack[];
// Handle potential naming differences between skipTimestamps and skipHistory
return tracks.map((track) => {
if (!track.skipTimestamps && track.skipHistory) {
// Map legacy skipHistory to skipTimestamps
return {
...track,
skipTimestamps: track.skipHistory,
};
}
return track;
});
}
} catch (error) {
console.error("Error reading skipped tracks file:", error);
}
return [];
}
Retrieves skipped tracks data from storage