summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormomo-i <momo-i@ampache>2009-11-24 00:45:47 +0000
committermomo-i <momo-i@ampache>2009-11-24 00:45:47 +0000
commitc796c76f764209199cad39644abdc66cd926ef71 (patch)
tree71d8746660033fac83207e378b298ca8dcf8942d
parentef21e122d1c55d03ce346e58d907b98313fcecfa (diff)
downloadampache-c796c76f764209199cad39644abdc66cd926ef71.tar.gz
ampache-c796c76f764209199cad39644abdc66cd926ef71.tar.bz2
ampache-c796c76f764209199cad39644abdc66cd926ef71.zip
Update localization
-rw-r--r--bin/catalog_update.inc27
-rw-r--r--bin/delete_disabled.inc8
-rw-r--r--bin/fix_filenames.inc174
-rw-r--r--bin/migrate_config.inc85
-rw-r--r--bin/print_tags.inc1
-rw-r--r--bin/sort_files.inc124
-rw-r--r--bin/write_playlists.inc46
-rw-r--r--bin/write_tags.inc33
8 files changed, 276 insertions, 222 deletions
diff --git a/bin/catalog_update.inc b/bin/catalog_update.inc
index a7652fb1..ecabeb4b 100644
--- a/bin/catalog_update.inc
+++ b/bin/catalog_update.inc
@@ -24,7 +24,8 @@ $path = dirname(__FILE__);
$prefix = realpath($path . '/../');
require_once $prefix . '/lib/init.php';
-echo "- Catalog Update -\n Usage: catalog_update.inc [CATALOG NAME] [-c|-v|-a]\n-c\tClean Catalogs\n-v\tVerify Catalogs\n-a\tAdd to Catalogs\n*Default behavior is to do all 3*\n";
+usage();
+
ob_end_flush();
$catclean = 0; //All off by default
@@ -67,21 +68,24 @@ while ($row = Dba::fetch_row($db_results)) {
echo "Reading: $catalog->name \n";
if ($catclean == 1) {
// Clean out dead files
- echo "- Starting Clean - \n";
+ echo _("- Starting Clean - ");
+ echo "\n";
$catalog->clean_catalog();
echo "------------------\n\n";
}
if ($catverify == 1) {
// Verify Existing
- echo "- Starting Verify - \n";
+ echo _("- Starting Verify - ");
+ echo "\n";
$catalog->verify_catalog($row['0']);
echo "-------------------\n\n";
}
if ($catadd == 1) {
// Look for new files
- echo "- Starting Add - \n";
+ echo _("- Starting Add - ");
+ echo "\n";
$catalog->add_to_catalog();
echo "----------------\n\n";
}
@@ -97,4 +101,19 @@ function ob_html_strip($string) {
} // ob_html_strip
+function usage() {
+ echo _("- Catalog Update -");
+ echo "\n";
+ echo _("Usage: catalog_update.inc [CATALOG NAME] [-c|-v|-a]");
+ echo "\n-c\t";
+ echo _('Clean Catalogs');
+ echo "\n-v\t";
+ echo _('Verify Catalogs');
+ echo "\n-a\t";
+ echo _('Add to Catalogs');
+ echo "\n";
+ echo _("*Default behavior is to do all 3*");
+ echo "\n";
+}
+
?>
diff --git a/bin/delete_disabled.inc b/bin/delete_disabled.inc
index 8d2a2df0..e296fe2e 100644
--- a/bin/delete_disabled.inc
+++ b/bin/delete_disabled.inc
@@ -34,7 +34,7 @@ $path = dirname(__FILE__);
$prefix = realpath($path . '/../');
require_once $prefix . '/lib/init.php';
-if ($debug) { echo "DEBUG ENABLED WILL NOT DELETE FILES!\n"; }
+if ($debug) { echo _("DEBUG ENABLED WILL NOT DELETE FILES!"); echo "\n"; }
/* Get a list of filenames */
$sql = "SELECT `id`,`file` FROM song WHERE enabled='0'";
@@ -42,10 +42,12 @@ $db_results = Dba::query($sql);
while ($row = Dba::fetch_assoc($db_results)) {
if ($debug) {
- echo "Would Delete: " . $row['file'] . "\n";
+ printf (_('Would Delete: %s'), $row['file']);
+ echo "\n";
}
else {
- echo "Deleting: " . $row['file'] . "\n";
+ printf (_('Deleting: %s'), $row['file']);
+ echo "\n";
unlink($row['file']);
$sql = "DELETE FROM `song` WHERE `id`='" . Dba::escape($row['id']) . "'";
$del_results = Dba::query($sql);
diff --git a/bin/fix_filenames.inc b/bin/fix_filenames.inc
index 5f46f0e7..803c1ed9 100644
--- a/bin/fix_filenames.inc
+++ b/bin/fix_filenames.inc
@@ -37,39 +37,44 @@ ob_end_clean();
// If set to true / 1 then it will not prompt!
//$GLOBALS['i_am_crazy'] = true;
-if (!function_exists('iconv')) {
- echo "ERROR: Iconv required for this functionality, quiting\n";
- exit;
-}
+if (!function_exists('iconv')) {
+ echo _("ERROR: Iconv required for this functionality, quiting");
+ echo "\n";
+ exit;
+}
// Attempt to figure out what the System Charset is
-$source_encoding = iconv_get_encoding('output_encoding');
+$source_encoding = iconv_get_encoding('output_encoding');
// Attempt a simple translation
-$string = iconv(Config::get('site_charset'),Config::get('site_charset'),'For the Love of Music');
-echo "Testing Basic Translation, the two strings below should look the same\n";
-echo "Original: For the Love of Music\n";
-echo "Translated: $string\n";
+$string = sprintf(_('%s For the Love of Music'), iconv(Config::get('site_charset'),Config::get('site_charset')));
+echo _('Testing Basic Translation, the two strings below should look the same');
+echo "\n";
+echo _('Original: For the Love of Music');
+echo "\n";
+printf (_('Translated: %s'), $string);
+echo "\n";
echo "---------------------------------------------------------------------\n";
-echo "Input Charset ($source_encoding):";
+printf (_('Input Charset (%s):'), $source_encoding);
$input = trim(fgets(STDIN));
if (strlen($input) > 0) { $source_encoding = trim($input); }
-echo "Using $source_encoding as source character set\n";
-
+printf (_('Using %s as source character set'), $source_encoding);
+echo "\n";
$sql = "SELECT * FROM `catalog` WHERE `catalog_type`='local'";
$db_results = Dba::query($sql);
while ($row = Dba::fetch_assoc($db_results)) {
- echo "Checking " . $row['name'] . " (" . $row['path'] . ")\n";
+ printf(_('Checking %s (%s)'), $row['name'], $row['path']);
+ echo "\n";
charset_directory_correct($row['path']);
} // end of the catalogs
-echo "Finished checking filenames for valid chacters\n";
-
+echo _('Finished checking filenames for valid chacters');
+echo "\n";
/**************************************************
****************** FUNCTIONS *********************
@@ -93,52 +98,59 @@ function charset_directory_correct($path) {
/* Open up the directory */
$handle = opendir($path);
- if (!is_resource($handle)) {
- echo "ERROR: Unable to open $path\n";
- return false;
- }
+ if (!is_resource($handle)) {
+ printf (_('ERROR: Unable to open %s'), $path);
+ echo "\n";
+ return false;
+ }
- if (!chdir($path)) {
- echo "ERROR: Unable to chdir to $path\n";
- return false;
- }
+ if (!chdir($path)) {
+ printf (_('ERROR: Unable to chdir to %s'), $path);
+ echo "\n";
+ return false;
+ }
- while ( false !== ($file = readdir($handle) ) ) {
+ while ( false !== ($file = readdir($handle) ) ) {
- if ($file == '.' || $file == '..') { continue; }
+ if ($file == '.' || $file == '..') { continue; }
$full_file = $path.$slash_type.$file;
- if (is_dir($full_file)) {
- charset_directory_correct($full_file);
- continue;
- }
+ if (is_dir($full_file)) {
+ charset_directory_correct($full_file);
+ continue;
+ }
$verify_filename = iconv(Config::get('site_charset'),Config::get('site_charset') . '//IGNORE',$full_file);
- if (strcmp($full_file,$verify_filename) != '0') {
- $translated_filename = iconv($source_encoding,Config::get('site_charset') . '//TRANSLIT',$full_file);
+ if (strcmp($full_file,$verify_filename) != '0') {
+ $translated_filename = iconv($source_encoding,Config::get('site_charset') . '//TRANSLIT',$full_file);
// Make sure the extension stayed the same
- if (substr($translated_filename,strlen($translated_filename)-3,3) != substr($full_file,strlen($full_file)-3,3)) {
- echo "Translation failure, stripping non-valid characters\n";
- $translated_filename = iconv($source_encoding,Config::get('site_charset') . '//IGNORE',$full_file);
- }
-
- echo "Attempting to Transcode to " . Config::get('site_charset') . "\n";
+ if (substr($translated_filename,strlen($translated_filename)-3,3) != substr($full_file,strlen($full_file)-3,3)) {
+ echo _("Translation failure, stripping non-valid characters");
+ echo "\n";
+ $translated_filename = iconv($source_encoding,Config::get('site_charset') . '//IGNORE',$full_file);
+ }
+
+ printf (_('Attempting to Transcode to %s'), Config::get('site_charset'));
+ echo "\n";
echo "--------------------------------------------------------------------------------------------\n";
- echo "OLD:$full_file has invalid chars\nNEW:$translated_filename\n";
+ printf (_('OLD: %s has invalid chars'), $full_file);
+ echo "\n";
+ printf (_('NEW: %s'), $translated_filename);
+ echo "\n";
echo "--------------------------------------------------------------------------------------------\n";
- if (!$GLOBALS['i_am_crazy']) {
- echo "Rename File (Y/N):";
- $input = trim(fgets(STDIN));
- if (strcasecmp($input,'Y') == 0) { charset_rename_file($full_file,$translated_filename); }
- else { echo "\n\tNot Renaming...\n\n"; }
- }
- else {
- charset_rename_file($full_file,$translated_filename);
- }
- }
+ if (!$GLOBALS['i_am_crazy']) {
+ echo _("Rename File (Y/N):");
+ $input = trim(fgets(STDIN));
+ if (strcasecmp($input,'Y') == 0) { charset_rename_file($full_file,$translated_filename); }
+ else { echo "\n\t"; echo _('Not Renaming...'); echo "\n\n"; }
+ }
+ else {
+ charset_rename_file($full_file,$translated_filename);
+ }
+ }
} // while reading file
@@ -148,54 +160,57 @@ function charset_directory_correct($path) {
* charset_rename_file
* This just takes a source / dest and does the renaming
*/
-function charset_rename_file($full_file,$translated_filename) {
+function charset_rename_file($full_file,$translated_filename) {
// First break out the base directory name and make sure it exists
// incase our crap char is in the directory
- $directory = dirname($translated_filename);
+ $directory = dirname($translated_filename);
$data = preg_split("/[\/\\\]/",$directory);
- $path = '';
+ $path = '';
foreach ($data as $dir) {
- $dir = charset_clean_name($dir);
- $path .= "/" . $dir;
-
- if (!is_dir($path)) {
- echo "\tMaking $path directory\n";
- $results = mkdir($path);
- if (!$results) {
- echo "Error: Unable to create $path move failed, stopping\n";
- return false;
- }
+ $dir = charset_clean_name($dir);
+ $path .= "/" . $dir;
+
+ if (!is_dir($path)) {
+ echo "\tMaking $path directory\n";
+ $results = mkdir($path);
+ if (!$results) {
+ printf (_('Error: Unable to create %s move failed, stopping'), $path);
+ echo "\n";
+ return false;
+ }
} // if the dir doesn't exist
} // end foreach
// Now to copy the file
- $results = copy($full_file,$translated_filename);
-
- if (!$results) {
- echo "Error: Copy Failed, not deleteing old file\n";
- return false;
- }
-
- $old_sum = filesize($full_file);
- $new_sum = filesize($translated_filename);
+ $results = copy($full_file,$translated_filename);
- if ($old_sum != $new_sum OR !$new_sum) {
- echo "Error: Size Inconsistency, not deleting" . $full_file . "\n";
- return false;
- }
+ if (!$results) {
+ echo _('Error: Copy Failed, not deleteing old file');
+ echo "\n";
+ return false;
+ }
+
+ $old_sum = filesize($full_file);
+ $new_sum = filesize($translated_filename);
- $results = unlink($full_file);
+ if ($old_sum != $new_sum OR !$new_sum) {
+ printf (_('Error: Size Inconsistency, not deleting %s'), $full_file);
+ echo "\n";
+ return false;
+ }
- if (!$results) { echo "Error: Unable to delete " . $full_file . "\n"; return false; }
-
+ $results = unlink($full_file);
- echo "File Moved...\n\n";
+ if (!$results) { printf (_('Error: Unable to delete %s'), $full_file); echo "\n"; return false; }
- return true;
+ echo _("File Moved...");
+ echo "\n\n";
+
+ return true;
} // charset_rename_file
@@ -219,5 +234,4 @@ function charset_clean_name($string) {
} // charset_clean_name
-
?>
diff --git a/bin/migrate_config.inc b/bin/migrate_config.inc
index 4bc381d6..7e88774b 100644
--- a/bin/migrate_config.inc
+++ b/bin/migrate_config.inc
@@ -39,53 +39,56 @@ $translate = array('local_host'=>'database_hostname',
'sess_cookielife'=>'session_cookielife',
'sess_cookiesecure'=>'session_cookiesecure');
-$path = dirname(__FILE__);
-$prefix = realpath($path . '/../');
-$old_config = file_get_contents($prefix . '/config/ampache.cfg.php');
-
-$data = explode("\n",$old_config);
-
-echo "Parsing old config file...\n";
-
-foreach ($data as $line) {
-
- // Replace a # with ;
- if ($line['0'] == '#') {
- $line = substr_replace($line,";",0,1);
- }
-
- foreach ($unmigratable as $option=>$default) {
- if (strstr($line,$option) AND !$migrated[$option]) {
- $line = $option . " = \"$default\"";
- $migrated[$option] = true;
- }
- elseif (strstr($line,$option)) {
- $line = ';' . $line;
- }
- }
-
- foreach ($translate as $old=>$new) {
- if (strstr($line,$old)) {
- $line = str_replace($old,$new,$line);
- }
- }
-
- $new_config .= $line . "\n";
+$path = dirname(__FILE__);
+$prefix = realpath($path . '/../');
+$old_config = file_get_contents($prefix . '/config/ampache.cfg.php');
-} // end foreach lines
+$data = explode("\n",$old_config);
+
+echo _("Parsing old config file...");
+echo "\n";
+
+foreach ($data as $line) {
+
+ // Replace a # with ;
+ if ($line['0'] == '#') {
+ $line = substr_replace($line,";",0,1);
+ }
+ foreach ($unmigratable as $option=>$default) {
+ if (strstr($line,$option) AND !$migrated[$option]) {
+ $line = $option . " = \"$default\"";
+ $migrated[$option] = true;
+ }
+ elseif (strstr($line,$option)) {
+ $line = ';' . $line;
+ }
+ }
+
+ foreach ($translate as $old=>$new) {
+ if (strstr($line,$old)) {
+ $line = str_replace($old,$new,$line);
+ }
+ }
+
+ $new_config .= $line . "\n";
+
+} // end foreach lines
-echo "Parse complete, writing\n";
+echo _("Parse complete, writing");
+echo "\n";
$handle = fopen($prefix . '/config/ampache.cfg.php','w');
-$worked = fwrite($handle,$new_config);
+$worked = fwrite($handle,$new_config);
-if ($worked) {
- echo "Write success, config migrated\n";
-}
-else {
- echo "Access Denied, config migration failed\n";
-}
+if ($worked) {
+ echo _("Write success, config migrated");
+ echo "\n";
+}
+else {
+ echo _("Access Denied, config migration failed");
+ echo "\n";
+}
?>
diff --git a/bin/print_tags.inc b/bin/print_tags.inc
index f34a0cfe..2343d860 100644
--- a/bin/print_tags.inc
+++ b/bin/print_tags.inc
@@ -1,4 +1,3 @@
-#!/usr/bin/env php
<?php
/*
diff --git a/bin/sort_files.inc b/bin/sort_files.inc
index 41271d79..51f7abcf 100644
--- a/bin/sort_files.inc
+++ b/bin/sort_files.inc
@@ -38,11 +38,11 @@
$alphabet_prefix = true;
define('NO_SESSION','1');
-$path = dirname(__FILE__);
-$prefix = realpath($path . '/../');
+$path = dirname(__FILE__);
+$prefix = realpath($path . '/../');
require_once $prefix . '/lib/init.php';
-ob_end_clean();
+ob_end_clean();
/* First Clean the catalog to we don't try to write anything we shouldn't */
@@ -51,33 +51,38 @@ $db_results = Dba::query($sql);
$catalogs = array();
-while ($r = Dba::fetch_row($db_results)) {
-
+while ($r = Dba::fetch_row($db_results)) {
$catalog = new Catalog($r['0']);
$songs = $catalog->get_catalog_files();
- echo "Starting Catalog: " . stripslashes($catalog->name) . "\n";
+ printf (_('Starting Catalog: %s'), stripslashes($catalog->name));
+ echo "\n";
/* Foreach through each file and find it a home! */
- foreach ($songs as $song) {
+ foreach ($songs as $song) {
/* Find this poor song a home */
$song->format();
$song->format_pattern();
$directory = sort_find_home($song,$catalog->sort_pattern,$catalog->path);
- $filename = $song->f_file;
+ $filename = $song->f_file;
$fullpath = $directory . "/" . $filename;
/* Check for Demo Mode */
- if ($test_mode) {
+ if ($test_mode) {
/* We're just talking here... no work */
- echo "Moving File...\n\tSource: $song->file\n\tDest: $fullpath\n";
+ echo _("Moving File...");
+ echo "\n\t";
+ printf (_('Source: %s'), $song->file);
+ echo "\n\t";
+ printf (_('Dest: %s'), $fullpath);
+ echo "\n";
flush();
}
- /* We need to actually do the moving (fake it if we are testing)
+ /* We need to actually do the moving (fake it if we are testing)
* Don't try to move it, if it's already the same friggin thing!
*/
- if ($song->file != $fullpath && strlen($fullpath)) {
+ if ($song->file != $fullpath && strlen($fullpath)) {
sort_move_file($song,$fullpath);
}
@@ -85,14 +90,13 @@ while ($r = Dba::fetch_row($db_results)) {
} // end foreach catalogs
-
/************** FUNCTIONS *****************/
/**
* sort_find_home
* Get the directory for this file from the catalog and the song info using the sort_pattern
* takes into account various artists and the alphabet_prefix
*/
-function sort_find_home($song,$sort_pattern,$base) {
+function sort_find_home($song,$sort_pattern,$base) {
$home = rtrim($base,"\/");
$home = rtrim($home,"\\");
@@ -103,22 +107,22 @@ function sort_find_home($song,$sort_pattern,$base) {
$track = sort_clean_name($song->track);
$title = sort_clean_name($song->title);
$year = sort_clean_name($song->year);
- $comment = sort_clean_name($song->comment);
+ $comment = sort_clean_name($song->comment);
/* Do the various check */
$album_object = new Album($song->album);
- $album_object->format();
- if ($album_object->artist_count != '1') {
+ $album_object->format();
+ if ($album_object->artist_count != '1') {
$artist = "Various";
}
-
+
/* IF we want a,b,c,d we need to know the first element */
- if ($GLOBALS['alphabet_prefix']) {
+ if ($GLOBALS['alphabet_prefix']) {
$sort_pattern = preg_replace("/\/?%o\//","",$sort_pattern);
$first_element = substr($sort_pattern,0,2);
$element = sort_element_name($first_element);
if (!$element) { $alphabet = 'ZZ'; }
- else { $alphabet = strtoupper(substr(${$element},0,1)); }
+ else { $alphabet = strtoupper(substr(${$element},0,1)); }
$alphabet = preg_replace("/[^A-Za-z0-9]/","ZZ",$alphabet);
$home .= "/$alphabet";
@@ -131,7 +135,7 @@ function sort_find_home($song,$sort_pattern,$base) {
/* Remove non A-Z0-9 chars */
$sort_pattern = preg_replace("[^\\\/A-Za-z0-9\-\_\ \'\,\(\)]","_",$sort_pattern);
-
+
$home .= "/$sort_pattern";
return $home;
@@ -144,7 +148,7 @@ function sort_find_home($song,$sort_pattern,$base) {
*/
function sort_element_name($key) {
- switch ($key) {
+ switch ($key) {
case '%t':
return 'title';
break;
@@ -160,7 +164,7 @@ function sort_element_name($key) {
case '%y':
return 'year';
break;
- default:
+ default:
break;
} // switch on key
@@ -175,7 +179,7 @@ function sort_element_name($key) {
* Before it is put togeather, this removes / and \ and also
* once I figure it out, it'll clean other stuff
*/
-function sort_clean_name($string) {
+function sort_clean_name($string) {
/* First remove any / or \ chars */
$string = preg_replace('/[\/\\\]/','-',$string);
@@ -196,9 +200,9 @@ function sort_clean_name($string) {
* Instead we cheeseball it and walk through the new dir structure and make
* sure that the directories exist, once the dirs exist then we do a copy
* and unlink.. This is a little unsafe, and as such it verifys the copy
- * worked by doing a filesize() before unlinking.
+ * worked by doing a filesize() before unlinking.
*/
-function sort_move_file($song,$fullname) {
+function sort_move_file($song,$fullname) {
$old_dir = dirname($song->file);
@@ -212,21 +216,24 @@ function sort_move_file($song,$fullname) {
/* We not need the leading / */
unset($data[0]);
- foreach ($data as $dir) {
-
+ foreach ($data as $dir) {
+
$dir = sort_clean_name($dir);
$path .= "/" . $dir;
/* We need to check for the existance of this directory */
- if (!is_dir($path)) {
- if ($GLOBALS['test_mode']) {
- echo "\tMaking $path Directory\n";
+ if (!is_dir($path)) {
+ if ($GLOBALS['test_mode']) {
+ echo "\t";
+ printf (_('Making %s Directory'), $path);
+ echo "\n";
}
- else {
- debug_event('mkdir',"Creating $path directory",'5');
- $results = mkdir($path);
- if (!$results) {
- echo "Error: Unable to create $path move failed\n";
+ else {
+ debug_event('mkdir',"Creating $path directory",'5');
+ $results = mkdir($path);
+ if (!$results) {
+ printf (_('Error: Unable to create %s move failed'), $path);
+ echo "\n";
return false;
}
} // else we aren't in test mode
@@ -235,51 +242,56 @@ function sort_move_file($song,$fullname) {
} // foreach dir
/* Now that we've got the correct directory structure let's try to copy it */
- if ($GLOBALS['test_mode']) {
- echo "\tCopying $file to $directory\n";
+ if ($GLOBALS['test_mode']) {
+ echo "\t";
+ // HINT: %1$s: file, %2$s: directory
+ printf (_('Copying %1$s to %2$s'), $file, $directory);
+ echo "\n";
$sql = "UPDATE song SET file='" . Dba::escape($fullname) . "' WHERE id='" . Dba::escape($song->id) . "'";
echo "\tSQL: $sql\n";
flush();
}
- else {
+ else {
/* Check for file existance */
- if (file_exists($fullname)) {
- debug_event('file exists','Error: $fullname already exists','1');
- echo "Error: $fullname already exists\n";
+ if (file_exists($fullname)) {
+ debug_event('file exists','Error: $fullname already exists','1');
+ printf (_('Error: %s already exists'), $filename);
+ echo "\n";
return false;
}
-
+
$results = copy($song->file,$fullname);
- debug_event('copy','Copied ' . $song->file . ' to ' . $fullname,'5');
-
+ debug_event('copy','Copied ' . $song->file . ' to ' . $fullname,'5');
+
/* Look for the folder art and copy that as well */
- if (!Config::get('album_art_preferred_filename') OR strstr(Config::get('album_art_preferred_filename'),"%")) {
+ if (!Config::get('album_art_preferred_filename') OR strstr(Config::get('album_art_preferred_filename'),"%")) {
$folder_art = $directory . '/folder.jpg';
$old_art = $old_dir . '/folder.jpg';
}
- else {
- $folder_art = $directory . "/" . sort_clean_name(Config::get('album_art_preferred_filename'));
- $old_art = $old_dir . "/" . sort_clean_name(Config::get('album_art_preferred_filename'));
+ else {
+ $folder_art = $directory . "/" . sort_clean_name(Config::get('album_art_preferred_filename'));
+ $old_art = $old_dir . "/" . sort_clean_name(Config::get('album_art_preferred_filename'));
}
debug_event('copy_art','Copied ' . $old_art . ' to ' . $folder_art,'5');
@copy($old_art,$folder_art);
-
- if (!$results) { echo "Error: Unable to copy file to $fullname\n"; return false; }
+
+ if (!$results) { printf (_('Error: Unable to copy file to %s'), $fullname); echo "\n"; return false; }
/* Check the filesize */
$new_sum = filesize($fullname);
$old_sum = filesize($song->file);
- if ($new_sum != $old_sum OR !$new_sum) {
- echo "Error: Size Inconsistency, not deleting " . $song->file . "\n";
- return false;
+ if ($new_sum != $old_sum OR !$new_sum) {
+ printf (_('Error: Size Inconsistency, not deleting %s'), $song->file);
+ echo "\n";
+ return false;
} // end if sum's don't match
-
+
/* If we've made it this far it should be safe */
$results = unlink($song->file);
- if (!$results) { echo "Error: Unable to delete " . $song->file . "\n"; }
+ if (!$results) { printf (_('Error: Unable to delete %s'), $song->file); echo "\n"; }
/* Update the catalog */
$sql = "UPDATE song SET file='" . Dba::escape($fullname) . "' WHERE id='" . Dba::escape($song->id) . "'";
diff --git a/bin/write_playlists.inc b/bin/write_playlists.inc
index 62c3ed96..3d9b8513 100644
--- a/bin/write_playlists.inc
+++ b/bin/write_playlists.inc
@@ -30,48 +30,50 @@ define('NO_SESSION','1');
require ("../lib/init.php");
-if (!$GLOBALS['argv']['1'] || $GLOBALS['argv']['1'] == '-h') { usage(); }
-else {
- $dirname = $GLOBALS['argv']['1'];
- $type = $GLOBALS['argv']['2'];
-}
-
+if (!$GLOBALS['argv']['1'] || $GLOBALS['argv']['1'] == '-h') { usage(); }
+else {
+ $dirname = $GLOBALS['argv']['1'];
+ $type = $GLOBALS['argv']['2'];
+}
// Make sure the output dir is valid and writeable
-if (!is_writeable($dirname)) {
- echo "Error: Directory $dirname not writeable\n";
+if (!is_writeable($dirname)) {
+ printf (_('Error: Directory %s not writeable'), $dirname);
+ echo "\n";
}
// Switch on the type of playlist dump we want to do
// here
-switch ($type) {
- case 'playlists':
-
+switch ($type) {
+ case 'playlists':
break;
- case 'artist':
+ case 'artist':
break;
- default:
-
-
+ default:
break;
} // end type switch
/* FUNCTIONS */
-function usage() {
+function usage() {
+
+$desc1 = _("This will dump a collection of m3u playlists based on type");
+$desc2 = _("Types:");
+$desc3 = _("Dumps all Albums as individual playlists");
+$desc4 = _("Dumps all of your Playlists as m3u's");
+$desc5 = _("Dumps all Artists as individual playlists");
$string = "write_playlists.php.inc [-h] <DIRNAME> <TYPE>
- This will dump a collection of m3u playlists based on type
- Types:
- default Dumps all Albums as individual playlists
- playlists Dumps all of your Playlists as m3u's
- artist Dumps all Artists as individual playlists\n\n";
+ $desc1
+ $desc2
+ default $desc3
+ playlists $desc4
+ artist $desc5\n\n";
exit($string);
} // useage
-
?>
diff --git a/bin/write_tags.inc b/bin/write_tags.inc
index 99a938ae..fd012efb 100644
--- a/bin/write_tags.inc
+++ b/bin/write_tags.inc
@@ -27,13 +27,14 @@
*/
define('NO_SESSION','1');
-$path = dirname(__FILE__);
-$prefix = realpath($path . '/../');
+$path = dirname(__FILE__);
+$prefix = realpath($path . '/../');
require_once $prefix . '/lib/init.php';
// This is all broken currently so just jump ship
-echo "Writting of Tags to files is not currently supported by Getid3() use at your own risk.\n";
-flush();
+echo _("Writting of Tags to files is not currently supported by Getid3() use at your own risk.");
+echo "\n";
+flush();
require_once Config::get('prefix') . '/modules/getid3/write.vorbis.php';
require_once Config::get('prefix') . '/modules/getid3/write.apetag.php';
@@ -42,19 +43,20 @@ require_once Config::get('prefix') . '/modules/getid3/write.flac.php';
$flag = new Flag();
$flagged_ids = Flag::get_approved();
-if (!count($flagged_ids)) {
- echo "No Flagged Songs Found, exiting...\n";
- exit;
-}
+if (!count($flagged_ids)) {
+ echo _("No Flagged Songs Found, exiting...");
+ echo "\n";
+ exit;
+}
// Loop through every song that has an approved flag
-foreach($flagged_ids as $flagged){
+foreach($flagged_ids as $flagged) {
$flag = new Flag($flagged);
$song = new Song($flag->object_id);
// Decide on what type of tag format to use, base on song type(a better way maybe?)
- switch($song->type){
+ switch($song->type) {
case 'mp3':
case 'mp2':
case 'mp1':
@@ -70,16 +72,18 @@ foreach($flagged_ids as $flagged){
Flag::fill_tags( &$tagWriter, &$song, 'comment' );
break;
default:
- echo 'No Tag';
+ echo _('No Tag');
} // end switch
if ( isset($tagWriter) ) {
-
+
// Write out the tag
try {
$tagWriter->write();
- echo 'Updated song ' . $song->title . ' by ' . $song->get_artist_name() . "\n";
- flush();
+ // HINT: %1$s: title, %2$s: artist_name
+ printf (_('Updated song %1$s by %2$s'), $song->title, $song->get_artist_name());
+ echo "\n";
+ flush();
$flag->delete();
}
catch ( Exception $e ) {
@@ -93,4 +97,3 @@ foreach($flagged_ids as $flagged){
}
?>
-