This image shows a MindMap of the DB-structure and it controls.
The DB extends the ProcessWire variable $page with some additions. These additions depend of the type (or path) of the $page. In fact, the template name also reflect the path/type.
So, if the $page->template is album, the $page has following additions:
- artist (linked to artist page, its the logical parent)
- genre (linked to genre page, its the logical rootParent)
- songs (holds a pageArray with all song pages, the logical child pages)
There are other additions like totalPlaytime, totalPlaytimeString, playlistM3u, playlistPls, but the above ones, reflecting the logical parent-child-relations are of more interest. Here are the summary for all four page types:
- genre has: artists (logical child pages)
- artist has: genre (logical parent page), albums (logical child pages)
- album has: genre (logical rootParent page), artist (logical parent page), songs (logical child pages)
- song has: album (logical parent page), artist (logical grandparent page), genre (logical rootParent page)
- album and song have coverImage as PageImage,
so you can use it like $page->coverImage->width(200)->url
For the other additions please look into the DB, they are displayed as PageInfo on every single page, together with some simple demo code. The code you find in the Templatefiles local-audio-files_single.php and local-audio-files.php.
The $page variable together with the LocalAudioFiles-FrontEndHandler gives you comprehensive tools to work with your music collection.
For example, the FrontEndHandler ($fe) provides fully customizable FormSelectFields. You can call them like $fe->getFormSelect('album') or $fe->getFormSelect('artists'), whereas if you use genre, artist, album - you get a SingleSelectField, if you use the plural, genres, artists, albums you get a MultiSelectField!
For more examples please refer to the demos section of the DB.