Merge branch 'main' of github.com:monochrome-music/monochrome

This commit is contained in:
Samidy 2026-03-11 09:13:33 +03:00
commit c4af3ea204
3 changed files with 13 additions and 14 deletions

View file

@ -1106,12 +1106,12 @@ export class LosslessAPI {
const artistData = await this.getArtist(artist.id, { lightweight: true, skipCache: options.refresh });
if (artistData && artistData.tracks && artistData.tracks.length > 0) {
const availableTracks = artistData.tracks.filter((track) => !seenTrackIds.has(track.id));
const newTracks = options.knownTrackIds
? availableTracks.filter(t => !options.knownTrackIds.has(t.id))
const newTracks = options.knownTrackIds
? availableTracks.filter((t) => !options.knownTrackIds.has(t.id))
: availableTracks;
const knownTracks = options.knownTrackIds
? availableTracks.filter(t => options.knownTrackIds.has(t.id))
const knownTracks = options.knownTrackIds
? availableTracks.filter((t) => options.knownTrackIds.has(t.id))
: [];
const shuffledNew = [...newTracks].sort(() => Math.random() - 0.5);

View file

@ -1063,9 +1063,8 @@ _resetDashPlayer() {
}
const shuffledSeeds = [...this.radioSeeds].sort(() => 0.5 - Math.random());
const seeds = shuffledSeeds.length > 0
? shuffledSeeds.slice(0, 5)
: this.currentTrack ? [this.currentTrack] : [];
const seeds =
shuffledSeeds.length > 0 ? shuffledSeeds.slice(0, 5) : this.currentTrack ? [this.currentTrack] : [];
if (seeds.length === 0) {
return;
@ -1084,7 +1083,7 @@ _resetDashPlayer() {
]);
const recommendations = await this.api.getRecommendedTracksForPlaylist(seeds, 20, {
knownTrackIds: knownTrackIds
knownTrackIds: knownTrackIds,
});
if (recommendations && recommendations.length > 0) {

View file

@ -2202,21 +2202,21 @@ export class UIRenderer {
try {
const seeds = providedSeeds || (await this.getSeeds());
const [favorites, playlists, history] = await Promise.all([
db.getFavorites('track'),
db.getPlaylists(true),
db.getHistory(),
]);
const knownTrackIds = new Set([
...favorites.map(t => t.id),
...playlists.flatMap(p => (p.tracks || []).map(t => t.id)),
...history.map(t => t.id)
...favorites.map((t) => t.id),
...playlists.flatMap((p) => (p.tracks || []).map((t) => t.id)),
...history.map((t) => t.id),
]);
const recommendedTracks = await this.api.getRecommendedTracksForPlaylist(seeds, 20, {
skipCache: forceRefresh,
knownTrackIds: knownTrackIds
knownTrackIds: knownTrackIds,
});
const filteredTracks = await this.filterUserContent(recommendedTracks, 'track');