diff --git a/lib/modules/auphonic/admin.js b/lib/modules/auphonic/admin.js
index eec61aee1..f0674638e 100644
--- a/lib/modules/auphonic/admin.js
+++ b/lib/modules/auphonic/admin.js
@@ -149,10 +149,14 @@ var PODLOVE = PODLOVE || {};
/**
* Extract Auphonic relevant data from WordPress web form.
+ *
+ * @param {string} mode "init" or "update". Default: "init". Update ignores presets and output files.
*
* @return json In the correct format for the Auphonic API.
*/
- function extract_auphonic_data_from_form() {
+ function extract_auphonic_data_from_form(mode) {
+ mode = typeof mode !== 'undefined' ? mode : 'init';
+
var presetuuid = $("#auphonic").data('presetuuid'),
chapter_asset_assignment = $("#auphonic").data('assignment-chapter'),
cover_art_asset_assignment = $("#auphonic").data('assignment-image'),
@@ -163,15 +167,17 @@ var PODLOVE = PODLOVE || {};
data.metadata = {};
- if(typeof presetuuid !== undefined && presetuuid !== "") {
- data.preset = presetuuid;
- } else {
- // no preset? add some output files
- data.output_files = [
- {"format":"aac", "bitrate":"128", "ending":"m4a"},
- {"format":"mp3", "bitrate":"128", "ending":"mp3"},
- {"format":"opus", "bitrate":"96", "ending":"opus"}
- ]
+ if (mode === "init") {
+ if(typeof presetuuid !== undefined && presetuuid !== "") {
+ data.preset = presetuuid;
+ } else {
+ // no preset? add some output files
+ data.output_files = [
+ {"format":"aac", "bitrate":"128", "ending":"m4a"},
+ {"format":"mp3", "bitrate":"128", "ending":"mp3"},
+ {"format":"opus", "bitrate":"96", "ending":"opus"}
+ ]
+ }
}
var service = $("#auphonic_services").val(),
@@ -188,7 +194,7 @@ var PODLOVE = PODLOVE || {};
}
data.length_timestring = $("#_podlove_meta_duration").val();
- data.output_basename= $("#_podlove_meta_slug").val();
+ data.output_basename = $("#_podlove_meta_slug").val();
data.metadata.title = $("#title").val();
data.metadata.subtitle = $("#_podlove_meta_subtitle").val();
data.metadata.summary = $("#_podlove_meta_summary").val();
@@ -220,7 +226,7 @@ var PODLOVE = PODLOVE || {};
function update_auphonic_production(production_uuid, callback) {
var url = 'https://auphonic.com/api/production/{uuid}.json'
- data = extract_auphonic_data_from_form();
+ data = extract_auphonic_data_from_form("update");
var xhr = PODLOVE.Auphonic.createCORSRequest("POST", url.replace("{uuid}", production_uuid));
xhr.setRequestHeader("Content-type","application/json");
diff --git a/lib/modules/auphonic/auphonic.php b/lib/modules/auphonic/auphonic.php
index c6bc3c32d..0bb001a43 100644
--- a/lib/modules/auphonic/auphonic.php
+++ b/lib/modules/auphonic/auphonic.php
@@ -228,9 +228,10 @@ public function auphonic_episodes_form() {
+ Open Production
-