How do you currently retrieve data from the mpd.conf file and the mpd database? Is there a 3rd party library available? Or did you have to create a custom interface from scratch?
My goal is to retrieve file paths from the mpd database. I was surprised to discover that it's just a gzip text file. I thought it would be sqlite since the stickers db is sqlite. Unfortunately that makes it more difficult to parse and extract data.
Here's what I'm working with so far...
// using pear Config package
require_once('Config.php');
$mpdconf = '/etc/mpd.conf';
$conf = new Config();
$root = $conf->parseConfig($mpdconf, 'genericconf', array('comment' => '#',
'equals' => '\s',
'newline' => '}'));
if (PEAR::isError($root)) {
echo 'Error reading config: ' . $root->getMessage() . "\n";
exit(1);
}
$item = $root->getItem('directive', 'db_file');
$dbpath = str_replace(['"', "'"], '', $item->content);
header('Content-Type: text/plain');
readgzfile($dbpath);