diff --git a/CHANGELOG.md b/CHANGELOG.md index fbe90b3..3626f76 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Changelog All notable changes to this project will be documented in this file. +## [0.1.8] +- Tweaks and bugfixes + ## [0.1.7] - Updated Pashua binary diff --git a/Minat.app.zip b/Minat.app.zip new file mode 100644 index 0000000..2cf9049 Binary files /dev/null and b/Minat.app.zip differ diff --git a/Minat.php b/Minat.php index fc64313..a0f45cc 100755 --- a/Minat.php +++ b/Minat.php @@ -9,34 +9,29 @@ $version = file_get_contents(__DIR__."/version.txt"); require (__DIR__."/functions.php"); -// Prefs +// Load preferences -$prefs = __DIR__."/prefs.php"; -if (!file_exists($prefs)) { - - alert("Can't read prefs file"); - die; - - } else { - - $p = unserialize(file_get_contents($prefs)); - - // Extra prefs - - $p['phpbin'] = "/usr/bin/php"; - $p['flacbin'] = __DIR__."/bin/flac"; - $p['metaflacbin'] = __DIR__."/bin/metaflac"; - $p['lamebin'] = __DIR__."/bin/lame"; - $p['soxbin'] = __DIR__."/bin/sox"; - - $p['workdir'] = "/tmp/minat/"; - $p['logfile'] = getLogPath("minat.log"); - $p['disable_tags'] = 0; - $p['disable_artwork'] = 0; - $p['premature'] = 0; - $p['max_size'] = 1000; - +$prefs_file = "/Users/".get_current_user()."/Library/Preferences/org.profiteroles.Minat.php"; +if (!file_exists($prefs_file)) { + if (!copy(__DIR__."/prefs.php",$prefs_file)) { + echo "Error creating preferences file"; + die; + } } +$p = unserialize(file_get_contents($prefs_file)); + +$p['phpbin'] = "/usr/bin/php"; +$p['flacbin'] = __DIR__."/bin/flac"; +$p['metaflacbin'] = __DIR__."/bin/metaflac"; +$p['lamebin'] = __DIR__."/bin/lame"; +$p['soxbin'] = __DIR__."/bin/sox"; + +$p['workdir'] = "/tmp/minat/"; +$p['logfile'] = getLogPath("minat.log"); +$p['disable_tags'] = 0; +$p['disable_artwork'] = 0; +$p['premature'] = 0; +$p['max_size'] = 1000; if ($p['mode'] != 1) { $p['premature'] = 1; addline("MODE ".$p['mode']." NOT YET IMPLEMENTED."); } @@ -59,46 +54,34 @@ addline("Minat: ".$version); addline("PHP: ".PHP_VERSION); addline(exec("sw_vers | grep ProductVersion")); -// Launch without argv (no files dragged) +// No files dragged array_shift($argv); -if(count($argv) == 0) { - addline("Launch without argv"); - 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("https://www.profiteroles.org/git/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"); +switch (@$argv[0]) { + case NULL: + addline("Launch without argv"); + die; + case "Preferences...": + exec($p['phpbin']." ".__DIR__."/MinatPrefs.php"); + addline("Launch preferences"); + die; + case "Show Debug Console": + exec("open -n Console.app --args ".$p['logfile']); + die; + case "Check for Updates...": + $curr_version = file_get_contents("https://www.profiteroles.org/git/profiteroles/Minat/raw/master/version.txt"); + if ($curr_version > $version) { + if(askMulti("Minat ".$curr_version." is available (you have ".$version.")", array("Cancel","Download")) == 1) { + exec("open http://www.profiteroles.org/git/profiteroles/Minat"); + echo "QUITAPP\n"; + } else { + die; + } + } else { + echo "\nALERT:Up-to-date|".$version." is the latest version.\n"; 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(); @@ -175,7 +158,7 @@ foreach ($argv as $target) { if (!$p['disable_artwork']) { - $mimecmd = $p['metaflacbin']." --list --block-type=PICTURE ".escapeshellarg($files[0])." | head -10 | grep MIME | sed 's:.*/::'"; + $mimecmd = escapeshellarg($p['metaflacbin'])." --list --block-type=PICTURE ".escapeshellarg($files[0])." | head -10 | grep MIME | sed 's:.*/::'"; addline($mimecmd); $mime = exec($mimecmd); if ($mime == " MIME type:") { @@ -187,7 +170,7 @@ foreach ($argv as $target) { addline("embedded cover found in ".$files[0]); $coverdest = $workdir."cover.".$mime; - exec($p['metaflacbin']." --export-picture-to=".escapeshellarg($coverdest)." ".escapeshellarg($files[0])); + exec(escapeshellarg($p['metaflacbin'])." --export-picture-to=".escapeshellarg($coverdest)." ".escapeshellarg($files[0])); if (file_exists($coverdest)) { $usecover = $coverdest; } else { addline ("error extracting file"); } } elseif ($extcover = findCover($target)) { @@ -228,13 +211,13 @@ foreach ($argv as $target) { addline("Processing ".$file); if ($p['check']) { - if (exec($p['flacbin']." -ts ".escapeshellarg($file)." 2>&1")) { + if (exec(escapeshellarg($p['flacbin'])." -ts ".escapeshellarg($file)." 2>&1")) { addline("Skipping corrupted flac: ".$file); continue; } } - $tagcmd = $p['soxbin']." --i -a ".escapeshellarg($file); + $tagcmd = escapeshellarg($p['soxbin'])." --i -a ".escapeshellarg($file); if (!$p['disable_tags']) { @@ -246,8 +229,8 @@ 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']." --id3v2-utf16 ".$tags." ".$covertags." - ".escapeshellarg($dest); + $cmd_flac = escapeshellarg($p['flacbin'])." -dcs -- ".escapeshellarg($file); + $cmd_lame = escapeshellarg($p['lamebin'])." -S ".$p['lameopts']." --id3v2-utf16 ".$tags." ".$covertags." - ".escapeshellarg($dest); $cmd_lock = "touch ".escapeshellarg($lockfile); $line[] = $cmd_flac." | ".$cmd_lame." ; ".$cmd_lock; diff --git a/MinatPrefs.php b/MinatPrefs.php index 24d830d..34588ba 100755 --- a/MinatPrefs.php +++ b/MinatPrefs.php @@ -1,16 +1,121 @@ \ No newline at end of file diff --git a/Parallel/parallel b/Parallel/parallel index 808aac3..7c4710d 100755 --- a/Parallel/parallel +++ b/Parallel/parallel @@ -1,4 +1,4 @@ -#!/opt/local/bin/perl +#!/usr/bin/perl # Copyright (C) 2007-2019 Ole Tange and Free Software Foundation, Inc. # diff --git a/README.md b/README.md index 5d040c4..6a08ba6 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Support is planned for two other operations: * Generate specs from audio files supported by sox * Rename folders based on the tags of the audio files inside -* **⇩ [Download Minat 0.1.7](https://www.profiteroles.org/downloads/Minat_0.1.7.zip)** +* **⇩ [Download Latest Version](https://www.profiteroles.org/git/profiteroles/Minat/raw/master/Minat.app.zip)** ## Screenshot diff --git a/functions.pashua.php b/functions.pashua.php deleted file mode 100755 index be0d681..0000000 --- a/functions.pashua.php +++ /dev/null @@ -1,165 +0,0 @@ - \ No newline at end of file diff --git a/version.txt b/version.txt index a1e1395..84aa3a7 100755 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.1.7 \ No newline at end of file +0.1.8 \ No newline at end of file