ZX2C4 Music Updater"; echo "

Downloading tarball..."; if(copy("http://git.zx2c4.com/ZX2C4Music/snapshot/ZX2C4Music-master.tar.gz", "latest.tar.gz")) { echo "done.

"; } else { echo "error!

"; exit; } echo "

Unpacking tarball:

";
ob_flush();
flush();
system("tar -xvzf latest.tar.gz");
echo "

"; if($_GET["updatetagreader"] != "true") { echo "

Removing binary blob in case of custom compilation:

";
	ob_flush();
	flush();
	system("rm -rv ZX2C4Music-master/tagreader");
	echo "

"; } echo "

Merging new files:

";
ob_flush();
flush();
system("mv -v ZX2C4Music-master/* .");
echo "

"; if($_GET["recompiletagreader"] == "true") { echo "

Compiling tag reader:

";
	ob_flush();
	flush();
	system("./compiletagreader.sh");
	echo "

"; } echo "

Cleaning up:

";
ob_flush();
flush();
system("rm -rv ZX2C4Music-master latest.tar.gz");
echo "

"; if($_GET["rescandatabase"] == "true") { require_once("databaseconnect.php"); echo "

Removing old database table and rescanning collection:

";
	ob_flush();
	flush();
	mysql_query("DROP TABLE `musictags`;");
	require_once("updatedatabase.php");
	echo "
"; } echo "

Finished!

"; ob_flush(); flush(); ?>