2.9 KiB
2.9 KiB
Analyze a file format of a song.
Spec
File: ./Test.pro (file ext are always .pro)
- every song contains parts (name group here) (here: Verse 1, Verse 2, Chorus, ...) but could be any name
- every group contains 1-x slides
- every song contains different arrangements (here normal and test2) that defines the existence and the order of the groups
- every slide CAN have another textbox which contains a translated version of the first textbox
Status
- Analyse the file structure and find all of the described specs.
- Test and verify if the definition is correct - there is a
all-songsdirectory with lot of examples. - Describe the structure for future AI prompts to use these files in
spec/pp_song_spec.mdand describe the usage in theAGENTS.md(replace obsolete commands) - Write a PHP module (is later used in laravel) in
./phpwhich can parse a song and let get/set every aspect of structure. Use Objects here (Song, Group, Slide, Arrangement, etc) - Create a simple PHP cli tool, which receive a param with a song file and show the structure of the song.
PHP Module Usage
The ProPresenter song parser is available as a PHP module in ./php. Use it to read, parse, and modify .pro song files.
Reading a Song
use ProPresenter\Parser\ProFileReader;
use ProPresenter\Parser\ProFileWriter;
$song = ProFileReader::read('path/to/song.pro');
Accessing Song Structure
// Basic song info
echo $song->getName(); // Song name
echo $song->getUuid(); // Song UUID
// Groups (song parts like Verse 1, Chorus, etc.)
foreach ($song->getGroups() as $group) {
echo $group->getName(); // "Verse 1", "Chorus", etc.
$slides = $song->getSlidesForGroup($group);
foreach ($slides as $slide) {
echo $slide->getPlainText();
if ($slide->hasTranslation()) {
echo $slide->getTranslation()->getPlainText();
}
}
}
// Arrangements (different song orderings)
foreach ($song->getArrangements() as $arr) {
$groups = $song->getGroupsForArrangement($arr);
// Groups in arrangement order
}
Modifying and Writing
$song->setName("New Name");
ProFileWriter::write($song, 'output.pro');
CLI Tool
Parse and display song structure from the command line:
php php/bin/parse-song.php path/to/song.pro
Format Specification
For detailed information about the .pro file format, see spec/pp_song_spec.md.
Key Files
php/src/Song.php— Top-level song wrapperphp/src/Group.php— Group (song part) wrapperphp/src/Slide.php— Slide wrapper with text accessphp/src/TextElement.php— Text element with label + plain textphp/src/Arrangement.php— Arrangement wrapperphp/src/RtfExtractor.php— RTF to plain text converterphp/src/ProFileReader.php— Reads .pro filesphp/src/ProFileWriter.php— Writes .pro filesphp/bin/parse-song.php— CLI toolspec/pp_song_spec.md— Format specification