Koken is end of life...

Sourcecode: Koken is running on the same old code base for 2 years now. The sky will fall eventually and koken.me is partly down for months now. This guy has archived the old source code, grab it!


Sign this to encourage koken as open source:



Fingers crossed. There is no real alternative to koken unless you are willing to spend 50 euro's/month for a cloud solution.

A last resort for help: https://www.reddit.com/r/koken/

Control Max2Play with Logitech Smart Control

Max2Play (www.max2play.com) on Raspberry Pi 3 is a great alternative for Logitech Squeezeboxes.

I needed a Jivelite setup for my HD screen to control my Logitech Touch as a couch potato without using binoculars. I had set my mind on controlling Max2Play with the Logitech Smart Control. Out of the box it doesn't:

Connect the Harmony bluetooth keyboard

  • First get Max2Play (Premium) and Jivelite up and running:
    Burn the image on SD, Expand Filesystem, Update Kernel and Update Packages, Update Max2play.
    Install Raspberry Cam plugin if you need it. If this plugin is installed later it won't work (in my case anyway).
  • Install the JiveLite and Bluetooth plugin from the max2play webpage.
  • In MyHarmony or the Harmony App create a new device: a Windows PC. Harmony remotes feature a bluetooth keyboard for three devices: Apple, WIndows and Other OS's. The big difference is the available keys. Only Apple and Windows have enough keys to play with and Windows offers the most. For instance "Esc" and most important "0" - "9".
  • Next create a Harmony activity with this new device and your other devices.
  • During the process Harmony wants to pair it's bluetooth keyboard to the Raspberry:
  • Start a SSH connection to the Pi3: ssh pi@your.ip password is "raspberry"
  • Start bluetoothctl
  • In bluetoothctl type scan on
  • The mac adress of the Harmony keyboard should popup
  • pair the harmony keyboard with pair 12:34:56:78:90. Replace the ID with your ID
  • Connect the harmony keyboard with connect 12:34:56:78:90.
  • Trust the harmony keyboard with trust 12:34:56:78:90
  • Harmony should display a message "pairing succesfull"
  • The webpage of max2play should now display a green text on the bluetooth page: "Following Bluetooth Speakers are known: Harmony Keyboard (12:34:56:78:90)". Yes your Harmony Keyboard is recognized as Bluetooth Speakers.
  • exit bluetoothctl
  • Keep SSH open
Program your Harmony remote
The basic keys are now available for your Harmony like direction keys and Esc which do most of the job controlling Jivelite. Program your remote the way you want it, minimal:
- Direction keys under the direction keys.
- Enter under the OK button
- and Esc under the Exit button.
This way the Harmony also works with Kodi if you need to remote control Kodi. 
The hard part are the others keys. Jivelite supports every function with a hotkey. The file which controls this is /opt/jivelite/jivelite/share/jive/jive/InputToActionMap.lua. With a normal wired or bluetooth keyboard you can use all action keys. The Harmony bluetooth keyboard has most if not all normal keys missing. 

I really needed the "Add" shortcut which does the same as the Add button on a Logitech Touch remote. With a normal keyboard "a" would do the job. Those keys are not available on a Harmony remote. Time to hack and remap some keys:

Hacking JiveLite
  • (re)open SSH to max2play
  • cd /opt/jivelite/jivelite/share/jive/jive 
  • sudo nano InputToActionMap.lua
  • Find any line with ["1"] ["2"] etc and comment it out, for instance:
    -- ["1"] = "play_preset_1",
  • Add the following lines:
    -- begin logitech harmony
    ["1"] = "go_current_track_info",
    ["2"] = "go_home_or_now_playing",
    ["3"] = "add",
    ["4"] = "add_end",
    ["5"] = "play_next",
    ["6"] = "play",
    ["7"] = "pause",
    ["8"] = "volume_up",
    ["9"] = "volume_down",
    ["0"] = "mute",
    ["\13"] = "go", -- RETURN

    --end logitech harmony
  • Don't forget the last one. Without this hack Jivelite won't respond to the Ok button.
  • Save the file and exit.
  • Exit SSH
  • Restart Jivelite or reboot the Pi. Don't restart or reboot with nano editing the lua file! If you do reinstall Jivelite from the max2play webpage and reapply the hack.
  • After a reboot of the Pi sometimes your remote doesn't respond. Stop and Start JiveLite from the max2play webinterface and JiveLite now recognizes the (Harmony Bluetooth) keyboard.
  • The "1" key is available for Harmony remotes. Program the "1" key under any button for instance the Info button. "2" goes under the Menu button, "6" for Play, and "7" for Pause. "4" and "5" some other button.

  • Everytime you reinstall Jivelite, the file InputToActionMap.lua is back to factory defaults and you need to fire up SSH to reapply the hack.

Koken export original images

Koken organizes photos in Albums (and Sets), The original uploaded photos are stored in an obscure folder structure like:


Every uploaded photo has two unique subfolders in the koken storage. Impossible to see what goes where from Finder or FileExplorer. The PHP script below reads the Koken database and copies the original files to a new location with a separate folder for each album.

