{"id":50,"date":"2005-12-08T07:43:13","date_gmt":"2005-12-08T13:43:13","guid":{"rendered":"http:\/\/blog.the-erm.com\/?p=50"},"modified":"2005-12-08T07:46:12","modified_gmt":"2005-12-08T13:46:12","slug":"rebuilding","status":"publish","type":"post","link":"https:\/\/blog.the-erm.com\/?p=50","title":{"rendered":"Rebuilding &#8211; phpMMS\/phpMUR"},"content":{"rendered":"<p>Recently I decided it would be a good idea to rebuild the part of the project that actually played the songs.<br \/>\n<!--more--><br \/>\nI&#8217;ve added various plugin hooks.  The idea is blatantly borrowed the idea from wordpress.<\/p>\n<p>They basically have an array of functions that need to be ran during a specific event.<\/p>\n<p>Since I have to run this thing in 2 different processes, the &#8216;player&#8217; and the &#8216;picker&#8217; process. I have 2 hook systems.<\/p>\n<p>PLAYER HOOKS<br \/>\n&#8212;&#8212;&#8212;&#8212;<br \/>\nbefore_play(function_name);<br \/>\nThis is executed just before mplayer plays a song.<br \/>\nThings this could be useful for:<br \/>\n    * &#8216;station id&#8217; every x songs.<br \/>\n    * a &#8216;notify&#8217; sound if the song is rated 11.<br \/>\n    * ices metatag update.<br \/>\n    * remount script for network drives.<\/p>\n<p>PICKER HOOKS<br \/>\n&#8212;&#8212;&#8212;&#8212;<br \/>\non_songchange(function_name);<br \/>\n    * A Song logger<br \/>\n    * scan for new songs<br \/>\n    * osd<br \/>\n    * id3 tag sync.<br \/>\n    * rename previous song according to it&#8217;s dbinfo.  Found in<br \/>\n      $player->previousSong<\/p>\n<p>wait_loop(function_name);<br \/>\n    * Do something every 5 seconds. The Picker process sleeps for 5 seconds, and<br \/>\n      then checks if the song has changed.<br \/>\n      a. This is useful to check mountpoints and remount if needed.<\/p>\n<dl>The plugins I&#8217;ve made for the player process:<\/p>\n<dt><b>remount.php<\/b><\/dt>\n<dd>remounts the drive if the mp3 does not exist.<\/dd>\n<\/dl>\n<dl>The plugins I&#8217;ve made for the picker process:<\/p>\n<dt><b>remount.php<\/b><\/dt>\n<dd>Also checks every 5 seconds.  Probably doesn&#8217;t need to be a player process, however I wanted to demonstrate how you could have a plugin work in both the player, and picker processes.<\/dd>\n<dt><b>log.php<\/b><\/dt>\n<dd>Log what songs are being played into a clf format for parsing by webalizer.  Agents are &#8216;artists&#8217; and &#8216;pages&#8217; are songs.  Nice way to tell what&#8217;s getting played, and how often.M.<\/dd>\n<dt><b>osd.php<\/b><\/dt>\n<dd>On screen display of the current song and ratings of specified users.  Eventually I plan on adding a wait_loop osd when people login\/logout.<\/dd>\n<dt><b>scan.php<\/b><\/dt>\n<dd>This is almost a &#8216;required&#8217; plugin.  Because if you&#8217;re not scanning directories for new songs, then how are you going to hear the new stuff? &#8211; almost complete.<\/dd>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>Recently I decided it would be a good idea to rebuild the part of the project that actually played the songs.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-50","post","type-post","status-publish","format-standard","hentry","category-phpmur-what-im-doing"],"_links":{"self":[{"href":"https:\/\/blog.the-erm.com\/index.php?rest_route=\/wp\/v2\/posts\/50","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.the-erm.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.the-erm.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.the-erm.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.the-erm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=50"}],"version-history":[{"count":0,"href":"https:\/\/blog.the-erm.com\/index.php?rest_route=\/wp\/v2\/posts\/50\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.the-erm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=50"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.the-erm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=50"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.the-erm.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=50"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}