feat: expand media system definitions#1096
Conversation
📝 WalkthroughWalkthroughAdds system definitions and metadata assets for applications, TV seasons, music videos, podcast series and episodes, and audiobooks, with registry mappings and expanded validation tests. ChangesMedia system definitions
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pkg/database/systemdefs/systemdefs_test.go`:
- Around line 720-731: Extend the table-driven lookup tests in the system
definition test suite to cover the new aliases and slugs: map App, Apps, and
Software to SystemApplication; map podcastshow, podcastshows, and
podcastepisodes to SystemPodcastSeries or SystemPodcastEpisode as appropriate;
and verify podcast lookups fall back to SystemAudio when required. Keep the
existing media-type assertions unchanged.
In `@pkg/database/systemdefs/systemdefs.go`:
- Around line 458-469: Move the existing system-ID constant block containing
SystemApplication through SystemAudiobook near the top of systemdefs.go, before
functions and methods such as GetMediaType, MapKeys, AlphaMapKeys, and
GetSystem. Preserve all constant names and values without other changes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: f4f10a38-a895-42af-975c-c9f7a49d2600
📒 Files selected for processing (8)
pkg/assets/systems/Application.jsonpkg/assets/systems/Audiobook.jsonpkg/assets/systems/MusicVideo.jsonpkg/assets/systems/PodcastEpisode.jsonpkg/assets/systems/PodcastSeries.jsonpkg/assets/systems/TVSeason.jsonpkg/database/systemdefs/systemdefs.gopkg/database/systemdefs/systemdefs_test.go
| {SystemApplication, MediaTypeApplication}, | ||
| {SystemMovie, MediaTypeMovie}, | ||
| {SystemTVEpisode, MediaTypeTVShow}, | ||
| {SystemTVSeason, MediaTypeTVShow}, | ||
| {SystemTVShow, MediaTypeTVShow}, | ||
| {SystemMusicTrack, MediaTypeMusic}, | ||
| {SystemMusicArtist, MediaTypeMusic}, | ||
| {SystemMusicAlbum, MediaTypeMusic}, | ||
| {SystemMusicVideo, MediaTypeMusic}, | ||
| {SystemPodcastSeries, MediaTypeAudio}, | ||
| {SystemPodcastEpisode, MediaTypeAudio}, | ||
| {SystemAudiobook, MediaTypeAudio}, |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Map the target test file and nearby implementation files
git ls-files pkg/database/systemdefs
echo '--- systemdefs_test.go outline ---'
ast-grep outline pkg/database/systemdefs/systemdefs_test.go --view expanded || true
echo '--- grep for relevant identifiers ---'
rg -n "SystemApplication|SystemPodcast|MediaTypeApplication|alias|slug|fallback|registry|cover" pkg/database/systemdefs -g '*.go' || trueRepository: ZaparooProject/zaparoo-core
Length of output: 16688
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo '--- systemdefs_test.go relevant sections ---'
sed -n '681,930p' pkg/database/systemdefs/systemdefs_test.go
echo '--- systemdefs.go relevant definitions ---'
sed -n '1190,1295p' pkg/database/systemdefs/systemdefs.goRepository: ZaparooProject/zaparoo-core
Length of output: 9738
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo '--- TestLookupSystemExact / Aliases / NaturalLanguage / SlugDerivation sections ---'
sed -n '240,540p' pkg/database/systemdefs/systemdefs_test.goRepository: ZaparooProject/zaparoo-core
Length of output: 9609
Add lookup coverage for the new systems. These rows only assert media types; add table-driven cases for SystemApplication aliases (App, Apps, Software), SystemPodcastSeries/SystemPodcastEpisode slugs (podcastshow, podcastshows, podcastepisodes), and their fallback to SystemAudio so registry mistakes don’t slip through.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@pkg/database/systemdefs/systemdefs_test.go` around lines 720 - 731, Extend
the table-driven lookup tests in the system definition test suite to cover the
new aliases and slugs: map App, Apps, and Software to SystemApplication; map
podcastshow, podcastshows, and podcastepisodes to SystemPodcastSeries or
SystemPodcastEpisode as appropriate; and verify podcast lookups fall back to
SystemAudio when required. Keep the existing media-type assertions unchanged.
Source: Coding guidelines
| SystemApplication = "Application" | ||
| SystemMovie = "Movie" | ||
| SystemTVEpisode = "TVEpisode" | ||
| SystemTVSeason = "TVSeason" | ||
| SystemTVShow = "TVShow" | ||
| SystemMusicTrack = "MusicTrack" | ||
| SystemMusicArtist = "MusicArtist" | ||
| SystemMusicAlbum = "MusicAlbum" | ||
| SystemMusicVideo = "MusicVideo" | ||
| SystemPodcastSeries = "PodcastSeries" | ||
| SystemPodcastEpisode = "PodcastEpisode" | ||
| SystemAudiobook = "Audiobook" |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy lift
Move the new constants before functions and methods.
These constants are defined after methods such as GetMediaType, MapKeys, AlphaMapKeys, and GetSystem. Move the existing system-ID constant block near the top of the file.
As per coding guidelines, **/*.go: Define Go types and consts near the top of the file, before functions and methods.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@pkg/database/systemdefs/systemdefs.go` around lines 458 - 469, Move the
existing system-ID constant block containing SystemApplication through
SystemAudiobook near the top of systemdefs.go, before functions and methods such
as GetMediaType, MapKeys, AlphaMapKeys, and GetSystem. Preserve all constant
names and values without other changes.
Source: Coding guidelines
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Summary
Verification
task lint-fixtask testSummary by CodeRabbit