It runs on MacOS and should run on Linux with minor adjustments (macos command cp -n is unsupported on other unix systems). Windows users must edit the mkdir and cp parts.

A set of folders and files in the structure of Koken is needed for offline viewing on digital image frames and photoviewers on tablets, smartphones, TV's etc. etc. In my case Plex. Or just as a backup.

Since Koken is end of life you really need this to export the images and import the recovered images in your new CMS (Piwigo or X3 from photo.gallery if you want my 2 cents)

Download php: http://www.repiuk.nl/Koken_Export_Images_and_Albums.rar

The rar file has two files: koken-export.php and koken-export-testprint.php

Start with koken-export-testprint.php, modify the code to connect to your database. It should print a list of album names from your Koken install. If that works try koken-export.php

Koken database repair

Albums disappearing, albums don't sort properly, albums jumping from one Set to another: Your koken database is confused. Easy to fix if you have a MySQL editor like phpMyAdmin or Navicat.

Open the table koken_albums and sort the table on the following columns:
level, left_id, right_id and visibility

visibility = 0: the album is public
visibility = 1: the album is unlisted
visibility = 2: the album is private

The same logic applies applies to the content tables for individual photos in the koken database


The table koken_albums also has a column listed. What it does is unclear for me, most likely it's a relic from the past and overruled by visibility which supports private, a new function of more recent koken releases.

level is the level of the album/set in koken's collection tree 

level = 1: the top level either Public, unlisted or private in the collection tree
Any album directly under Public has visibility = 0 and level = 1 
level = 2: A set or album inside a Set in the top levels (public, unlisted or private) of the collection tree. For instance a Set in the unlisted tree has visibilty = 1 and level = 1. Albums within that Set have visibility = 1 and level = 2.
level = 3: etc etc

Grouping and sorting

It gets a little complicated with sorting and grouping of albums and sets. Differentiating between Sets and Albums and sorting and grouping is handled by left_id and right_id. 

For instance, three (public) albums are sorted like this (id could be any number and is controlled by your koken install)

id, left_id, right_id
21, 1,       2
6,  3,       4
3,  5,       6

A set could be

id, level, left_id, right_id
9,  1,     3,       10

Albums within that set are sorted like this:

id, level, left_id, right_id
35, 2,     4,       5
7,  2,     6,       7
10, 2,     8,       9

level = 2 because the albums are part of the set

left_id of the albums within the Set starts with the left_id + 1 of the corresponding Set, in this example left_id = 4. The left_id and the right_id of the Set should span the left_id and right_id's of the albums within that set.

If you move albums and or sets around in Koken the left_id and right_id is changed by koken and the resulting database structure should be correct. Somehow my koken install managed to confuse itself. Maybe due to some bugs in the past which never showed it ugly face in the past. You can fix the logic yourself with any MySQL database editor! After your done save the database table, clear the system cache of koken and refresh your browser.

If you make a mistake and the collection tree is totally messed up, don't panic and try again. The albums and set don't disappear if you don't delete records in the koken_albums table.

The logic above is what I discovered with trial and error. I could be wrong, it worked for me. A good backup is a very good idea before you start hacking your database!

Run this query:

UPDATE koken_albums a,
(SELECT @i := 0) m SET level = 1,
a.left_id = @i := @i + 1,
a.right_id = @i := @i + 1;

Logitech Boom speaker repair

The Logitech Squeezebox Boom has a major fault. The rubber of the woofers is falling apart after a few years:


What you need:

  • New speaker rings R31C from speakerrepairshop
  • Glue
  • A mini hot air gun. Most gas operated soldering irons have a special tip which transforms it in a mini hot air gun. For instance this one
Start heating the rubber very gently. To hot or to close and the paper cone is burned. You need to adjust the heat/distance and only melt the glue:

Pull the rubber from the speaker cone. If you apply enough heat and pull in the direction of the radius of the speaker cone you won't damage the paper:
peelaway more peeling even more peeling

Also remove the rubber and the old glue on the metal frame with a sharp knife
It should like like this:
peeling done

Apply glue to the paper cone and the new rubber ring.

After the glue has dried for a minute or two drop the new rubber on the paper cone. You have to center it correctly on the first try. If not try moving it around. Finally apply pressure on the rubber ring and paper cone.

Cut a straw to 6,5 cm max.

Insert it in the bottom of the woofer and place the woofer on a table with the straw inserted. If the straw is longer or has sharp edges you could damage the paper cone.

The paper cone and new rubber is now lifted.
straw inserted 2

Apply glue to the metal frame and the new rubber ring. The glue needs to dry for two minutes. 
Lift the woofer from the table. The cone drops and the rubber is glued to to metal frame. If you lifted the speaker correctly the speaker cone is now centered in the metal frame
Check the speaker carefully if the coil is moving free and not touching the magnet.
If not try to correct it.

Once everything is centered apply pressure with a coin to fix the bond.

Finished and ready for reassembly: