diff --git a/ChangeLog b/ChangeLog index 01710611..84ce1f56 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15849,3 +15849,5 @@ 'rdadmin/edit_settings.h'. * Modified the 'EditCart' web call to enforce the 'Auto-Correct Duplicate Cart Titles' setting. +2017-06-19 Fred Gleason + * Added a 'TITLE' field to the 'Import' web call. diff --git a/docs/docbook/web_api.xml b/docs/docbook/web_api.xml index 74832cad..27b325e7 100644 --- a/docs/docbook/web_api.xml +++ b/docs/docbook/web_api.xml @@ -1729,7 +1729,9 @@ A 404 error will be returned if the requested cart is not authorized for the specified Rivendell user in - RDAdmin->ManageUsers->AssignGroupPerms. + RDAdmin->ManageUsers->AssignGroupPerms or if the system is configured + to require unique titles and a non-unique title is provided in the + TITLE field. NOTE: The method must be called with 'multipart/form-data' encoding. @@ -1861,6 +1863,18 @@ Optional + + + TITLE + + + The TITLE value for the imported audio. This will override any + value found in in-file metadata. + + + Optional + + FILENAME diff --git a/web/rdxport/import.cpp b/web/rdxport/import.cpp index 4a1d06f3..d559fe2d 100644 --- a/web/rdxport/import.cpp +++ b/web/rdxport/import.cpp @@ -74,6 +74,8 @@ void Xport::Import() } QString group_name; xport_post->getValue("GROUP_NAME",&group_name); + QString title; + xport_post->getValue("TITLE",&title); QString filename; if(!xport_post->getValue("FILENAME",&filename)) { XmlExit("Missing FILENAME",400,"import.cpp",LINE_NUMBER); @@ -107,6 +109,17 @@ void Xport::Import() XmlExit("Forbidden",404,"import.cpp",LINE_NUMBER); } + // + // Verify Title Uniqueness + // + if(!title.isEmpty()) { + if((!xport_system->allowDuplicateCartTitles())&& + (!xport_system->fixDuplicateCartTitles())&& + (!RDCart::titleIsUnique(title))) { + XmlExit("Duplicate Cart Title Not Allowed",404,"import.cpp",LINE_NUMBER); + } + } + // // Load Configuration // @@ -225,6 +238,9 @@ void Xport::Import() } if(resp_code==200) { cut->setSha1Hash(RDSha1Hash(RDCut::pathName(cut->cutName()))); + if(!title.isEmpty()) { + cart->setTitle(title); + } printf("Content-type: application/xml\n"); printf("Status: %d\n",resp_code); printf("\n"); diff --git a/web/tests/import.html b/web/tests/import.html index 85016298..8288d5fa 100644 --- a/web/tests/import.html +++ b/web/tests/import.html @@ -50,6 +50,11 @@ + +TITLE: + + + FILE: