Jump to content

Release: LocalAudioFiles MP3-DB


Recommended Posts

Local Audio Files - MP3-DB

The Local Audio Files DB is a combination of a Module and a SiteProfile. It is intended to import MP3-files from your filesystem into ProcessWire, read ID3-Tags and pull coverImages from it to feed the DB.
It is thought as a starting point for your own site creation. A sort of comfortable aggregated reuseable code for PW-lovers. :P

How to Install

Grab a copy of the latest ProcessWire. Replace the install, modules and templates directories with those in this profile, as shown below:

  • /site-default/install/
  • /site-default/modules/
  • /site-default/templates/

With SiteProfile-Installs normally that is all there is to do. With this Profile you also have to copy the file LocalAudioFilesImportShellScript.php (for simplicity) to your PW-rootfolder, (where the index.php reside). If you are on Windows you also should copy mp3_import_starter4win.cmd to the same location.
Now install ProcessWire as per the instructions included with it and it will install the LocalAudioFiles profile automatically.
After that you find a Quickstart Guide at the homepage of the profile:
Follow the 3 steps and you are done!
How does it work?

  • The Site has 4 sibling Tree Branches: genres - artists - albums - songs.
  • Each of them hold child-pages: genre - artist - album - song.
  • The logical relations are nested parent-children ones: a genre hold artists, each artist hold albums, each album hold songs.
  • To support both, slim and fast data relations & the logical hirarchy, the module extends the ProcessWire variable $page with some additions. It uses the addHookProperty mechanism to achieve that.
  • It uses an own caching mechanism for large lists, that can be prebuild when running the importer-shellscript, or it build the cache on demand.
  • Also it comes with a FrontEndHandler class that provides a lot of functionality, for example fully customizable FormSelectFields of all genres, artists or albums.
  • More detailed informations and code examples are collected in a demo section of the site.

The extended $page variable together with the LocalAudioFiles-FrontEndHandler gives you comprehensive tools to work with your music collection.

I have uploaded a small LiveDemo with only 7 truncated songs. But it's pretty fine to view all Demos and the additional $page->proterties. :)

Graphical overview
Screencast of installation
History of origins

  • Like 9
Link to comment
Share on other sites

A little change in the importer script has to be done:

- added a line that prevents the Shellwindow from closing when the wrong username/password was provided.

With the fix now it stays open and the user get the info.

LocalAudioFilesImportShellScript.zip  (is included in the above Version 1.0.5 now)

Edited by horst
Link to comment
Share on other sites

Are the mentioned Examples & Demo hosted live someplace? They don't seem to be linked to anything.

Looks awesome!

?? uhhm, - you first have to run the ShellImporterScript, then the Examples & Demos have some 'food' to work :-) (They don't within an empty DB)


No sorry, there is no LiveDemo.

Link to comment
Share on other sites

Thanks Ryan.

It was really massive learning to write this together. In fact I have (re)written it three to four times. :P

Every time I want it to do something from what I don't know the PW-way, I have done it old-schooled first. Then a few days later, I've found informations here in Forum or in the docu that show me how to do it better. And I have rewritten it. Much work, much fun, me.better PW.coder now. ( but also much.much.much.more to learn )

The only downside with that project is that I now don't like my (before LocalAudioFiles) new created (but still not finished) portfolio site any more. :mellow:

I have trashed it and started new from scratch.

With it there are new things like sessions, redirects, cookies and, ...

yes, again: much.learning! :-)

  • Like 2
Link to comment
Share on other sites

  • 6 years later...
34 minutes ago, AndréPortuga said:

Its not working on my machine. Whenever I refresh the modules page it shows me a error.

Hhm, this is a very old one, from 2013. Which version of PW do you use?


Link to comment
Share on other sites

I haven't tried out this module, but often with old modules (pre PW v.3) all you need is to add the PW namespace at the first line of the module.

i.e. https://github.com/horst-n/LocalAudioFiles/blob/master/site-default/modules/LocalAudioFiles/LocalAudioFiles.module

just replace first line with
<?php namespace ProcessWire;

then refresh modules and try again. If that doesn't work, you should post the error messages you see.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...