diff options
| author | Carl Hetherington <cth@carlh.net> | 2018-10-26 00:09:34 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2018-10-26 00:09:34 +0100 |
| commit | fad8d13cd779a6237feed2c855a46e1a7c66e0ad (patch) | |
| tree | 22026d4075520a1ad151f0094b90a6b40bcc25b6 /src/lib | |
| parent | 12e5451c5102c9a3d5b51930503437e0cbf53267 (diff) | |
Use Film/Playlist for SPL management rather than special classes.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/film.cc | 7 | ||||
| -rw-r--r-- | src/lib/film.h | 1 | ||||
| -rw-r--r-- | src/lib/spl.cc | 62 | ||||
| -rw-r--r-- | src/lib/spl.h | 40 | ||||
| -rw-r--r-- | src/lib/spl_entry.h | 44 | ||||
| -rw-r--r-- | src/lib/wscript | 1 |
6 files changed, 8 insertions, 147 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc index bd5724828..807aeaf2f 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -403,6 +403,13 @@ Film::metadata (bool with_content_paths) const return doc; } +void +Film::write_metadata (boost::filesystem::path path) const +{ + shared_ptr<xmlpp::Document> doc = metadata (); + doc->write_to_file_formatted (path.string()); +} + /** Write state to our `metadata' file */ void Film::write_metadata () const diff --git a/src/lib/film.h b/src/lib/film.h index 44e84dc27..273077f8f 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -94,6 +94,7 @@ public: void use_template (std::string name); std::list<std::string> read_metadata (boost::optional<boost::filesystem::path> path = boost::optional<boost::filesystem::path> ()); void write_metadata () const; + void write_metadata (boost::filesystem::path path) const; void write_template (boost::filesystem::path path) const; boost::shared_ptr<xmlpp::Document> metadata (bool with_content_paths = true) const; diff --git a/src/lib/spl.cc b/src/lib/spl.cc deleted file mode 100644 index d7c0944d7..000000000 --- a/src/lib/spl.cc +++ /dev/null @@ -1,62 +0,0 @@ -/* - Copyright (C) 2018 Carl Hetherington <cth@carlh.net> - - This file is part of DCP-o-matic. - - DCP-o-matic is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - DCP-o-matic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>. - -*/ - -#include "spl.h" -#include "spl_entry.h" -#include <dcp/cpl.h> -#include <dcp/dcp.h> -#include <libxml++/libxml++.h> -#include <boost/foreach.hpp> - -using boost::shared_ptr; - -SPL::SPL (boost::filesystem::path file) -{ - cxml::Document f ("DCPPlaylist"); - f.read_file (file); - - name = f.string_attribute ("Name"); - BOOST_FOREACH (cxml::ConstNodePtr i, f.node_children("DCP")) { - boost::filesystem::path dir(i->content()); - dcp::DCP dcp (dir); - dcp.read (); - BOOST_FOREACH (shared_ptr<dcp::CPL> j, dcp.cpls()) { - if (j->id() == i->string_attribute("CPL")) { - playlist.push_back (SPLEntry(j, dir)); - } - } - } -} - -void -SPL::as_xml (boost::filesystem::path file) const -{ - xmlpp::Document doc; - xmlpp::Element* root = doc.create_root_node ("DCPPlaylist"); - root->set_attribute ("Name", name); - - BOOST_FOREACH (SPLEntry i, playlist) { - xmlpp::Element* d = root->add_child ("DCP"); - d->set_attribute ("CPL", i.cpl->id()); - d->add_child_text (i.directory.string()); - } - - doc.write_to_file_formatted(file.string()); -} diff --git a/src/lib/spl.h b/src/lib/spl.h deleted file mode 100644 index 25e8ac4c5..000000000 --- a/src/lib/spl.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright (C) 2018 Carl Hetherington <cth@carlh.net> - - This file is part of DCP-o-matic. - - DCP-o-matic is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - DCP-o-matic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>. - -*/ - -#ifndef DCPOMATIC_SPL_H -#define DCPOMATIC_SPL_H - -#include "spl_entry.h" -#include <boost/filesystem.hpp> - - -class SPL -{ -public: - SPL () {} - SPL (boost::filesystem::path file); - - void as_xml (boost::filesystem::path file) const; - - std::string name; - std::list<SPLEntry> playlist; -}; - -#endif diff --git a/src/lib/spl_entry.h b/src/lib/spl_entry.h deleted file mode 100644 index e79d89afc..000000000 --- a/src/lib/spl_entry.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - Copyright (C) 2018 Carl Hetherington <cth@carlh.net> - - This file is part of DCP-o-matic. - - DCP-o-matic is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - DCP-o-matic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>. - -*/ - -#ifndef DCPOMATIC_SPL_ENTRY_H -#define DCPOMATIC_SPL_ENTRY_H - -#include "dcpomatic_time.h" - -namespace dcp { - class CPL; -} - -class SPLEntry -{ -public: - SPLEntry (boost::shared_ptr<dcp::CPL> cpl_, boost::filesystem::path directory_) - : cpl (cpl_) - , directory (directory_) - {} - - /* Length of black before this DCP */ - DCPTime black_before; - boost::shared_ptr<dcp::CPL> cpl; - boost::filesystem::path directory; -}; - -#endif diff --git a/src/lib/wscript b/src/lib/wscript index bbe51a8fd..e78227b6b 100644 --- a/src/lib/wscript +++ b/src/lib/wscript @@ -138,7 +138,6 @@ sources = """ send_problem_report_job.cc server.cc shuffler.cc - spl.cc string_log_entry.cc string_text_file.cc string_text_file_content.cc |
