A small plugin to with ID3 tags on audio files.
Features:
This plugin is free but if you use it in a commercial project please consider to
Download and copy this repository to /site/plugins/kirby-gilmour
.
composer require hashandsalt/kirby-gilmour
First, of course, you need some audio files on your page, and optionally, setup a files blueprint to store data. You can use the one in the plugin by extending it into your own blueprints, or just copy it and use it as a starting point.
The following information will be available:
You can toggle the generation of album cover artwork, and set the blueprint for cover art images by adding the following options to your config:
'hashandsalt.gilmour.ripcover' => true,
'hashandsalt.gilmour.imagetemplate' => 'imageart',
You can use the file method to get the data directly from an audio file:
<?= $file->id3('artist') ?>
Or you can use the data fetched by the hook:
<?= $file->artist() ?>
To get the cover art image:
<img src="https://github.com/HashandSalt/Kirby3-Gilmour/raw/master/<?= $file->id3('cover')?>">
Loop through some files getting the data directly:
<?php foreach($page->audio() as $mp3direct): ?>
<div class="album">
<?php if($coverimage = $mp3direct->cover()->tofile() ): ?>
<img alt="<?= $mp3direct->title() ?> - <?= $mp3direct->album() ?>" src="https://github.com/HashandSalt/Kirby3-Gilmour/raw/master/<?= $coverimage->url() ?>">
<?php endif ?>
<ul>
<li><?= $mp3direct->id3('album') ?></li>
<li><?= $mp3direct->id3('artist') ?></li>
<li><?= $mp3direct->id3('title') ?></li>
<li><?= $mp3direct->id3('track') ?></li>
<li><?= $mp3direct->id3('composer') ?></li>
<li><?= $mp3direct->id3('genre') ?></li>
<li><?= $mp3direct->id3('year') ?></li>
<li><?= $mp3direct->id3('duration') ?></li>
</ul>
</div>
<?php endforeach ?>
Loop through some files getting the data from meta:
<?php foreach($page->audio() as $mp3meta):?>
<div class="album">
<?php if($imagecover = $mp3meta->cover()->tofile() ): ?>
<img alt="<?= $mp3meta->title() ?> - <?= $mp3meta->album() ?>" src="https://github.com/HashandSalt/Kirby3-Gilmour/raw/master/<?= $imagecover->url() ?>">
<?php endif ?>
<ul>
<li><?= $mp3meta->album() ?></li>
<li><?= $mp3meta->artist() ?></li>
<li><?= $mp3meta->title() ?></li>
<li><?= $mp3meta->track() ?></li>
<li><?= $mp3meta->composer() ?></li>
<li><?= $mp3meta->genre() ?></li>
<li><?= $mp3meta->year() ?></li>
<li><?= $mp3meta->duration() ?></li>
</ul>
</div>
<?php endforeach ?>
There is only one guitarist in the world and his name is David Gilmour.
MIT