0.1.6
Better menus, fix UTF-8 bug
This commit is contained in:
67
Minat.php
67
Minat.php
@@ -9,14 +9,6 @@ $version = file_get_contents(__DIR__."/version.txt");
|
||||
|
||||
require (__DIR__."/functions.php");
|
||||
|
||||
// Check for translocation
|
||||
|
||||
if (!@touch(__DIR__."/test")) {
|
||||
alert("Minat cannot run from the Downloads folder");
|
||||
quitme();
|
||||
die;
|
||||
}
|
||||
|
||||
// Prefs
|
||||
|
||||
$prefs = __DIR__."/prefs.php";
|
||||
@@ -29,6 +21,8 @@ if (!file_exists($prefs)) {
|
||||
|
||||
$p = unserialize(file_get_contents($prefs));
|
||||
|
||||
// Extra prefs
|
||||
|
||||
$p['phpbin'] = "/usr/bin/php";
|
||||
$p['flacbin'] = __DIR__."/bin/flac";
|
||||
$p['metaflacbin'] = __DIR__."/bin/metaflac";
|
||||
@@ -44,33 +38,8 @@ if (!file_exists($prefs)) {
|
||||
|
||||
}
|
||||
|
||||
// Version check
|
||||
|
||||
if (strpos(__FILE__,".app")) {
|
||||
|
||||
$checkfile = __DIR__."/vcheck";
|
||||
|
||||
if (!file_exists($checkfile) | time()-@filemtime($checkfile) > 86400) {
|
||||
$curr_version = file_get_contents("http://git.profiteroles.org/profiteroles/Minat/raw/branch/master/version.txt");
|
||||
addline("Version check, me=".$version." latest=".$curr_version);
|
||||
if ($curr_version > $version) {
|
||||
if(askMulti("A new version of Minat is available", array("Skip","Download")) == 1) {
|
||||
exec("open http://git.profiteroles.org/profiteroles/Minat");
|
||||
quitme();
|
||||
}
|
||||
}
|
||||
touch($checkfile);
|
||||
}
|
||||
}
|
||||
|
||||
if ($p['mode'] != 1) { $p['premature'] = 1; addline("MODE ".$p['mode']." NOT YET IMPLEMENTED."); }
|
||||
|
||||
// If SHIFT key is held down, open debug window
|
||||
|
||||
if(exec(__DIR__."/bin/keys") == 512) {
|
||||
exec("open -n Console.app --args ".$p['logfile']);
|
||||
}
|
||||
|
||||
// Make work dir
|
||||
|
||||
if (!is_dir($p['workdir'])) {
|
||||
@@ -99,12 +68,39 @@ if(count($argv) == 0) {
|
||||
die;
|
||||
}
|
||||
|
||||
// Preferences
|
||||
|
||||
if ($argv[0] == "Preferences...") {
|
||||
exec($p['phpbin']." ".__DIR__."/MinatPrefs.php");
|
||||
addline("Launch preferences");
|
||||
die;
|
||||
}
|
||||
|
||||
// Version check
|
||||
|
||||
if ($argv[0] == "Check for Updates...") {
|
||||
|
||||
$curr_version = file_get_contents("http://git.profiteroles.org/profiteroles/Minat/raw/branch/master/version.txt");
|
||||
addline("Version check, me=".$version." latest=".$curr_version);
|
||||
if ($curr_version > $version) {
|
||||
if(askMulti("Minat ".$curr_version." is available (you have ".$version.")", array("Cancel","Download")) == 1) {
|
||||
exec("open http://git.profiteroles.org/profiteroles/Minat");
|
||||
die;
|
||||
}
|
||||
} else {
|
||||
alert($version." is the latest version","Up-to-date");
|
||||
die;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Console
|
||||
|
||||
if ($argv[0] == "Show Debug Console") {
|
||||
exec("open -n Console.app --args ".$p['logfile']);
|
||||
die;
|
||||
}
|
||||
|
||||
$stamp = md5(serialize($argv))."_".time();
|
||||
$workdir = $p['workdir'].$stamp."/";
|
||||
$batchfile = $workdir.$stamp.".sh";
|
||||
@@ -182,6 +178,9 @@ foreach ($argv as $target) {
|
||||
$mimecmd = $p['metaflacbin']." --list --block-type=PICTURE ".escapeshellarg($files[0])." | head -10 | grep MIME | sed 's:.*/::'";
|
||||
addline($mimecmd);
|
||||
$mime = exec($mimecmd);
|
||||
if ($mime == " MIME type:") {
|
||||
$mime = "pic";
|
||||
}
|
||||
|
||||
if (@$mime) {
|
||||
|
||||
@@ -248,7 +247,7 @@ foreach ($argv as $target) {
|
||||
$dest = $destdir.basename($file,".flac").".mp3";
|
||||
$lockfile = $workdir.md5($target).".".basename($file,".flac").".lock";
|
||||
$cmd_flac = $p['flacbin']." -dcs -- ".escapeshellarg($file);
|
||||
$cmd_lame = $p['lamebin']." -S ".$p['lameopts']." ".$tags." ".$covertags." - ".escapeshellarg($dest);
|
||||
$cmd_lame = $p['lamebin']." -S ".$p['lameopts']." --id3v2-utf16 ".$tags." ".$covertags." - ".escapeshellarg($dest);
|
||||
$cmd_lock = "touch ".escapeshellarg($lockfile);
|
||||
|
||||
$line[] = $cmd_flac." | ".$cmd_lame." ; ".$cmd_lock;
|
||||
|
||||
Reference in New Issue
Block a user