Determines if a track should be suggested for removal from library

Applies configured threshold criteria to identify tracks that are frequently skipped and may be candidates for removal from the user's library. This is the core decision algorithm for both automated and manual library cleanup.

Uses error handling to ensure robust evaluation even with incomplete data.

export const shouldSuggestRemoval = (
track: SkippedTrack,
skipThreshold: number,
timeframeInDays: number,
): boolean => {
try {
const recentSkips = getRecentSkipCount(track, timeframeInDays);
return recentSkips >= skipThreshold;
} catch (error) {
console.error("Error calculating skip suggestion:", error);
return false;
}
};
  • Parameters

    • track: SkippedTrack

      Track data object to evaluate

    • skipThreshold: number

      Minimum number of skips to trigger suggestion

    • timeframeInDays: number

      Timeframe to consider for skip analysis

    Returns boolean

    Boolean indicating if the track meets removal criteria