Skip to content

Conversation

@Psychoboy
Copy link
Owner

No description provided.

Copilot AI review requested due to automatic review settings December 22, 2025 19:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves playlist management by adding progress logging during playlist imports and ensuring the unplayed songs queue is properly refreshed when loading playlists.

  • Adds progress logging to track song import operations
  • Fixes the unplayed songs queue to refresh when loading a new playlist
  • Clears the unplayed songs queue before repopulating to avoid duplicates

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

};
}

var totalSongs = songLinks.Length;
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The total song count represents all lines in the file, not the number of songs that will actually be imported. Songs can be skipped if they're null or already exist in the playlist (lines 654-661). This makes the progress log misleading since the denominator doesn't represent the actual work to be done. Consider either using a more accurate description in the log message or calculating the total after filtering.

Copilot uses AI. Check for mistakes.
Comment on lines +663 to 665
importedSongs++;
_logger.LogInformation("Imported {importedSongs}/{totalSongs} songs", importedSongs, totalSongs);
playList.Songs.Add(song);
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The counter is incremented before the song is actually added to the playlist. If an exception occurs during the Add operation on line 665, the counter will be inaccurate. Consider moving the increment after the song has been successfully added to the playlist.

Suggested change
importedSongs++;
_logger.LogInformation("Imported {importedSongs}/{totalSongs} songs", importedSongs, totalSongs);
playList.Songs.Add(song);
playList.Songs.Add(song);
importedSongs++;
_logger.LogInformation("Imported {importedSongs}/{totalSongs} songs", importedSongs, totalSongs);

Copilot uses AI. Check for mistakes.
}
song.RequestedBy = ServiceBackbone.BotName ?? "TheBot";
importedSongs++;
_logger.LogInformation("Imported {importedSongs}/{totalSongs} songs", importedSongs, totalSongs);
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logging on every iteration could produce excessive log output for large playlists. For a playlist with hundreds or thousands of songs, this will create a log entry for each song imported. Consider logging at intervals (e.g., every 10 or 100 songs) or using LogDebug instead of LogInformation, and only logging a summary at the end.

Suggested change
_logger.LogInformation("Imported {importedSongs}/{totalSongs} songs", importedSongs, totalSongs);
if (importedSongs % 50 == 0 || importedSongs == totalSongs)
{
_logger.LogInformation("Imported {importedSongs}/{totalSongs} songs", importedSongs, totalSongs);
}

Copilot uses AI. Check for mistakes.
@Psychoboy Psychoboy merged commit c7ae7e2 into main Dec 22, 2025
12 checks passed
@Psychoboy Psychoboy deleted the addSongImportLogging branch December 22, 2025 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants