horst

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:
post-1041-0-45379400-1369002668_thumb.jp
 
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.
 
 
Download

 
 
LiveDemo
 
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
 
post-1041-0-96922200-1369005535_thumb.pn
 
 
Screencast of installation
 
https://youtu.be/-qYyppvEF1k
 
 
History of origins
 
http://processwire.com/talk/topic/3322-how-to-setup-relations-for-a-mp3-db-with-pw/
http://processwire.com/talk/topic/3462-pages-get-return-nullpage-but-page-exists/

  • Like 9

Share this post


Link to post
Share on other sites

Well done Horst!

Sorry didn't have time to test the last version. Will make some time for this :)

  • Like 1

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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

Looks awesome!

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Really impressed by all you've put together here Horst, nice work! 

  • Like 1

Share this post


Link to post
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

Share this post


Link to post
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


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By BitPoet
      Since I was stuck to my flat today I took up a wish and rolled a Process module / CKEditor plugin combo that adds @-autocomplete like the mentions here in the forum to CKEditor fields. It's configurable, but only in module settings for now, the positioning of the select list is quite off and there's still some visual work to be done, so it is in early alpha state.
      Nonetheless, if you want to take a look, here it is:
      https://github.com/BitPoet/ProcessMention

       
      After installation, you may want to look into the "Additional selector" entry in the module's settings. You will most likely want to limit results to certain templates there.
       
      Edit: Updated to version 0.0.30 with fixed positioning of the dropdown.
      Edit2: Settings are configurable in field context now. If pwmentions is enabled, the according settings are shown on the "Input" tab.
       
    • By thuijzer
      https://github.com/thuijzer/processwire-FieldtypeBusinessHours
      Fieldtype Business Hours
      ProcessWire Fieldtype for entering business hours (opening hours)
       
      Input format
      Leave a day empty when closed on that day
      Times are in 24 hour format.
      9:00-12:00 9:00-12:00, 13:00-17:30 16:00-2:00  
      Usage in templates
      Days are from 1 to 7 where 1 is Monday and 7 is Sunday (ISO-8601)
      echo $page->field_name->isNowOpen() ? 'Now open' : 'Now closed'; if($page->field_name[1] == null) { echo 'Closed on Monday'; } if($page->field_name[2]->inRange('11:00')) { echo 'Tuesday at 11:00 open'; } echo $page->field_name[1]; echo $page->field_name[1]->getEntries()->getFrom()->format('H:i');  
    • By hellomoto
      I was working on this:
      class PWCRM extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Client Relationship Management', 'version' => .001, 'singular' => true, 'autoload' => true ); } public function init() {} public function ready() { $this->pages->addHookBefore('render', $this, 'accessHook'); $this->pages->addHookAfter('render', $this, 'hookAfterPageRender'); } public function accessHook(HookEvent $event) { $page = $this->wire('page'); if (!strpos($page->template->tags, 'crm')) return; if (!$this->wire('user')->hasRole('crm')) $this->wire('session')->redirect($this->wire('config')->urls->login);//throw new Wire404Exception(); } public function hookAfterPageRender(HookEvent $event) { $page = $event->object; echo $page->template->tags; if (!strpos($page->template->tags, 'crm')) return; echo $this->wire('config')->urls->templates; include_once($this->wire('config')->urls->templates.'functions.inc'); $pagehtml = $event->return; $pagehtml = str_replace( '</head>', '<link id="css_crm" rel="stylesheet" href="'.$this->wire('config')->urls->templates.'css/crm.css"> </head>', $pagehtml ); $event->return = $pagehtml; //$event->replace = true; } } I have tried placing the hooks into the init() function, and more... Neither method is effective. The echoes now output, but no redirection (although I have the access settings for the top-level template for this set to render a 404 for underprivileged users, which it does, overriding this, but nonetheless this should work aside from that.
      Then I wrote this up quick:
      <?php namespace ProcessWire; class MaintenanceMode extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Maintenance Mode', 'version' => 1, 'summary' => 'Disables the website frontend for non-superusers.', 'singular' => true, 'autoload' => true, 'permanent' => false ); } public function init() { $this->addHookBefore('Page::render', $this, 'displayDecide'); } public function displayDecide($event) { $page = $event->object; if ($page->template == 'admin' || $this->wire('user')->hasRole('superuser')) return; // replace the method hooked $event->replace = true; $event->return = "Patience please while we undergo some brief maintenance work."; } } which likewise avails nothing. What the hell is my problem here? 
    • By adrian
           Tracy Debugger for ProcessWire
      The ultimate “swiss army knife” debugging and development tool for the ProcessWire CMF/CMS
       

       
      Integrates and extends Nette's Tracy debugging tool and adds 30+ custom tools designed for effective ProcessWire debugging and lightning fast development
      The most comprehensive set of instructions and examples is available at: https://adrianbj.github.io/TracyDebugger
      Modules Directory: http://modules.processwire.com/modules/tracy-debugger/
      Github: https://github.com/adrianbj/TracyDebugger
      A big thanks to @tpr for introducing me to Tracy and for the idea for this module and for significant feedback, testing, and feature suggestions.