KPlaylist

From SME Server
Jump to: navigation, search

KPlaylist for SME Server

PythonIcon.png Skill level: medium
The instructions on this page require a basic knowledge of linux.

Maintainer

Sylvain Gomez
mailto:sylvaingomez@free.fr

kPlaylist Description

kPlaylist is a free PHP system that makes your music collection available via the Internet.

kPlaylist is a music database that you manage via the web. With kPlaylist you can stream your music (ogg, mp3, wav, wma, etc.), you can upload, make playlists, share, search, download and a lot more.

Read more about kPlaylist and check the features.

kPlaylist RPM

Install

To install kPlaylist, issue the following command:

yum install smeserver-kplaylist --enablerepo=smecontribs

You can ignore the yum-comments signal event post-upgrade and signal-event reboot.

Special commands

To view kPlaylist's configuration, you can type the following at the prompt:

config show kplaylist

You can change a few parameters:

   DB parameter   |    Options   | Default | Explanation
# HTTPS           | on/off       | off     | Enable/Disable forced https mode of web interface
# PublicAccess    | local/global | local   | Accessibility of web interface
# MaxUpload       | xM           | 16M     | Max uploadable file size
# URL             | new alias    |         | Optionnal alias for kPlaylist

After any change to kPlaylist configuration, you should apply modifications by typing the following at the prompt:

expand-template /etc/httpd/conf/httpd.conf
/etc/rc7.d/S86httpd-e-smith sigusr1

Example: You want to change PublicAccess to "global"

config setprop kplaylist PublicAccess global
expand-template /etc/httpd/conf/httpd.conf
/etc/rc7.d/S86httpd-e-smith sigusr1

Update

The RPM installs the latest stable version (1.7.426). If you want to try the development release (1.7.464) or a custom install, simply upload the new file in /opt/kplaylist/html/.

Then edit this file and change MySQL password at line #71

'pass' => 'kplaylist', # MySql password

You can retrieve your existing MySQL password with the following command:

config getprop kplaylist DbPassword

Then rename the file into index.php and apply security:

mv -f /opt/kplaylist/hmtl/kplaylist.1.7.464.php /opt/kplaylist/hmtl/index.php
chown root:www /opt/kplaylist/hmtl/index.php
chmod 660      /opt/kplaylist/hmtl/index.php

Then you may need to update the database, this extra step will be done at your first login.

Uninstall

To uninstall kPlaylist, just hit the following command:

yum remove smeserver-kplaylist

You can ignore the yum-comments signal event post-upgrade and signal-event reboot.

To completly remove kPlaylist (installation files ; MySQL user+database) you will need the following command:

sh /root/KPlaylist-Full-Uninstall.sh
Warning.png Warning:
Default MP3 folder will be deleted by this script! Move your files before launching this script!

kPlaylist Usage

Web Access

kPlaylist web interface is LAN ONLY by default (without HTTPS)

You can access the web interface at http://yourserver/kplaylist

login : admin
pass  : admin

Please change admin password first!

Getting started

kPlaylist's concept is pretty easy to understand:

1) Upload your music in /opt/kplaylist/files(see the 3 following sections for more details)
2) Update your database using Administration console Update
3) Enjoy!

Upload

Registered users can upload files. These files will be stored in /opt/kplaylist/files by default.

The default maximum uploadable file size is 16M (could be enough for most needs). You can modify this default value with following commands:

config setprop kplaylist MaxUpload xxM
expand-template /etc/httpd/conf/httpd.conf
/etc/rc7.d/S86httpd-e-smith sigusr1

