Divadsn (Code Review)
2017-12-31 03:01:40 UTC
Divadsn has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/401113 )
Change subject: [WIP] Generalize wording of audio formats in Score.php
......................................................................
[WIP] Generalize wording of audio formats in Score.php
Bug: T183753
Change-Id: Iba98dd7281e3910f4dcde1d40b4361fc372f8c1f
---
M i18n/en.json
M i18n/qqq.json
M includes/Score.php
3 files changed, 37 insertions(+), 37 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Score refs/changes/13/401113/1
diff --git a/i18n/en.json b/i18n/en.json
index b42c585..326a26d 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -15,7 +15,7 @@
"score-error-category-desc": "There was an error while rendering the score.",
"score-getcwderr": "Unable to obtain current working directory",
"score-invalidlang": "Invalid score language lang=\"<nowiki>$1</nowiki>\". Currently recognized languages are lang=\"lilypond\" (the default) and lang=\"ABC\".",
- "score-invalidoggoverride": "The file \"<nowiki>$1</nowiki>\" you specified with override_ogg is invalid. Please specify the file name only, omit <nowiki>[[…]]</nowiki> and the \"{{ns:file}}:\" prefix.",
+ "score-invalidaudiooverride": "The file \"<nowiki>$1</nowiki>\" you specified with override_audio is invalid. Please specify the file name only, omit <nowiki>[[…]]</nowiki> and the \"{{ns:file}}:\" prefix.",
"score-midioverridenotfound": "The file \"<nowiki>$1</nowiki>\" you specified with override_midi could not be found. Please specify the file name only, omit <nowiki>[[…]]</nowiki> and the \"{{ns:file}}:\" prefix.",
"score-noabcinput": "ABC source file $1 could not be created.",
"score-noimages": "No score images were generated. Please check your score code.",
@@ -26,7 +26,7 @@
"score-notexecutable": "Could not execute LilyPond: $1 is not an executable file. Make sure <code>$wgScoreLilyPond</code> is set correctly.",
"score-nocontent": "Could not load file $1 from server.",
"score-oggconversionerr": "Unable to convert MIDI to Ogg/Vorbis:\n$1",
- "score-oggoverridenotfound": "The file \"<nowiki>$1</nowiki>\" you specified with override_ogg does not exist.",
+ "score-audiooverridenotfound": "The file \"<nowiki>$1</nowiki>\" you specified with override_audio does not exist.",
"score-page": "Page $1",
"score-pregreplaceerr": "PCRE regular expression replacement failed",
"score-readerr": "Unable to read file $1.",
@@ -49,5 +49,5 @@
"score-visualeditor-mwscoreinspector-raw": "This is a complete LilyPond file",
"score-visualeditor-mwscoreinspector-title": "Musical notation",
"score-visualeditor-mwscoreinspector-vorbis": "Include an audio file (auto-generated by default)",
- "score-vorbisoverrideogg": "You cannot request Ogg/Vorbis rendering and specify override_ogg at the same time."
+ "score-vorbisoverrideaudio": "You cannot request Ogg/Vorbis rendering and specify override_audio at the same time."
}
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 7fb2a39..4b647ec 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -21,7 +21,7 @@
"score-error-category-desc": "Description on [[Special:TrackingCategories]] for the {{msg-mw|score-error-category}} tracking category.",
"score-getcwderr": "Displayed if the extension cannot obtain the current working directory.",
"score-invalidlang": "Displayed if the lang=\"…\" attribute contains an unrecognized score language. $1 is the unrecognized language.",
- "score-invalidoggoverride": "Displayed if the file specified with the override_ogg=\"…\" attribute is invalid. $1 is the value of the override_ogg attribute.",
+ "score-invalidaudiooverride": "Displayed if the file specified with the override_audio=\"…\" attribute is invalid. $1 is the value of the override_audio attribute.",
"score-midioverridenotfound": "Displayed if the file specified with the override_midi=\"…\" attribute could not be found. $1 is the value of the override_midi attribute.",
"score-noabcinput": "Displayed if an ABC source file could not be created for lang=\"ABC\". $1 is the path to the file that could not be created.",
"score-noimages": "Displayed if no score images were rendered.",
@@ -32,7 +32,7 @@
"score-notexecutable": "Displayed if LilyPond binary cannot be executed. $1 is the path to the LilyPond binary.",
"score-nocontent": "Parameters:\n* $1 - filename",
"score-oggconversionerr": "Displayed if the MIDI to Ogg/Vorbis conversion failed. $1 is the error (generally big block of text in a pre tag)",
- "score-oggoverridenotfound": "Displayed if the file specified with the override_ogg=\"…\" attribute could not be found. $1 is the value of the override_ogg attribute.",
+ "score-audiooverridenotfound": "Displayed if the file specified with the override_audio=\"…\" attribute could not be found. $1 is the value of the override_ogg attribute.",
"score-page": "The word \"Page\" as used in pagination. Parameters:\n* $1 - the page number\n{{Identical|Page}}",
"score-pregreplaceerr": "Displayed if a PCRE regular expression replacement failed.",
"score-readerr": "Displayed if the extension could not read a file. $1 is the path to the file that could not be read.",
@@ -55,5 +55,5 @@
"score-visualeditor-mwscoreinspector-raw": "Label for the raw attribute of the score node",
"score-visualeditor-mwscoreinspector-title": "Title for the inspector to edit <nowiki><score></nowiki> blocks.",
"score-visualeditor-mwscoreinspector-vorbis": "Label for the vorbis attribute of the score node",
- "score-vorbisoverrideogg": "Displayed if both vorbis=\"1\" and override_ogg=\"…\" were specified."
+ "score-vorbisoverrideaudio": "Displayed if both vorbis=\"1\" and override_audio=\"…\" were specified."
}
diff --git a/includes/Score.php b/includes/Score.php
index de9d970..89a6765 100644
--- a/includes/Score.php
+++ b/includes/Score.php
@@ -232,9 +232,9 @@
$sha1 = $file->getSha1();
$oggRelDir = "override-midi/{$sha1[0]}/{$sha1[1]}";
$oggRel = "$oggRelDir/$sha1.ogg";
- $options['ogg_storage_dir'] = "$baseStoragePath/$oggRelDir";
- $options['ogg_storage_path'] = "$baseStoragePath/$oggRel";
- $options['ogg_url'] = "$baseUrl/$oggRel";
+ $options['audio_storage_dir'] = "$baseStoragePath/$oggRelDir";
+ $options['audio_storage_path'] = "$baseStoragePath/$oggRel";
+ $options['audio_url'] = "$baseUrl/$oggRel";
} else {
$options['override_midi'] = false;
}
@@ -242,21 +242,21 @@
// Raw rendering?
$options['raw'] = array_key_exists( 'raw', $args );
- /* Override OGG file? */
- if ( array_key_exists( 'override_ogg', $args ) ) {
- $t = Title::newFromText( $args['override_ogg'], NS_FILE );
+ /* Override audio file? */
+ if ( array_key_exists( 'override_audio', $args ) ) {
+ $t = Title::newFromText( $args['override_audio'], NS_FILE );
if ( is_null( $t ) ) {
- throw new ScoreException( wfMessage( 'score-invalidoggoverride',
- htmlspecialchars( $args['override_ogg'] ) ) );
+ throw new ScoreException( wfMessage( 'score-invalidaudiooverride',
+ htmlspecialchars( $args['override_audio'] ) ) );
}
if ( !$t->isKnown() ) {
- throw new ScoreException( wfMessage( 'score-oggoverridenotfound',
- htmlspecialchars( $args['override_ogg'] ) ) );
+ throw new ScoreException( wfMessage( 'score-audiooverridenotfound',
+ htmlspecialchars( $args['override_audio'] ) ) );
}
- $options['override_ogg'] = true;
- $options['ogg_name'] = $args['override_ogg'];
+ $options['override_audio'] = true;
+ $options['audio_name'] = $args['override_audio'];
} else {
- $options['override_ogg'] = false;
+ $options['override_audio'] = false;
}
/* Vorbis rendering? */
@@ -267,8 +267,8 @@
) {
throw new ScoreException( wfMessage( 'score-nomediahandler' ) );
}
- if ( $options['generate_ogg'] && ( $options['override_ogg'] !== false ) ) {
- throw new ScoreException( wfMessage( 'score-vorbisoverrideogg' ) );
+ if ( $options['generate_ogg'] && ( $options['override_audio'] !== false ) ) {
+ throw new ScoreException( wfMessage( 'score-vorbisoverrideaudio' ) );
}
// Input for cache key
@@ -313,7 +313,7 @@
* may be generated without stepping on someone else's
* toes. The directory may not exist yet. Required.
* - generate_ogg: bool Whether to create an Ogg/Vorbis file in
- * TimedMediaHandler. If set to true, the override_ogg option
+ * TimedMediaHandler. If set to true, the override_audio option
* must be set to false. Required.
* - dest_storage_path: The path of the destination directory relative to
* the current backend. Required.
@@ -324,17 +324,17 @@
* - override_midi: bool Whether to use a user-provided MIDI file.
* Required.
* - midi_file: If override_midi is true, MIDI file object.
- * - ogg_storage_dir: If override_midi and generate_ogg are true, the
- * backend directory in which the Ogg file is to be stored.
- * - ogg_storage_path: string If override_midi and generate_ogg are true,
- * the backend path at which the generated Ogg file is to be
+ * - audio_storage_dir: If override_midi and generate_audio are true, the
+ * backend directory in which the audio file is to be stored.
+ * - audio_storage_path: string If override_midi and generate_ogg are true,
+ * the backend path at which the generated audio file is to be
* stored.
- * - ogg_url: string If override_midi and generate_ogg is true,
- * the URL corresponding to ogg_storage_path
- * - override_ogg: bool Whether to generate a wikilink to a
- * user-provided OGG file. If set to true, the vorbis
+ * - audio_url: string If override_midi and generate_ogg is true,
+ * the URL corresponding to audio_storage_path
+ * - override_audio: bool Whether to generate a wikilink to a
+ * user-provided audio file. If set to true, the vorbis
* option must be set to false. Required.
- * - ogg_name: string If override_ogg is true, the Ogg file name
+ * - audio_name: string If override_audio is true, the audio file name
* - raw: bool Whether to assume raw LilyPond code. Ignored if the
* language is not lilypond, required otherwise.
*
@@ -385,11 +385,11 @@
/* Generate Ogg/Vorbis file if necessary */
if ( $options['generate_ogg'] ) {
if ( $options['override_midi'] ) {
- $oggUrl = $options['ogg_url'];
- $oggPath = $options['ogg_storage_path'];
- $exists = $backend->fileExists( [ 'src' => $options['ogg_storage_path'] ] );
+ $oggUrl = $options['audio_url'];
+ $oggPath = $options['audio_storage_path'];
+ $exists = $backend->fileExists( [ 'src' => $options['audio_storage_path'] ] );
if ( !$exists ) {
- $backend->prepare( [ 'dir' => $options['ogg_storage_dir'] ] );
+ $backend->prepare( [ 'dir' => $options['audio_storage_dir'] ] );
$sourcePath = $options['midi_file']->getLocalRefPath();
self::generateOgg( $sourcePath, $options, $oggPath, $metaData );
}
@@ -462,8 +462,8 @@
] );
$link .= $player->toHtml();
}
- if ( $options['override_ogg'] !== false ) {
- $link .= $parser->recursiveTagParse( "[[File:{$options['ogg_name']}]]" );
+ if ( $options['override_audio'] !== false ) {
+ $link .= $parser->recursiveTagParse( "[[File:{$options['audio_name']}]]" );
}
} catch ( Exception $e ) {
self::eraseFactory( $options['factory_directory'] );
--
To view, visit https://gerrit.wikimedia.org/r/401113
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iba98dd7281e3910f4dcde1d40b4361fc372f8c1f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Score
Gerrit-Branch: master
Gerrit-Owner: Divadsn <***@gmail.com>
Change subject: [WIP] Generalize wording of audio formats in Score.php
......................................................................
[WIP] Generalize wording of audio formats in Score.php
Bug: T183753
Change-Id: Iba98dd7281e3910f4dcde1d40b4361fc372f8c1f
---
M i18n/en.json
M i18n/qqq.json
M includes/Score.php
3 files changed, 37 insertions(+), 37 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Score refs/changes/13/401113/1
diff --git a/i18n/en.json b/i18n/en.json
index b42c585..326a26d 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -15,7 +15,7 @@
"score-error-category-desc": "There was an error while rendering the score.",
"score-getcwderr": "Unable to obtain current working directory",
"score-invalidlang": "Invalid score language lang=\"<nowiki>$1</nowiki>\". Currently recognized languages are lang=\"lilypond\" (the default) and lang=\"ABC\".",
- "score-invalidoggoverride": "The file \"<nowiki>$1</nowiki>\" you specified with override_ogg is invalid. Please specify the file name only, omit <nowiki>[[…]]</nowiki> and the \"{{ns:file}}:\" prefix.",
+ "score-invalidaudiooverride": "The file \"<nowiki>$1</nowiki>\" you specified with override_audio is invalid. Please specify the file name only, omit <nowiki>[[…]]</nowiki> and the \"{{ns:file}}:\" prefix.",
"score-midioverridenotfound": "The file \"<nowiki>$1</nowiki>\" you specified with override_midi could not be found. Please specify the file name only, omit <nowiki>[[…]]</nowiki> and the \"{{ns:file}}:\" prefix.",
"score-noabcinput": "ABC source file $1 could not be created.",
"score-noimages": "No score images were generated. Please check your score code.",
@@ -26,7 +26,7 @@
"score-notexecutable": "Could not execute LilyPond: $1 is not an executable file. Make sure <code>$wgScoreLilyPond</code> is set correctly.",
"score-nocontent": "Could not load file $1 from server.",
"score-oggconversionerr": "Unable to convert MIDI to Ogg/Vorbis:\n$1",
- "score-oggoverridenotfound": "The file \"<nowiki>$1</nowiki>\" you specified with override_ogg does not exist.",
+ "score-audiooverridenotfound": "The file \"<nowiki>$1</nowiki>\" you specified with override_audio does not exist.",
"score-page": "Page $1",
"score-pregreplaceerr": "PCRE regular expression replacement failed",
"score-readerr": "Unable to read file $1.",
@@ -49,5 +49,5 @@
"score-visualeditor-mwscoreinspector-raw": "This is a complete LilyPond file",
"score-visualeditor-mwscoreinspector-title": "Musical notation",
"score-visualeditor-mwscoreinspector-vorbis": "Include an audio file (auto-generated by default)",
- "score-vorbisoverrideogg": "You cannot request Ogg/Vorbis rendering and specify override_ogg at the same time."
+ "score-vorbisoverrideaudio": "You cannot request Ogg/Vorbis rendering and specify override_audio at the same time."
}
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 7fb2a39..4b647ec 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -21,7 +21,7 @@
"score-error-category-desc": "Description on [[Special:TrackingCategories]] for the {{msg-mw|score-error-category}} tracking category.",
"score-getcwderr": "Displayed if the extension cannot obtain the current working directory.",
"score-invalidlang": "Displayed if the lang=\"…\" attribute contains an unrecognized score language. $1 is the unrecognized language.",
- "score-invalidoggoverride": "Displayed if the file specified with the override_ogg=\"…\" attribute is invalid. $1 is the value of the override_ogg attribute.",
+ "score-invalidaudiooverride": "Displayed if the file specified with the override_audio=\"…\" attribute is invalid. $1 is the value of the override_audio attribute.",
"score-midioverridenotfound": "Displayed if the file specified with the override_midi=\"…\" attribute could not be found. $1 is the value of the override_midi attribute.",
"score-noabcinput": "Displayed if an ABC source file could not be created for lang=\"ABC\". $1 is the path to the file that could not be created.",
"score-noimages": "Displayed if no score images were rendered.",
@@ -32,7 +32,7 @@
"score-notexecutable": "Displayed if LilyPond binary cannot be executed. $1 is the path to the LilyPond binary.",
"score-nocontent": "Parameters:\n* $1 - filename",
"score-oggconversionerr": "Displayed if the MIDI to Ogg/Vorbis conversion failed. $1 is the error (generally big block of text in a pre tag)",
- "score-oggoverridenotfound": "Displayed if the file specified with the override_ogg=\"…\" attribute could not be found. $1 is the value of the override_ogg attribute.",
+ "score-audiooverridenotfound": "Displayed if the file specified with the override_audio=\"…\" attribute could not be found. $1 is the value of the override_ogg attribute.",
"score-page": "The word \"Page\" as used in pagination. Parameters:\n* $1 - the page number\n{{Identical|Page}}",
"score-pregreplaceerr": "Displayed if a PCRE regular expression replacement failed.",
"score-readerr": "Displayed if the extension could not read a file. $1 is the path to the file that could not be read.",
@@ -55,5 +55,5 @@
"score-visualeditor-mwscoreinspector-raw": "Label for the raw attribute of the score node",
"score-visualeditor-mwscoreinspector-title": "Title for the inspector to edit <nowiki><score></nowiki> blocks.",
"score-visualeditor-mwscoreinspector-vorbis": "Label for the vorbis attribute of the score node",
- "score-vorbisoverrideogg": "Displayed if both vorbis=\"1\" and override_ogg=\"…\" were specified."
+ "score-vorbisoverrideaudio": "Displayed if both vorbis=\"1\" and override_audio=\"…\" were specified."
}
diff --git a/includes/Score.php b/includes/Score.php
index de9d970..89a6765 100644
--- a/includes/Score.php
+++ b/includes/Score.php
@@ -232,9 +232,9 @@
$sha1 = $file->getSha1();
$oggRelDir = "override-midi/{$sha1[0]}/{$sha1[1]}";
$oggRel = "$oggRelDir/$sha1.ogg";
- $options['ogg_storage_dir'] = "$baseStoragePath/$oggRelDir";
- $options['ogg_storage_path'] = "$baseStoragePath/$oggRel";
- $options['ogg_url'] = "$baseUrl/$oggRel";
+ $options['audio_storage_dir'] = "$baseStoragePath/$oggRelDir";
+ $options['audio_storage_path'] = "$baseStoragePath/$oggRel";
+ $options['audio_url'] = "$baseUrl/$oggRel";
} else {
$options['override_midi'] = false;
}
@@ -242,21 +242,21 @@
// Raw rendering?
$options['raw'] = array_key_exists( 'raw', $args );
- /* Override OGG file? */
- if ( array_key_exists( 'override_ogg', $args ) ) {
- $t = Title::newFromText( $args['override_ogg'], NS_FILE );
+ /* Override audio file? */
+ if ( array_key_exists( 'override_audio', $args ) ) {
+ $t = Title::newFromText( $args['override_audio'], NS_FILE );
if ( is_null( $t ) ) {
- throw new ScoreException( wfMessage( 'score-invalidoggoverride',
- htmlspecialchars( $args['override_ogg'] ) ) );
+ throw new ScoreException( wfMessage( 'score-invalidaudiooverride',
+ htmlspecialchars( $args['override_audio'] ) ) );
}
if ( !$t->isKnown() ) {
- throw new ScoreException( wfMessage( 'score-oggoverridenotfound',
- htmlspecialchars( $args['override_ogg'] ) ) );
+ throw new ScoreException( wfMessage( 'score-audiooverridenotfound',
+ htmlspecialchars( $args['override_audio'] ) ) );
}
- $options['override_ogg'] = true;
- $options['ogg_name'] = $args['override_ogg'];
+ $options['override_audio'] = true;
+ $options['audio_name'] = $args['override_audio'];
} else {
- $options['override_ogg'] = false;
+ $options['override_audio'] = false;
}
/* Vorbis rendering? */
@@ -267,8 +267,8 @@
) {
throw new ScoreException( wfMessage( 'score-nomediahandler' ) );
}
- if ( $options['generate_ogg'] && ( $options['override_ogg'] !== false ) ) {
- throw new ScoreException( wfMessage( 'score-vorbisoverrideogg' ) );
+ if ( $options['generate_ogg'] && ( $options['override_audio'] !== false ) ) {
+ throw new ScoreException( wfMessage( 'score-vorbisoverrideaudio' ) );
}
// Input for cache key
@@ -313,7 +313,7 @@
* may be generated without stepping on someone else's
* toes. The directory may not exist yet. Required.
* - generate_ogg: bool Whether to create an Ogg/Vorbis file in
- * TimedMediaHandler. If set to true, the override_ogg option
+ * TimedMediaHandler. If set to true, the override_audio option
* must be set to false. Required.
* - dest_storage_path: The path of the destination directory relative to
* the current backend. Required.
@@ -324,17 +324,17 @@
* - override_midi: bool Whether to use a user-provided MIDI file.
* Required.
* - midi_file: If override_midi is true, MIDI file object.
- * - ogg_storage_dir: If override_midi and generate_ogg are true, the
- * backend directory in which the Ogg file is to be stored.
- * - ogg_storage_path: string If override_midi and generate_ogg are true,
- * the backend path at which the generated Ogg file is to be
+ * - audio_storage_dir: If override_midi and generate_audio are true, the
+ * backend directory in which the audio file is to be stored.
+ * - audio_storage_path: string If override_midi and generate_ogg are true,
+ * the backend path at which the generated audio file is to be
* stored.
- * - ogg_url: string If override_midi and generate_ogg is true,
- * the URL corresponding to ogg_storage_path
- * - override_ogg: bool Whether to generate a wikilink to a
- * user-provided OGG file. If set to true, the vorbis
+ * - audio_url: string If override_midi and generate_ogg is true,
+ * the URL corresponding to audio_storage_path
+ * - override_audio: bool Whether to generate a wikilink to a
+ * user-provided audio file. If set to true, the vorbis
* option must be set to false. Required.
- * - ogg_name: string If override_ogg is true, the Ogg file name
+ * - audio_name: string If override_audio is true, the audio file name
* - raw: bool Whether to assume raw LilyPond code. Ignored if the
* language is not lilypond, required otherwise.
*
@@ -385,11 +385,11 @@
/* Generate Ogg/Vorbis file if necessary */
if ( $options['generate_ogg'] ) {
if ( $options['override_midi'] ) {
- $oggUrl = $options['ogg_url'];
- $oggPath = $options['ogg_storage_path'];
- $exists = $backend->fileExists( [ 'src' => $options['ogg_storage_path'] ] );
+ $oggUrl = $options['audio_url'];
+ $oggPath = $options['audio_storage_path'];
+ $exists = $backend->fileExists( [ 'src' => $options['audio_storage_path'] ] );
if ( !$exists ) {
- $backend->prepare( [ 'dir' => $options['ogg_storage_dir'] ] );
+ $backend->prepare( [ 'dir' => $options['audio_storage_dir'] ] );
$sourcePath = $options['midi_file']->getLocalRefPath();
self::generateOgg( $sourcePath, $options, $oggPath, $metaData );
}
@@ -462,8 +462,8 @@
] );
$link .= $player->toHtml();
}
- if ( $options['override_ogg'] !== false ) {
- $link .= $parser->recursiveTagParse( "[[File:{$options['ogg_name']}]]" );
+ if ( $options['override_audio'] !== false ) {
+ $link .= $parser->recursiveTagParse( "[[File:{$options['audio_name']}]]" );
}
} catch ( Exception $e ) {
self::eraseFactory( $options['factory_directory'] );
--
To view, visit https://gerrit.wikimedia.org/r/401113
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iba98dd7281e3910f4dcde1d40b4361fc372f8c1f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Score
Gerrit-Branch: master
Gerrit-Owner: Divadsn <***@gmail.com>