Phase 1: Project scaffold

- Quarkus Maven project with all dependencies
- SQLite DatabaseService with DAO methods
- MusicBrainz REST client with DTOs
- ArtistService, ReleaseGroupService, CacheService, FeedService
- HTMX web controllers (ReleasesPage, ArtistsPage, ArtistController, FeedController, SettingsController)
- RSS feed builder using Rome library
- Qute templates with daisyUI theme switching
- Base layout with navbar, search, theme picker, settings modal
This commit is contained in:
2026-07-02 15:29:16 +02:00
commit f0be591faf
26 changed files with 1646 additions and 0 deletions
@@ -0,0 +1,57 @@
package com.discdrop.service;
import com.discdrop.db.DatabaseService;
import com.discdrop.db.Record.ReleaseGroup;
import com.discdrop.db.Record.TrackedArtist;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import java.util.ArrayList;
import java.util.List;
@ApplicationScoped
public class FeedService {
@Inject
ArtistService artistService;
@Inject
ReleaseGroupService releaseGroupService;
@Inject
CacheService cacheService;
@Inject
DatabaseService db;
public List<ReleaseGroup> getFeedEntries() {
var artists = artistService.findAll();
if (artists.isEmpty()) return List.of();
var artistMbids = new ArrayList<String>();
for (var a : artists) {
if (cacheService.needsRefresh(a.mbid())) {
var types = getMonitoredTypes(a);
releaseGroupService.fetchAndCache(a.mbid(), a.name(), types);
}
artistMbids.add(a.mbid());
}
var allTypes = List.of("Album", "Single", "EP", "Broadcast", "Other");
var monitoredTypes = new ArrayList<String>();
for (var a : artists) {
monitoredTypes.addAll(getMonitoredTypes(a));
}
return db.getFeed(artistMbids, monitoredTypes.isEmpty() ? allTypes : monitoredTypes);
}
private List<String> getMonitoredTypes(TrackedArtist a) {
var types = new ArrayList<String>();
if (a.albumMonitored()) types.add("Album");
if (a.singleMonitored()) types.add("Single");
if (a.epMonitored()) types.add("EP");
if (a.broadcastMonitored()) types.add("Broadcast");
if (a.otherMonitored()) types.add("Other");
return types;
}
}