where xx is your needed size (don't forget the M!)

Samba Access

For faster local downloading/uploading you can use Samba to access /opt/kplaylist/files.

Simply browse your SME server shares and you will see a folder named kplaylist.

Only SME Admin account will be able to browse this new shared folder after the RPM install.

If you want to allow all SME users to browse this directory, issue the following command:

chown -R root:shared /opt/kplaylist/files

If you want to revert to default, issue the following command:

chown -R www:www /opt/kplaylist/files

Adding more sources folders

kPlaylist Supports multiple music sources (drives, directories, nmb, smbfs, nfs, etc).

Option FollowSymLinks is also available which means that you can use symbolic links inside /opt/kplaylist/files.

Just remember that kPlaylist is restricted to /opt/kplaylist by default, you should override the existing template with a custom-template to allow access to the needed folder.

Reminder: Correct procedure to create a custom-template
# Create the folder if not exist
mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf

# Copy original template
cp /etc/e-smith/templates/etc/httpd/conf/httpd.conf/98kplaylist /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/

# Edit /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/98kplaylist
# Replace line #34 with your needed settings
php_admin_value open_basedir /opt/kplaylist:/tmp:/usr/share/pear:/home/e-smith/files/ibays/mp3_ibay/files   (just an example)

# Apply your changes
expand-template /etc/httpd/conf/httpd.conf
/etc/rc7.d/S86httpd-e-smith sigusr1

Verify that Apache (www or shared) have read/write access to the new folder and files.

Now go to kPlaylist web interface and login with the admin account. Click on Admin control Settings. Then click on Filehandling and manually add your new path to the list (or create a symbolic link).

Multiple Download

If you want to allow multiple download, edit /opt/kplaylist/html/index.php and modify the following value to true:

$cfg['archivemode'] = true;

Now you will have more download options!

mp3mail

kPlaylist can send mail. If you want to use this feature, you need to tweak MySQL max_allowed_packet (else you will see an error page when trying to send mails).

Create the file /etc/e-smith/templates/etc/my.cnf/011max-allowed-packet if it doesn't exist and paste the following code in it:

max_allowed_packet=32M   (you may need to higher this value)

Then apply new modifications:

expand-template /etc/my.cnf
service mysqld restart
expand-template /etc/httpd/conf/httpd.conf
/etc/rc7.d/S86httpd-e-smith sigusr1

ID3v2 support

getid3 v1.7.x is the default recommended tag reader for kPlaylist. If you want to add this feature to your kPlaylist, just follow this quick howto.

First, Check the latest version here.

wget http://surfnet.dl.sourceforge.net/sourceforge/getid3/getid3-1.7.7.zip
unzip getid3-1.7.7.zip -d /opt/kplaylist/
rm -f getid3-1.7.7.zip

Now edit /opt/kplaylist/html/index.php and modify following lines:

  • Line #95, enable getid3
$cfg['enablegetid3'] = 1;
  • Line #98, provide path to getid3.php
$cfg['getid3include'] = '/opt/kplaylist/getid3/getid3/getid3.php';

Save the file and check if it's working: log in as a admin to kPlaylist, click on Settings and then on 'Filehandling'. If 'Write id3v2 with stream' is not disabled, getid3 should be working. You should also see the version number in the right.

Cron job

A cron job can be created to update kPlaylist's database. This has the same effect of clicking on "Update" button in Administration console.

Edit /opt/kplaylist/html/index.php and modify following lines:

  • Line 125, enable autoupdate
$cfg['autoupdate'] = 1;
  • Optionnaly, uncomment lines 8977, 8978 and 8979
$options['deleteunused'] = 1;  # Uncomment if you want to remove deleted files from the database
$options['rebuildid3'] = 1;    # Uncomment if you want to reread all the information from your music files (OGG/MP3).
$options['debugmode'] = 1;     # Uncomment if you want to enable debug mode

You can check that it's working at http://yourserver/kplaylist/index.php?update=5000&user=autooperate

You should get this message: Wrong host (YOUR IP) or user (autooperate) for update.


Create a template called kplaylist in /etc/e-smith/templates/etc/cron.d/ and paste the following code in it:

# kPlaylist database update cron job

# ___________ Minute      (from 0 to 59)
#|   ________ Hour        (from 0 to 23)
#|  |  ______ Day         (from 1 to 31)
#|  | |  ____ Month       (from 1 to 12)
#|  | | |  __ Day of week (from 0 to 6 - 0 is sunday) 
#|  | | | |
#v  v v v v
30 23 * * * /usr/bin/lynx -dump "http://127.0.0.1/kplaylist/index.php?update=5000&user=autooperate"

Save the file and apply modifications with the following command:

expand-template /etc/cron.d/kplaylist

Now each day at 23:30 the server will auto-update kPlaylist database.

Additional information


Sylvain Gomez (Cool34000)