using boost::function;
using boost::algorithm::trim;
+static size_t
+ls_url_data (void* buffer, size_t size, size_t nmemb, void* output)
+{
+ string* s = reinterpret_cast<string*>(output);
+ char* c = reinterpret_cast<char*>(buffer);
+ for (size_t i = 0; i < (size * nmemb); ++i) {
+ *s += c[i];
+ }
+ return nmemb;
+}
+
+list<string>
+ls_url (string url)
+{
+ CURL* curl = curl_easy_init ();
+ curl_easy_setopt (curl, CURLOPT_URL, url.c_str());
+ curl_easy_setopt (curl, CURLOPT_DIRLISTONLY, 1);
+
+ string ls;
+ curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, ls_url_data);
+ curl_easy_setopt (curl, CURLOPT_WRITEDATA, &ls);
+ CURLcode const cr = curl_easy_perform (curl);
+
+ if (cr != CURLE_OK) {
+ return list<string>();
+ }
+
+ list<string> result;
+ result.push_back("");
+ for (size_t i = 0; i < ls.size(); ++i) {
+ if (ls[i] == '\n') {
+ result.push_back("");
+ } else {
+ result.back() += ls[i];
+ }
+ }
+
+ result.pop_back ();
+ return result;
+}
static size_t
get_from_url_data (void* buffer, size_t size, size_t nmemb, void* stream)
boost::optional<std::string> get_from_url (std::string url, bool pasv, bool skip_pasv_ip, ScopedTemporary& temp);
boost::optional<std::string> get_from_url (std::string url, bool pasv, bool skip_pasv_ip, boost::function<void (boost::filesystem::path)> load);
boost::optional<std::string> get_from_zip_url (std::string url, std::string file, bool pasv, bool skip_pasv_ip, boost::function<void (boost::filesystem::path)> load);
+std::list<std::string> ls_url (std::string url);
#include "barco_alchemy_certificate_panel.h"
#include "christie_certificate_panel.h"
#include "gdc_certificate_panel.h"
+#include "qube_certificate_panel.h"
#include "download_certificate_dialog.h"
#include "static_text.h"
#include "wx_util.h"
_pages.push_back (new BarcoAlchemyCertificatePanel (this));
_pages.push_back (new ChristieCertificatePanel (this));
_pages.push_back (new GDCCertificatePanel (this));
+ _pages.push_back (new QubeCertificatePanel (this, N_("QXI")));
+ _pages.push_back (new QubeCertificatePanel (this, N_("QXPD")));
BOOST_FOREACH (DownloadCertificatePanel* i, _pages) {
_notebook->AddPage (i, i->name(), true);
_notebook->SetSelection (0);
+ SetMinSize (wxSize(640, -1));
+
setup_sensitivity ();
}
--- /dev/null
+/*
+ Copyright (C) 2019 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 "qube_certificate_panel.h"
+#include "download_certificate_dialog.h"
+#include "wx_util.h"
+#include "lib/internet.h"
+#include "lib/compose.hpp"
+#include "lib/config.h"
+#include <boost/algorithm/string/predicate.hpp>
+
+using std::string;
+using std::list;
+using boost::optional;
+
+static string const base = "ftp://certificates.qubecinema.com/";
+
+QubeCertificatePanel::QubeCertificatePanel (DownloadCertificateDialog* dialog, string type)
+ : DownloadCertificatePanel (dialog)
+ , _type (type)
+{
+
+}
+
+void
+QubeCertificatePanel::do_download ()
+{
+ list<string> files = ls_url(String::compose("%1SMPTE-%2/", base, _type));
+ if (files.empty()) {
+ error_dialog (this, _("Could not read certificates from Qube server."));
+ return;
+ }
+
+ string const serial = wx_to_std(_serial->GetValue());
+ optional<string> name;
+ BOOST_FOREACH (string i, files) {
+ if (boost::algorithm::starts_with(i, String::compose("%1-%2-", _type, serial))) {
+ name = i;
+ break;
+ }
+ }
+
+ if (!name) {
+ _dialog->message()->SetLabel(wxT(""));
+ error_dialog (this, wxString::Format(_("Could not find serial number %s"), std_to_wx(serial).data()));
+ return;
+ }
+
+ optional<string> error = get_from_url (String::compose("%1SMPTE-%2/%3", base, _type, *name), true, boost::bind (&DownloadCertificatePanel::load, this, _1));
+
+ if (error) {
+ _dialog->message()->SetLabel(wxT(""));
+ error_dialog (this, std_to_wx(*error));
+ } else {
+ _dialog->message()->SetLabel (_("Certificate downloaded"));
+ _dialog->setup_sensitivity ();
+ }
+}
+
+wxString
+QubeCertificatePanel::name () const
+{
+ return _("Qube") + " " + std_to_wx(_type);
+}
--- /dev/null
+/*
+ Copyright (C) 2019 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 "download_certificate_panel.h"
+
+class QubeCertificatePanel : public DownloadCertificatePanel
+{
+public:
+ QubeCertificatePanel (DownloadCertificateDialog* dialog, std::string type);
+
+ void do_download ();
+ wxString name () const;
+
+private:
+ std::string _type;
+};
playhead_to_frame_dialog.cc
question_dialog.cc
rating_dialog.cc
+ qube_certificate_panel.cc
recreate_chain_dialog.cc
repeat_dialog.cc
report_problem_dialog.cc