From 0be9c9ee4ae4c2e031e3e5670168d842a8f27cfb Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Wed, 17 Oct 2018 14:35:53 -0400 Subject: [PATCH] 2018-10-17 Fred Gleason * Added an 'ExportedFileMode=' parameter to the '[Tuning]' section of rd.conf(5). --- ChangeLog | 3 +++ conf/rd.conf-sample | 4 ++++ lib/rd.h | 5 +++++ lib/rdaudioexport.cpp | 3 ++- lib/rdaudioexport.h | 2 +- lib/rdconfig.cpp | 12 +++++++++++- lib/rdconfig.h | 6 +++++- rdcatchd/batch.cpp | 4 ++++ 8 files changed, 35 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 690b03a0..1ceb7c9b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16711,3 +16711,6 @@ * Updated the copyright of the Operations Guide. * Documented GPIO support for AudioScience cards in the 'Local Audio Adapter' section of the Operations Guide. +2018-10-17 Fred Gleason + * Added an 'ExportedFileMode=' parameter to the '[Tuning]' section + of rd.conf(5). diff --git a/conf/rd.conf-sample b/conf/rd.conf-sample index cc133119..b930ed4e 100644 --- a/conf/rd.conf-sample +++ b/conf/rd.conf-sample @@ -130,6 +130,10 @@ ChannelsPerPcm=-1 UseRealtime=Yes RealtimePriority=9 +; The mode to be set on a file when exported to a local +; filesystem (octal). +ExportedFileMode=0664 + ; Introduce a delay of this many microseconds in each loop iteration ; when transcoding files. TranscodingDelay=0 diff --git a/lib/rd.h b/lib/rd.h index 5adf8c1d..6d749952 100644 --- a/lib/rd.h +++ b/lib/rd.h @@ -85,6 +85,11 @@ #define RD_ALSA_FADE_INTERVAL 100 #define RD_ALSA_SAMPLE_RATE_TOLERANCE 100 +/* + * Tuning Settings + */ +#define RD_TUNING_DEFAULT_EXPORTED_FILE_MODE 0664 + /* * Date Limits */ diff --git a/lib/rdaudioexport.cpp b/lib/rdaudioexport.cpp index c9283627..998b6f70 100644 --- a/lib/rdaudioexport.cpp +++ b/lib/rdaudioexport.cpp @@ -2,7 +2,7 @@ // // Export an Audio File using the RdXport Web Service // -// (C) Copyright 2010,2016-2017 Fred Gleason +// (C) Copyright 2010-2018 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -217,6 +217,7 @@ RDAudioExport::ErrorCode RDAudioExport::runExport(const QString &username, if(response_code==200) { *conv_err=RDAudioConvert::ErrorOk; + chmod(conv_dst_filename,conv_config->tuningExportedFileMode()); return RDAudioExport::ErrorOk; } diff --git a/lib/rdaudioexport.h b/lib/rdaudioexport.h index 4948a0b0..6dc11b62 100644 --- a/lib/rdaudioexport.h +++ b/lib/rdaudioexport.h @@ -2,7 +2,7 @@ // // Export an Audio File using the RdXport Web Service // -// (C) Copyright 2010,2016 Fred Gleason +// (C) Copyright 2010-2018 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as diff --git a/lib/rdconfig.cpp b/lib/rdconfig.cpp index 10448807..9aa2ec5b 100644 --- a/lib/rdconfig.cpp +++ b/lib/rdconfig.cpp @@ -20,7 +20,6 @@ #ifndef WIN32 #include -#include #include #include #include @@ -473,6 +472,12 @@ int RDConfig::transcodingDelay() const return conf_transcoding_delay; } + +mode_t RDConfig::tuningExportedFileMode() const +{ + return conf_tuning_exported_file_mode; +} + // Don't use this method in application code, use RDTempDirectory() QString RDConfig::tempDirectory() { @@ -640,6 +645,10 @@ void RDConfig::load() conf_use_realtime=profile->boolValue("Tuning","UseRealtime",false); conf_realtime_priority=profile->intValue("Tuning","RealtimePriority",9); conf_transcoding_delay=profile->intValue("Tuning","TranscodingDelay"); + conf_tuning_exported_file_mode=profile-> + stringValue("Tuning","ExportedFileMode", + QString().sprintf("%o",RD_TUNING_DEFAULT_EXPORTED_FILE_MODE)). + toInt(NULL,8); conf_temp_directory=profile->stringValue("Tuning","TempDirectory",""); conf_sas_station=profile->stringValue("SASFilter","Station",""); conf_sas_matrix=profile->intValue("SASFilter","Matrix",0); @@ -750,6 +759,7 @@ void RDConfig::clear() conf_enable_mixer_logging=false; conf_use_realtime=false; conf_realtime_priority=9; + conf_tuning_exported_file_mode=RD_TUNING_DEFAULT_EXPORTED_FILE_MODE; conf_transcoding_delay=0; conf_temp_directory=""; conf_sas_station=""; diff --git a/lib/rdconfig.h b/lib/rdconfig.h index fdda95b2..1b787f36 100644 --- a/lib/rdconfig.h +++ b/lib/rdconfig.h @@ -2,7 +2,7 @@ // // A container class for a Rivendell Base Configuration // -// (C) Copyright 2002-2004,2016-2017 Fred Gleason +// (C) Copyright 2002-2018 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -26,6 +26,8 @@ #include #endif // WIN32 +#include + #include #include @@ -111,6 +113,7 @@ class RDConfig bool useRealtime(); int realtimePriority(); int transcodingDelay() const; + mode_t tuningExportedFileMode() const; QString tempDirectory(); QString sasStation() const; int sasMatrix() const; @@ -178,6 +181,7 @@ class RDConfig QString conf_cae_logfile; bool conf_enable_mixer_logging; bool conf_use_realtime; + mode_t conf_tuning_exported_file_mode; int conf_transcoding_delay; int conf_realtime_priority; QString conf_temp_directory; diff --git a/rdcatchd/batch.cpp b/rdcatchd/batch.cpp index aca8b6b3..92722e8d 100644 --- a/rdcatchd/batch.cpp +++ b/rdcatchd/batch.cpp @@ -336,6 +336,10 @@ void MainObject::RunUpload(CatchEvent *evt) catch_config->logXloadDebugData()))) { case RDUpload::ErrorOk: catch_connect->setExitCode(evt->id(),RDRecording::Ok,tr("Ok")); + if(QUrl(evt->resolvedUrl()).protocol().lower()=="file") { + chmod(QUrl(evt->resolvedUrl()).path(), + catch_config->tuningExportedFileMode()); + } qApp->processEvents(); LogLine(RDConfig::LogInfo,QString(). sprintf("finished upload of %s to %s, id=%d",