We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 8e870c60 authored by elleo's avatar elleo

Initial commit for gobbler (last.fm compatible audioscrobbler). Just a simple...

Initial commit for gobbler (last.fm compatible audioscrobbler). Just a simple install/configuration script for now.
parent 3f49e162
This is the libre.fm audioscrobbler server, compatible with the last.fm API.
To install visit http://yourserver.com/path/to/gobbler/install.php
As things stand you'll need the MDB2 pear module installed (and at least one MDB2 driver) this can be achieved by running "pear install mdb2 mdb2#sqlite".
(For distribution we can include the latest version of MDB2 in the release packages if we want to make things even simpler for people.)
<?
if(!file_exists("config.php")) {
die("Please run the <a href='install.php'>Install</a> script to configure your installation");
}
require_once("config.php")
require_once('MDB2.php');
$mdb2 =& MDB2::connect($connect_string);
if (PEAR::isError($mdb2)) {
die($mdb2->getMessage());
}
?>
<?
require_once('MDB2.php');
if(file_exists("config.php")) {
die("A configuration file already exists. Please delete <i>config.php</i> if you wish to reinstall.");
}
if (isset($_POST['install'])) {
//Get the database connection string
$dbms = $_POST['dbms'];
if($dbms == "sqlite") {
$filename = $_POST['filename'];
$connect_string = "sqlite://" . $_POST['filename'];
} else {
$connect_string = $dbms . "://" . $_POST['username'] . ":" . $_POST['password'] . "@" . $_POST['hostname'] . ":" . $_POST['port'] . "/" . $_POST['dbname'];
}
$mdb2 =& MDB2::connect($connect_string);
if (PEAR::isError($mdb2)) {
die($mdb2->getMessage());
}
//Create tables
$res = $mdb2->query("CREATE TABLE Users (username VARCHAR(64) PRIMARY KEY,
password VARCHAR(255) NOT NULL,
email VARCHAR(255),
fullname VARCHAR(255),
bio TEXT,
homepage VARCHAR(255),
location VARCHAR(255),
created TIMESTAMP NOT NULL,
modified TIMESTAMP)");
$mdb2->disconnect();
//Write out the configuration
$config = '<? $connect_string = "' . $connect_string . '"; ?>';
$conf_file = fopen("config.php", "w");
$result = fwrite($conf_file, $config);
fclose($conf_file);
if(!$result) {
die("Unable to write to file '<i>config.php</i>'. Please create this file and copy the following in to it: <br /><pre>" . str_replace("<", "&lt;", $config) . "</pre>");
}
die("Configuration completed successfully!");
}
?>
<html>
<head>
<title>Gobbler Installer</title>
<script type='text/javascript'>
function showSqlite() {
document.getElementById("sqlite").style.visibility = "visible";
document.getElementById("networkdbms").style.visibility = "hidden";
}
function showNetworkDBMS() {
document.getElementById("sqlite").style.visibility = "hidden";
document.getElementById("networkdbms").style.visibility = "visible";
}
</script>
</head>
<body onload="showSqlite()">
<h1>Gobbler Installer</h1>
<form method="post">
Database Management System: <br />
<input type="radio" name="dbms" value="sqlite" onclick='showSqlite()' checked>SQLite</input><br />
<input type="radio" name="dbms" value="mysql" onclick='showNetworkDBMS()'>MySQL</input><br />
<input type="radio" name="dbms" value="pgsql" onclick='showNetworkDBMS()'>PostgreSQL</input><br />
<br />
<div id="sqlite">
Filename: <input type="text" name="filename" /><br />
</div>
<div id="networkdbms">
Hostname: <input type="text" name="hostname" /><br />
Port: <input type="text" name="port" /><br />
Database: <input type="text" name="dbname" /><br />
Username: <input type="text" name="username" /><br />
Password: <input type="password" name="password" /><br />
</div>
<br />
<input type="submit" value="Install" name="install" />
</form>
</body>
</html>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment