Kodi support is nearing completion

It’s 2020 and we’re back on extending Rigelian with support for Kodi. Added recently are the ‘play random album’ and ‘play random songs’ functions. Turns out that adding 100 songs in one command is very slow on Kodi, so I had to limit that to 20 songs to keep the performance acceptable.

Also the sortation of albums in various screens is completed.

Remaining now is the ability to play radio stations, and creating a player setting screen and then we’re good to go.

Using c-style defines with Swift Package Manager

When compiling the c-based library libmpdclient, I ran into the problem that it contains some #define statements which have to be set during the build. It took me while to find out how to set those when building the package with Swift Package Manager.

In the end off course the answer was right there in the documentation, but I only found that after watching one of the SPM videos from WWDC 2019.

let package = Package(
     name: "libmpdclient",
     ...
     targets: [
         .target(
             name: "libmpdclient",
             publicHeadersPath: "mpd",
             cSettings: [
                 .define("DEFAULT_HOST", to: "\"localhost\""),
                 .define("DEFAULT_PORT", to: "6600"),
                 .define("ENABLE_TCP", to: "1")
             ]
         )
     ]
 )