Partial attempt at cleanup of naming straight vs DCI.
authorCarl Hetherington <cth@carlh.net>
Tue, 16 Oct 2012 01:46:46 +0000 (02:46 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 16 Oct 2012 01:46:46 +0000 (02:46 +0100)
src/lib/film.cc
src/lib/film.h
src/lib/film_state.cc
src/lib/film_state.h
src/lib/make_dcp_job.cc
src/lib/scp_dcp_job.cc
src/wx/dci_name_dialog.cc
src/wx/dci_name_dialog.h

index 541d96f1e66d38c1a5a38e203299df6116643de2..ce83b132433fb87bcee662d55c0e0ee82b5abc10 100644 (file)
@@ -467,8 +467,7 @@ Film::signal_changed (Property p)
 void
 Film::make_dcp (bool transcode, int freq)
 {
-       string const t = name ();
-       if (t.find ("/") != string::npos) {
+       if (dcp_name().find ("/") != string::npos) {
                throw BadSettingError ("name", "cannot contain slashes");
        }
        
@@ -691,13 +690,6 @@ Film::thumb_subtitle (int n) const
        return sub;
 }
 
-void
-Film::set_dci_name_prefix (string v)
-{
-       _state.dci_name_prefix = v;
-       signal_changed (DCI_METADATA);
-}
-
 void
 Film::set_audio_language (string v)
 {
index 9eb39fd64704549f18ca948264e249f3b85af55e..a1cf26bc61896f8ac15620cf11c6a5ac06ab10a1 100644 (file)
@@ -71,6 +71,11 @@ public:
                return _state.name;
        }
 
+       /** @return name to give the DCP */
+       std::string dcp_name () const {
+               return _state.dcp_name ();
+       }
+
        bool use_dci_name () const {
                return _state.use_dci_name;
        }
@@ -164,7 +169,6 @@ public:
        void set_with_subtitles (bool);
        void set_subtitle_offset (int);
        void set_subtitle_scale (float);
-       void set_dci_name_prefix (std::string);
        void set_audio_language (std::string);
        void set_subtitle_language (std::string);
        void set_territory (std::string);
@@ -207,10 +211,6 @@ public:
                return _state.has_subtitles;
        }
 
-       std::string dci_name_prefix () const {
-               return _state.dci_name_prefix;
-       }
-
        std::string audio_language () const {
                return _state.audio_language;
        }
index 862d69d7da6d38141d36415c6c25f27305e0ec7d..e39e14da83fd49db09d816b73d9f6eac1aaea849 100644 (file)
@@ -100,7 +100,6 @@ FilmState::write_metadata (ofstream& f) const
        f << "audio_sample_format " << audio_sample_format_to_string (audio_sample_format) << "\n";
        f << "content_digest " << content_digest << "\n";
        f << "has_subtitles " << has_subtitles << "\n";
-       f << "dci_name_prefix " << dci_name_prefix << "\n";
        f << "audio_language " << audio_language << "\n";
        f << "subtitle_language " << subtitle_language << "\n";
        f << "territory " << territory << "\n";
@@ -189,8 +188,6 @@ FilmState::read_metadata (string k, string v)
                content_digest = v;
        } else if (k == "has_subtitles") {
                has_subtitles = (v == "1");
-       } else if (k == "dci_name_prefix") {
-               dci_name_prefix = v;
        } else if (k == "audio_language") {
                audio_language = v;
        } else if (k == "subtitle_language") {
@@ -362,7 +359,8 @@ string
 FilmState::dci_name () const
 {
        stringstream d;
-       d << dci_name_prefix << "_";
+
+       d << name << "_";
 
        if (dcp_content_type) {
                d << dcp_content_type->dci_name() << "_";
@@ -419,3 +417,16 @@ FilmState::dci_name () const
 
        return d.str ();
 }
+
+/** @return name to give the DCP */
+string
+FilmState::dcp_name () const
+{
+       if (use_dci_name) {
+               return dci_name ();
+       }
+
+       return name;
+}
+
+              
index 83ae2c594c622e8b34cbf8c86cf912fff8c9bd54..01bcdfd5c09849071c31e5f1928b5f32835e84b4 100644 (file)
@@ -95,6 +95,8 @@ public:
        int dcp_length () const;
        std::string dci_name () const;
 
+       std::string dcp_name () const;
+
        /** Complete path to directory containing the film metadata;
            must not be relative.
        */
@@ -141,7 +143,6 @@ public:
        float subtitle_scale;
 
        /* DCI naming stuff */
-       std::string dci_name_prefix;
        std::string audio_language;
        std::string subtitle_language;
        std::string territory;
index b42a38429ff2800c1e15a13509be08bd0743e2f4..efd35ba444389f3d175c79ca2f72b7f0e43bece3 100644 (file)
@@ -70,7 +70,7 @@ MakeDCPJob::wav_path (libdcp::Channel c) const
 void
 MakeDCPJob::run ()
 {
-       string const dcp_path = _fs->dir (_fs->name);
+       string const dcp_path = _fs->dir (_fs->dcp_name());
 
        /* Remove any old DCP */
        filesystem::remove_all (dcp_path);
@@ -85,17 +85,17 @@ MakeDCPJob::run ()
                break;
        }
        
-       libdcp::DCP dcp (_fs->dir (_fs->name));
+       libdcp::DCP dcp (_fs->dir (_fs->dcp_name()));
        dcp.Progress.connect (sigc::mem_fun (*this, &MakeDCPJob::dcp_progress));
 
-       shared_ptr<libdcp::CPL> cpl (new libdcp::CPL (_fs->dir (_fs->name), _fs->name, _fs->dcp_content_type->libdcp_kind (), frames, rint (_fs->frames_per_second)));
+       shared_ptr<libdcp::CPL> cpl (new libdcp::CPL (_fs->dir (_fs->dcp_name()), _fs->dcp_name(), _fs->dcp_content_type->libdcp_kind (), frames, rint (_fs->frames_per_second)));
        dcp.add_cpl (cpl);
 
        descend (0.9);
        shared_ptr<libdcp::MonoPictureAsset> pa (
                new libdcp::MonoPictureAsset (
                        sigc::mem_fun (*this, &MakeDCPJob::j2c_path),
-                       _fs->dir (_fs->name),
+                       _fs->dir (_fs->dcp_name()),
                        "video.mxf",
                        &dcp.Progress,
                        rint (_fs->frames_per_second),
@@ -114,7 +114,7 @@ MakeDCPJob::run ()
                sa.reset (
                        new libdcp::SoundAsset (
                                sigc::mem_fun (*this, &MakeDCPJob::wav_path),
-                               _fs->dir (_fs->name),
+                               _fs->dir (_fs->dcp_name()),
                                "audio.mxf",
                                &dcp.Progress,
                                rint (_fs->frames_per_second),
index 90122cea7e0aa09db03c0103264b5e160b0ff42c..300a8fe33c0dbec65140ea53f1b3160a30656873 100644 (file)
@@ -140,12 +140,12 @@ SCPDCPJob::run ()
                throw NetworkError (String::compose ("Could not start SCP session (%1)", ssh_get_error (ss.session)));
        }
        
-       r = ssh_scp_push_directory (sc.scp, _fs->name.c_str(), S_IRWXU);
+       r = ssh_scp_push_directory (sc.scp, _fs->dcp_name().c_str(), S_IRWXU);
        if (r != SSH_OK) {
-               throw NetworkError (String::compose ("Could not create remote directory %1 (%2)", _fs->name, ssh_get_error (ss.session)));
+               throw NetworkError (String::compose ("Could not create remote directory %1 (%2)", _fs->dcp_name(), ssh_get_error (ss.session)));
        }
        
-       string const dcp_dir = _fs->dir (_fs->name);
+       string const dcp_dir = _fs->dir (_fs->dcp_name());
        
        boost::uintmax_t bytes_to_transfer = 0;
        for (filesystem::directory_iterator i = filesystem::directory_iterator (dcp_dir); i != filesystem::directory_iterator(); ++i) {
index 9feb4aa866f7c6500ee4a86fa8d1dac8babb871f..88cc7efa494b69215cfef6e55f34af814c681370 100644 (file)
@@ -29,10 +29,6 @@ DCINameDialog::DCINameDialog (wxWindow* parent, Film* film)
        wxFlexGridSizer* table = new wxFlexGridSizer (2, 6, 6);
        table->AddGrowableCol (1, 1);
 
-       add_label_to_sizer (table, this, "Short Name (e.g. BLUES-BROS)");
-       _dci_name_prefix = new wxTextCtrl (this, wxID_ANY);
-       table->Add (_dci_name_prefix, 1, wxEXPAND);
-
        add_label_to_sizer (table, this, "Audio Language (e.g. EN)");
        _audio_language = new wxTextCtrl (this, wxID_ANY);
        table->Add (_audio_language, 1, wxEXPAND);
@@ -61,7 +57,6 @@ DCINameDialog::DCINameDialog (wxWindow* parent, Film* film)
        _package_type = new wxTextCtrl (this, wxID_ANY);
        table->Add (_package_type, 1, wxEXPAND);
 
-       _dci_name_prefix->SetValue (std_to_wx (_film->dci_name_prefix ()));
        _audio_language->SetValue (std_to_wx (_film->audio_language ()));
        _subtitle_language->SetValue (std_to_wx (_film->subtitle_language ()));
        _territory->SetValue (std_to_wx (_film->territory ()));
@@ -70,7 +65,6 @@ DCINameDialog::DCINameDialog (wxWindow* parent, Film* film)
        _facility->SetValue (std_to_wx (_film->facility ()));
        _package_type->SetValue (std_to_wx (_film->package_type ()));
        
-       _dci_name_prefix->Connect (wxID_ANY, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (DCINameDialog::dci_name_prefix_changed), 0, this);
        _audio_language->Connect (wxID_ANY, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (DCINameDialog::audio_language_changed), 0, this);
        _subtitle_language->Connect (wxID_ANY, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (DCINameDialog::subtitle_language_changed), 0, this);
        _territory->Connect (wxID_ANY, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (DCINameDialog::territory_changed), 0, this);
@@ -92,12 +86,6 @@ DCINameDialog::DCINameDialog (wxWindow* parent, Film* film)
        overall_sizer->SetSizeHints (this);
 }
 
-void
-DCINameDialog::dci_name_prefix_changed (wxCommandEvent &)
-{
-       _film->set_dci_name_prefix (wx_to_std (_dci_name_prefix->GetValue ()));
-}
-
 void
 DCINameDialog::audio_language_changed (wxCommandEvent &)
 {
index 95578f779883137b6f018a686b6e4bd2c756562d..d06420a6e03a1f73974e9939c8f631a06da18c0f 100644 (file)
@@ -28,7 +28,6 @@ public:
        DCINameDialog (wxWindow *, Film *);
 
 private:
-       void dci_name_prefix_changed (wxCommandEvent &);
        void audio_language_changed (wxCommandEvent &);
        void subtitle_language_changed (wxCommandEvent &);
        void territory_changed (wxCommandEvent &);
@@ -37,7 +36,6 @@ private:
        void facility_changed (wxCommandEvent &);
        void package_type_changed (wxCommandEvent &);
        
-       wxTextCtrl* _dci_name_prefix;
        wxTextCtrl* _audio_language;
        wxTextCtrl* _subtitle_language;
        wxTextCtrl* _territory;