[AI] add Song metadata getters/setters for CCLI, category, notes

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
Thorsten Bus 2026-03-01 16:34:00 +01:00
parent 3351b7f138
commit 83fb1a71f4
2 changed files with 204 additions and 0 deletions

View file

@ -5,6 +5,8 @@ declare(strict_types=1);
namespace ProPresenter\Parser;
use Rv\Data\Presentation;
use Rv\Data\Presentation\CCLI;
use Rv\Data\UUID;
class Song
{
@ -63,6 +65,118 @@ class Song
$this->presentation->setName($name);
}
public function getCcliAuthor(): string
{
return $this->presentation->getCcli()?->getAuthor() ?? '';
}
public function setCcliAuthor(string $author): void
{
$this->ensureCcli()->setAuthor($author);
}
public function getCcliSongTitle(): string
{
return $this->presentation->getCcli()?->getSongTitle() ?? '';
}
public function setCcliSongTitle(string $title): void
{
$this->ensureCcli()->setSongTitle($title);
}
public function getCcliPublisher(): string
{
return $this->presentation->getCcli()?->getPublisher() ?? '';
}
public function setCcliPublisher(string $publisher): void
{
$this->ensureCcli()->setPublisher($publisher);
}
public function getCcliCopyrightYear(): int
{
return $this->presentation->getCcli()?->getCopyrightYear() ?? 0;
}
public function setCcliCopyrightYear(int $year): void
{
$this->ensureCcli()->setCopyrightYear($year);
}
public function getCcliSongNumber(): int
{
return $this->presentation->getCcli()?->getSongNumber() ?? 0;
}
public function setCcliSongNumber(int $number): void
{
$this->ensureCcli()->setSongNumber($number);
}
public function getCcliDisplay(): bool
{
return $this->presentation->getCcli()?->getDisplay() ?? false;
}
public function setCcliDisplay(bool $display): void
{
$this->ensureCcli()->setDisplay($display);
}
public function getCcliArtistCredits(): string
{
return $this->presentation->getCcli()?->getArtistCredits() ?? '';
}
public function setCcliArtistCredits(string $credits): void
{
$this->ensureCcli()->setArtistCredits($credits);
}
public function getCcliAlbum(): string
{
return $this->presentation->getCcli()?->getAlbum() ?? '';
}
public function setCcliAlbum(string $album): void
{
$this->ensureCcli()->setAlbum($album);
}
public function getCategory(): string
{
return $this->presentation->getCategory();
}
public function setCategory(string $category): void
{
$this->presentation->setCategory($category);
}
public function getNotes(): string
{
return $this->presentation->getNotes();
}
public function setNotes(string $notes): void
{
$this->presentation->setNotes($notes);
}
public function getSelectedArrangementUuid(): string
{
return $this->presentation->getSelectedArrangement()?->getString() ?? '';
}
public function setSelectedArrangementUuid(string $uuid): void
{
$arrangementUuid = new UUID();
$arrangementUuid->setString($uuid);
$this->presentation->setSelectedArrangement($arrangementUuid);
}
public function getGroups(): array
{
return $this->groups;
@ -125,4 +239,15 @@ class Song
{
return $this->presentation;
}
private function ensureCcli(): CCLI
{
$ccli = $this->presentation->getCcli();
if ($ccli === null) {
$ccli = new CCLI();
$this->presentation->setCcli($ccli);
}
return $ccli;
}
}

View file

@ -0,0 +1,79 @@
<?php
declare(strict_types=1);
namespace ProPresenter\Parser\Tests;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use ProPresenter\Parser\Song;
use Rv\Data\Presentation;
class SongMetadataTest extends TestCase
{
#[Test]
public function ccliAuthorRoundTripWorks(): void
{
$song = new Song(new Presentation());
$song->setCcliAuthor('Author Name');
$this->assertSame('Author Name', $song->getCcliAuthor());
}
#[Test]
public function ccliSongNumberRoundTripWorks(): void
{
$song = new Song(new Presentation());
$song->setCcliSongNumber(123456);
$this->assertSame(123456, $song->getCcliSongNumber());
}
#[Test]
public function categoryRoundTripWorks(): void
{
$song = new Song(new Presentation());
$song->setCategory('Worship');
$this->assertSame('Worship', $song->getCategory());
}
#[Test]
public function notesRoundTripWorks(): void
{
$song = new Song(new Presentation());
$song->setNotes('Use acoustic intro');
$this->assertSame('Use acoustic intro', $song->getNotes());
}
#[Test]
public function selectedArrangementUuidRoundTripWorks(): void
{
$song = new Song(new Presentation());
$uuid = '12345678-1234-4234-8234-123456789abc';
$song->setSelectedArrangementUuid($uuid);
$this->assertSame($uuid, $song->getSelectedArrangementUuid());
}
#[Test]
public function ccliGettersReturnDefaultsWithoutCcliData(): void
{
$song = new Song(new Presentation());
$this->assertSame('', $song->getCcliAuthor());
$this->assertSame('', $song->getCcliSongTitle());
$this->assertSame('', $song->getCcliPublisher());
$this->assertSame(0, $song->getCcliCopyrightYear());
$this->assertSame(0, $song->getCcliSongNumber());
$this->assertFalse($song->getCcliDisplay());
$this->assertSame('', $song->getCcliArtistCredits());
$this->assertSame('', $song->getCcliAlbum());
}
}