chore(deps): bump PHP to 8.4 and update propresenter/parser with Macro/Label support

- Raise PHP requirement from ^8.2 to ^8.4 (parser requires 8.4)
- New parser classes available: MacrosFileReader, LabelsFileReader,
  Macro, MacroLibrary, MacroCollection, Label, LabelLibrary
- Add programmatic test fixtures for macros-sample.bin + labels-sample.bin
- Fix ServiceAgendaItemFactory sort_order to auto-increment
This commit is contained in:
Thorsten Bus 2026-05-03 22:07:56 +02:00
parent 599b8635c9
commit e489a984eb
7 changed files with 116 additions and 8 deletions

View file

@ -15,7 +15,7 @@
} }
], ],
"require": { "require": {
"php": "^8.2", "php": "^8.4",
"5pm-hdh/churchtools-api": "^2.1", "5pm-hdh/churchtools-api": "^2.1",
"barryvdh/laravel-dompdf": "^3.1", "barryvdh/laravel-dompdf": "^3.1",
"inertiajs/inertia-laravel": "^2.0", "inertiajs/inertia-laravel": "^2.0",

12
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "424677667864ca1fffd6f4af9632aa92", "content-hash": "87837501106e784aa10ddd7743056cba",
"packages": [ "packages": [
{ {
"name": "5pm-hdh/churchtools-api", "name": "5pm-hdh/churchtools-api",
@ -3819,7 +3819,7 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://git.stadtmission-butzbach.de/public/propresenter-php.git", "url": "https://git.stadtmission-butzbach.de/public/propresenter-php.git",
"reference": "22ba4aff7d29683297c0397e1bbc3699dc35ac03" "reference": "9e3e719806d8db3941444b8424fdd56b3b534aa8"
}, },
"require": { "require": {
"google/protobuf": "^4.0", "google/protobuf": "^4.0",
@ -3838,7 +3838,7 @@
} }
}, },
"description": "ProPresenter song file parser", "description": "ProPresenter song file parser",
"time": "2026-03-30T11:26:29+00:00" "time": "2026-05-03T19:40:09+00:00"
}, },
{ {
"name": "psr/clock", "name": "psr/clock",
@ -10867,8 +10867,8 @@
"prefer-stable": true, "prefer-stable": true,
"prefer-lowest": false, "prefer-lowest": false,
"platform": { "platform": {
"php": "^8.2" "php": "^8.4"
}, },
"platform-dev": [], "platform-dev": {},
"plugin-api-version": "2.2.0" "plugin-api-version": "2.9.0"
} }

View file

@ -9,6 +9,8 @@
class ServiceAgendaItemFactory extends Factory class ServiceAgendaItemFactory extends Factory
{ {
private static int $nextSortOrder = 1;
protected $model = ServiceAgendaItem::class; protected $model = ServiceAgendaItem::class;
public function definition(): array public function definition(): array
@ -28,7 +30,7 @@ public function definition(): array
$this->faker->numberBetween(1, 2) $this->faker->numberBetween(1, 2)
), ),
'service_song_id' => null, 'service_song_id' => null,
'sort_order' => $this->faker->numberBetween(1, 20), 'sort_order' => self::$nextSortOrder++,
]; ];
} }

View file

@ -0,0 +1,40 @@
<?php
require_once dirname(__DIR__, 2).'/vendor/autoload.php';
use Rv\Data\Action\Label;
use Rv\Data\Color;
use Rv\Data\ProLabelsDocument;
function makeColor(float $r, float $g, float $b, float $a = 1.0): Color
{
$color = new Color();
$color->setRed($r);
$color->setGreen($g);
$color->setBlue($b);
$color->setAlpha($a);
return $color;
}
$doc = new ProLabelsDocument();
$labels = [
['name' => 'Copyright', 'r' => 0.8, 'g' => 0.2, 'b' => 0.2],
['name' => 'Vers 1', 'r' => 0.2, 'g' => 0.6, 'b' => 0.9],
['name' => 'Refrain', 'r' => 0.9, 'g' => 0.7, 'b' => 0.1],
['name' => 'Brücke', 'r' => 0.5, 'g' => 0.1, 'b' => 0.8],
];
$labelObjects = [];
foreach ($labels as $data) {
$label = new Label();
$label->setText($data['name']);
$label->setColor(makeColor($data['r'], $data['g'], $data['b']));
$labelObjects[] = $label;
}
$doc->setLabels($labelObjects);
$output = $doc->serializeToString();
file_put_contents(__DIR__.'/labels-sample.bin', $output);
echo 'Written '.strlen($output).' bytes'.PHP_EOL;

View file

@ -0,0 +1,66 @@
<?php
require_once dirname(__DIR__, 2).'/vendor/autoload.php';
use Rv\Data\Color;
use Rv\Data\MacrosDocument;
use Rv\Data\MacrosDocument\Macro;
use Rv\Data\MacrosDocument\MacroCollection;
use Rv\Data\MacrosDocument\MacroCollection\Item;
use Rv\Data\UUID;
function makeUuid(string $value): UUID
{
$uuid = new UUID();
$uuid->setString(strtoupper($value));
return $uuid;
}
function makeColor(float $r, float $g, float $b, float $a = 1.0): Color
{
$color = new Color();
$color->setRed($r);
$color->setGreen($g);
$color->setBlue($b);
$color->setAlpha($a);
return $color;
}
$doc = new MacrosDocument();
$macros = [
['uuid' => 'AAAAAAAA-1111-2222-3333-FFFFFFFFFFFF', 'name' => 'Copyright Makro', 'r' => 1.0, 'g' => 0.5, 'b' => 0.0],
['uuid' => 'BBBBBBBB-1111-2222-3333-FFFFFFFFFFFF', 'name' => 'Vers Makro', 'r' => 0.0, 'g' => 0.8, 'b' => 0.2],
['uuid' => 'CCCCCCCC-1111-2222-3333-FFFFFFFFFFFF', 'name' => 'Refrain Makro', 'r' => 0.2, 'g' => 0.4, 'b' => 1.0],
];
$macroObjects = [];
foreach ($macros as $data) {
$macro = new Macro();
$macro->setUuid(makeUuid($data['uuid']));
$macro->setName($data['name']);
$macro->setColor(makeColor($data['r'], $data['g'], $data['b']));
$macro->setTriggerOnStartup(false);
$macro->setImageType(0);
$macroObjects[] = $macro;
}
$doc->setMacros($macroObjects);
$collection = new MacroCollection();
$collection->setUuid(makeUuid('8D02FC57-83F8-4042-9B90-81C229728426'));
$collection->setName('--MAIN--');
$items = [];
foreach ($macros as $data) {
$item = new Item();
$item->setMacroId(makeUuid($data['uuid']));
$items[] = $item;
}
$collection->setItems($items);
$doc->setMacroCollections([$collection]);
$output = $doc->serializeToString();
file_put_contents(__DIR__.'/macros-sample.bin', $output);
echo 'Written '.strlen($output).' bytes'.PHP_EOL;

BIN
tests/fixtures/labels-sample.bin vendored Normal file

Binary file not shown.

BIN
tests/fixtures/macros-sample.bin vendored Normal file

Binary file not shown.