Sonerezh Album Covers

Sonerezh is a self-hosted music streaming platform that is still fairly young. It works very well, until I recently updated to PHP7. I had to manually update the CakePHP libraries that came with it to get past a error “String is a built in function”. After I fixed that error, I decided to try and get the album cover images working.

By default Sonerezh pulls the album covers from the mp3 files themselves via the ID3 info, but I don’t keep those tags when I clean my mp3 files up I have the album art stored as ‘folder.jpg’ in the album folder itself. So I started to dig around and came up with a simple solution that works for me.

Edit the file SongsController.php inside the app/Controllers folder. Around line 93 or so it starts with pulling the photos out of the ID3 information. I added a new section and commented out the old, as displayed below:

if (!empty($songInfo['comments']['genre'])) { $genre_array_length = count($songInfo['comments']['genre']); $newSong['genre'] = $songInfo['comments']['genre'][$genre_array_length - 1]; } $extension = 'jpg'; $name = md5($newSong['artist'].$newSong['album']); $path = IMAGES.THUMBNAILS_DIR.DS.$name.'.'.$extension; if (!file_exists($path)) { if (!file_exists(IMAGES.THUMBNAILS_DIR)) { new Folder(IMAGES.THUMBNAILS_DIR, true, 0777); } if (copy("/...music path here.../".$newSong['artist']."/folder.jpg", $path)) { $newSong['cover'] = $name.'.'.$extension; } } /* if (isset($songInfo['comments']['picture'])) { if (isset($songInfo['comments']['picture'][0]['image_mime'])) { $mime = preg_split('/\//', $songInfo['comments']['picture'][0]['image_mime']); $extension = $mime[1]; } else { $extension = 'jpg'; } $name = md5($newSong['artist'].$newSong['album']); $path = IMAGES.THUMBNAILS_DIR.DS.$name.'.'.$extension; if (!file_exists($path)) { if (!file_exists(IMAGES.THUMBNAILS_DIR)) { new Folder(IMAGES.THUMBNAILS_DIR, true, 0777); } $file = fopen($path, "w"); fwrite($file, $songInfo['comments']['picture'][0]['data']); fclose($file); } $newSong['cover'] = $name.'.'.$extension; } */ } if (!isset($newSong['title'])) {
By |January 15th, 2016|0 Comments

Server Migrate from suPHP to mod_fcgid

I went ahead and migrated the configs on the server from suPHP to mod_fcgid. So far the performance is much better. Pages are loading faster and we are able to use APC again.

The steps were really just installing mod_fcgid, then add a line in the httpd conf, setup the wrapper script and change the vhosts.

There is already tons of information on the subject so I will just point to a few pages to help others…

I don’t use Ubuntu, but it helps to see some steps.
http://www.howtoforge.com/how-to-set-up-apache2-with-mod_fcgid-and-php5-on-ubuntu-11.10

ArchLinux simple install guide
https://wiki.archlinux.org/index.php/Apache_and_FastCGI

Says Apache 1.X but some information
http://www.fastcgi.com/drupal/node/10

Not talking about vhosts but some good info
http://alexforencich.com/wiki/en/linux/arch_php_fcgid

By |July 31st, 2013|2 Comments

Apache, PHP, suPHP Problems

Last night if you tried visiting you might have gotten some errors on the site. I upgraded the servers which included a slightly newer version of PHP, Apache, and suPHP.

Everything upgraded fine but websites would not load. After some digging it was apparent that the problem was directly related to the PHP setting open_basedir. I have each virtual host configured to use its own php.ini file and that file was not being used, trying instead to use the default php.ini file in /etc/php. Which of course did not have the correct open_baseidir settings.

For some reason Apache or PHP stopped caring about the lines in my httpd-vhosts.conf file that stated:

SetEnv PHPRC /path/to/specific/php.ini

I could never find out why it was ignoring this line now. But after some research I found another that provides the same thing. Since I am using suPHP I went with the following for each vhost.

suPHP_ConfigPath /path/to/specific/folder/containing/php.ini

It’s a little frustrating that I cannot name the php config files after the vhosts because it wants a folder path without a file name, but it will do for now.

Another site that might help.

By |June 5th, 2013|0 Comments

Joomla Components

I have noticed a lot of traffic coming to my site looking for my old Joomla components, if you landed on this page you were probably browsing a site that still has links to me.

I no longer create Joomla components and cannot support the ones I have created. Most did not work in Joomla 1.5 and I have since moved to a more simple setup.

Because I cannot support them, I cannot offer them for download. You should never run components or modules that have no updates or support to fix bugs and holes.

By |October 20th, 2010|0 Comments

Document Processing Source Code

This is the PHP console program service that Anthony and I programmed at work. We got the owner of the company to sign off a release form finally making the code available under the GPL.

Please note that this code will probably not work for you as a drop in place system, it will require tweaking, and lots of setup on your part. Please do not ask me for assistance.

Use this code at your own risk. You will need knowledge of Linux, PHP, Shell Scripts, and some common computer programming knowledge.

Folder structure for this program is as follows:
/tmp – Used for temporary storage of files for FDF merge into interactive PDF.
/usr/local/bin – Storage for all scripts this program uses. (dps.php, forge_fdf.php, file2pdf, pollerctl, dps_poller, hud-process.php)
/usr/local/dpsdocs – Root storage for following folders:
dpsdocs/merged – If save mode is on, saves raw ODT and PDF files in named folders.
dpsdocs/failed – Saves documents that failed to merge for some reason.
dpsdocs/monitor – If user chooses fake printer, will save the PDF here, instead of really printing it. Good for NFS/SMB share.
dpsdocs/templates – Live templates that the system pulls.
dpsdocs/test_templates – Test templates that you can SMB/NFS share for users to add tempaltes and you can sync to live later.
dpsdocs/xml_request – Where all the XML files get dumped to from which ever system you have generating them. Good to NFS/SMB share.

Files used and purpose:
dps.php – Main PHP program, does the merging and OOO operations. Takes in the XML as the first parameter and some others. Open file and view for yourself.
dps_poller – The program that loops continuously looking for newly dumped XML files. XML files that have specific printers are SCP’ed over the network to other servers running program so they build and print locally at that location.
file2pdf – This shell script gets called by dps.php and finishes the job, runs pdftk operations, and reads the sorting.txt file to decide where to print.
hud-process.php – Example PHP file that takes in FDF data and merges with specific PDF files. Called from dps.php.
pollerctl – Service script that makes sure the dps_poller is always running and never died for some reason.
tbs_class.php – TinyButStrong PHP class file, called from tbsooo_class.php.
tbsooo_class.php – TinyButStrong OpenOfficeOrg class file, called from dps.php.
zint – Console program that takes in data and creates a barcode. dps.php calls this, and creates a PDF417 barcode.

Document Processing PHP System

By |April 2nd, 2010|0 Comments
Load More Posts