diff options
| author | Carl Hetherington <cth@carlh.net> | 2026-01-04 21:02:23 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2026-01-04 21:02:23 +0100 |
| commit | 20bf5c5ce90123c76105e4f62039a5c9899287c0 (patch) | |
| tree | 80601c954f919bb11b1cb83b30af00447e08e4af /src/lib | |
| parent | 0242ba75b62ba245bb1b61086d118520f7477934 (diff) | |
Hacks: qube is awkward as it needs this _type2706-redownload-certificates
The whole thing is a bit of a nightmare and there's no tests.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/download_certificate.cc | 42 | ||||
| -rw-r--r-- | src/lib/download_certificate.h | 1 | ||||
| -rw-r--r-- | src/lib/exceptions.cc | 2 |
3 files changed, 39 insertions, 6 deletions
diff --git a/src/lib/download_certificate.cc b/src/lib/download_certificate.cc index c72f83476..19a5675cd 100644 --- a/src/lib/download_certificate.cc +++ b/src/lib/download_certificate.cc @@ -52,7 +52,7 @@ download_gdc_certificate(string const& serial) try { return { dcp::Certificate(get_from_url(url, true, false).as_string()), url }; } catch (dcp::MiscError& e) { - throw CertificateDownloadError(fmt::format(_("Could not read certificate file ({})"), e.what())); + throw CertificateReadError(e.what()); } } @@ -73,7 +73,7 @@ download_barco_certificate(string const& serial) try { return { dcp::Certificate(get_from_url(url, true, false).as_string()), url }; } catch (dcp::MiscError& e) { - throw CertificateDownloadError(fmt::format(_("Could not read certificate file ({})"), e.what())); + throw CertificateReadError(e.what()); } } @@ -238,8 +238,8 @@ download_dolby_certificate(string const& serial, std::function<void ()> yield) try { auto data = get_from_zip_url(location.url, location.file, true, true); return { dcp::Certificate(get_from_zip_url(location.url, location.file, true, true).as_string()), location.url }; - } catch (dcp:MiscError& e) { - throw CertificateDownloadError(fmt::format(_("Could not read certificate file ({})"), e.what())); + } catch (dcp::MiscError& e) { + throw CertificateReadError(e.what()); } } @@ -247,7 +247,7 @@ download_dolby_certificate(string const& serial, std::function<void ()> yield) for (auto e: errors) { s += e + "\n"; } - throw CertificateDownloadError(s); + throw CertificateReadError(s); } @@ -285,6 +285,36 @@ download_christie_certificate(string serial) pair<dcp::Certificate, string> +download_qube_certificate(Manufacturer manufacturer, string const& serial) +{ + static string const base = "ftp://certificates.qubecinema.com/"; + auto files = ls_url(fmt::format("{}SMPTE-{}/", base, _type)); + if (files.empty()) { + throw DownloadError(_("Could not read certificates from Qube server.")); + } + + optional<string> name; + for (auto i: files) { + if (boost::algorithm::starts_with(i, fmt::format("{}-{}-", _type, serial))) { + name = i; + break; + } + } + + if (!name) { + throw DownloadError(fmt::format(_("Could not find serial number {}"), serial)); + } + + try { + auto const url = fmt::format("{}SMPTE-{}/{}", base, _type, *name); + return { dcp::Certificate(get_from_url(url, true, false).as_string()), url }; + } catch (dcp::MiscError& e) { + throw CertificateReadError(e.what()); + } +} + + +pair<dcp::Certificate, string> download_certificate(Manufacturer manufacturer, string const& serial, std::function<void ()> yield) { switch (manufacturer) { @@ -296,6 +326,8 @@ download_certificate(Manufacturer manufacturer, string const& serial, std::funct return download_dolby_certificate(serial, yield); case Manufacturer::CHRISTIE: return download_christie_certificate(serial); + case Manufacturer::QUBE: + return download_qube_certificate(serial); } return {}; diff --git a/src/lib/download_certificate.h b/src/lib/download_certificate.h index 60ee4f69f..81902ea87 100644 --- a/src/lib/download_certificate.h +++ b/src/lib/download_certificate.h @@ -28,6 +28,7 @@ enum class Manufacturer BARCO, DOLBY, CHRISTIE, + QUBE, }; diff --git a/src/lib/exceptions.cc b/src/lib/exceptions.cc index dbeae409f..a34d8f90b 100644 --- a/src/lib/exceptions.cc +++ b/src/lib/exceptions.cc @@ -193,7 +193,7 @@ SQLError::get_filename(SQLiteDatabase& db) CertificateReadError::CertificateReadError(string const& detail) - : std::runtime_error(fmt::format(_("Could not read certificate file ({})", detail))) + : std::runtime_error(fmt::format(_("Could not read certificate file ({})"), detail)) { } |
