Missed update to private test repo version.
[dcpomatic.git] / src / lib / kdm_with_metadata.h
1 /*
2     Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
3
4     This file is part of DCP-o-matic.
5
6     DCP-o-matic is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     DCP-o-matic is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
18
19 */
20
21
22 #ifndef DCPOMATIC_KDM_WITH_METADATA_H
23 #define DCPOMATIC_KDM_WITH_METADATA_H
24
25
26 #include <dcp/encrypted_kdm.h>
27 #include <dcp/name_format.h>
28
29
30 class Cinema;
31
32
33 class KDMWithMetadata
34 {
35 public:
36         KDMWithMetadata(dcp::NameFormat::Map const& name_values, void const* group, std::vector<std::string> emails, dcp::EncryptedKDM kdm)
37                 : _name_values (name_values)
38                 , _group (group)
39                 , _emails (emails)
40                 , _kdm (kdm)
41         {}
42
43         std::string kdm_as_xml () const {
44                 return _kdm.as_xml ();
45         }
46
47         void kdm_as_xml (boost::filesystem::path out) const {
48                 return _kdm.as_xml (out);
49         }
50
51         dcp::NameFormat::Map const& name_values () const {
52                 return _name_values;
53         }
54
55         boost::optional<std::string> get (char k) const;
56
57         void const* group () const {
58                 return _group;
59         }
60
61         std::vector<std::string> emails() const {
62                 return _emails;
63         }
64
65 private:
66         dcp::NameFormat::Map _name_values;
67         void const* _group;
68         std::vector<std::string> _emails;
69         dcp::EncryptedKDM _kdm;
70 };
71
72
73 typedef std::shared_ptr<KDMWithMetadata> KDMWithMetadataPtr;
74
75
76 int write_files (
77         std::list<KDMWithMetadataPtr> screen_kdms, boost::filesystem::path directory,
78         dcp::NameFormat name_format, std::function<bool (boost::filesystem::path)> confirm_overwrite
79         );
80
81
82 void make_zip_file (std::list<KDMWithMetadataPtr> kdms, boost::filesystem::path zip_file, dcp::NameFormat name_format);
83
84
85 std::list<std::list<KDMWithMetadataPtr>> collect (std::list<KDMWithMetadataPtr> kdms);
86
87
88 int write_directories (
89                 std::list<std::list<KDMWithMetadataPtr>> kdms,
90                 boost::filesystem::path directory,
91                 dcp::NameFormat container_name_format,
92                 dcp::NameFormat filename_format,
93                 std::function<bool (boost::filesystem::path)> confirm_overwrite
94                 );
95
96
97 int write_zip_files (
98                 std::list<std::list<KDMWithMetadataPtr>> kdms,
99                 boost::filesystem::path directory,
100                 dcp::NameFormat container_name_format,
101                 dcp::NameFormat filename_format,
102                 std::function<bool (boost::filesystem::path)> confirm_overwrite
103                 );
104
105
106 void send_emails (
107                 std::list<std::list<KDMWithMetadataPtr>> kdms,
108                 dcp::NameFormat container_name_format,
109                 dcp::NameFormat filename_format,
110                 std::string cpl_name,
111                 std::vector<std::string> extra_addresses
112                 );
113
114 #endif
115