Initial commit

This commit is contained in:
isUnknown 2026-02-12 15:22:46 +01:00
commit 65e0da7e11
1397 changed files with 596542 additions and 0 deletions

View file

@ -0,0 +1,36 @@
<?php
// UPDATE TRACKS INDEX OF ALL RELEASE EACH TIME SOMETHING HAPPENS WITH A RELEASE
// Each time something happens with a page
kirby()->hook('panel.page.*', function($page, $oldPage = null) {
// If the page is a release
if($page->intendedTemplate() == 'release') {
// Get all artists
$artists = site()->index()->filterBy('intendedTemplate', 'artist');
// For each artist
foreach ($artists as $key => $a) {
$index = 0;
// For each release of the artist
foreach ($a->children()->published() as $key => $p) {
// Get all tracks of the release
$tracks = $p->tracklist()->toStructure();
// For each track
foreach ($tracks as $key => $t) {
// If the track has and audio file
if($file = $t->audioFile()->toFile()) {
// Update the track index
$file->update(['trackIndex' => $index]);
$index++;
}
}
}
}
}
});