+++ /dev/null
-/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
-
- This program 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.
-
- This program 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 this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-/** @file src/copy_from_dvd_job.cc
- * @brief A job to copy a film from a DVD.
- */
-
-#include <stdio.h>
-#include <boost/algorithm/string.hpp>
-#include <boost/filesystem.hpp>
-#include "copy_from_dvd_job.h"
-#include "dvd.h"
-#include "cross.h"
-#include "film.h"
-
-using std::string;
-using std::list;
-using std::stringstream;
-using boost::shared_ptr;
-
-/** @param f Film to write DVD data into.
- */
-CopyFromDVDJob::CopyFromDVDJob (shared_ptr<Film> f, shared_ptr<Job> req)
- : Job (f, req)
-{
-
-}
-
-string
-CopyFromDVDJob::name () const
-{
- return "Copy film from DVD";
-}
-
-void
-CopyFromDVDJob::run ()
-{
- /* Remove any old DVD rips */
- boost::filesystem::remove_all (_film->dir ("dvd"));
-
- string const dvd = find_dvd ();
- if (dvd.empty ()) {
- set_error ("could not find DVD");
- set_state (FINISHED_ERROR);
- }
-
- list<DVDTitle> const t = dvd_titles (dvd);
- if (t.empty ()) {
- set_error ("no titles found on DVD");
- set_state (FINISHED_ERROR);
- }
-
- int longest_title = 0;
- uint64_t longest_size = 0;
- for (list<DVDTitle>::const_iterator i = t.begin(); i != t.end(); ++i) {
- if (longest_size < i->size) {
- longest_size = i->size;
- longest_title = i->number;
- }
- }
-
- stringstream c;
- c << "vobcopy -n " << longest_title << " -l -o \"" << _film->dir ("dvd") << "\" 2>&1";
-
- FILE* f = popen (c.str().c_str(), "r");
- if (f == 0) {
- set_error ("could not run vobcopy command");
- set_state (FINISHED_ERROR);
- return;
- }
-
- while (!feof (f)) {
- char buf[256];
- if (fscanf (f, "%s", buf)) {
- string s (buf);
- if (!s.empty () && s[s.length() - 1] == '%') {
- set_progress (atof (s.substr(0, s.length() - 1).c_str()) / 100.0);
- }
- }
- }
-
- const string dvd_dir = _film->dir ("dvd");
-
- string largest_file;
- uintmax_t largest_size = 0;
- for (boost::filesystem::directory_iterator i = boost::filesystem::directory_iterator (dvd_dir); i != boost::filesystem::directory_iterator(); ++i) {
- uintmax_t const s = boost::filesystem::file_size (*i);
- if (s > largest_size) {
-
-#if BOOST_FILESYSTEM_VERSION == 3
- largest_file = boost::filesystem::path(*i).generic_string();
-#else
- largest_file = i->string ();
-#endif
- largest_size = s;
- }
- }
-
- _film->set_content (largest_file);
-
- int const r = pclose (f);
- if (WEXITSTATUS (r) != 0) {
- set_error ("call to vobcopy failed");
- set_state (FINISHED_ERROR);
- } else {
- set_state (FINISHED_OK);
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
-
- This program 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.
-
- This program 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 this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-/** @file src/copy_from_dvd_job.h
- * @brief A job to copy a film from a DVD.
- */
-
-#include "job.h"
-
-/** @class CopyFromDVDJob
- * @brief A job to copy a film from a DVD using `vobcopy'.
- */
-class CopyFromDVDJob : public Job
-{
-public:
- CopyFromDVDJob (boost::shared_ptr<Film>, boost::shared_ptr<Job> req);
-
- std::string name () const;
- void run ();
-};
+++ /dev/null
-/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
-
- This program 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.
-
- This program 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 this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <fstream>
-#include <boost/filesystem.hpp>
-#include <boost/algorithm/string.hpp>
-#include "dvd.h"
-
-using namespace std;
-using namespace boost;
-
-string
-find_dvd ()
-{
- ifstream f ("/etc/mtab");
- while (f.good ()) {
- string s;
- getline (f, s);
- vector<string> b;
- split (b, s, is_any_of (" "));
- if (b.size() >= 3 && b[2] == "udf") {
- replace_all (b[1], "\\040", " ");
- return b[1];
- }
- }
-
- return "";
-}
-
-list<DVDTitle>
-dvd_titles (string dvd)
-{
- filesystem::path video (dvd);
- video /= "VIDEO_TS";
-
- list<DVDTitle> titles;
-
- for (filesystem::directory_iterator i = filesystem::directory_iterator (video); i != filesystem::directory_iterator(); ++i) {
-#if BOOST_FILESYSTEM_VERSION == 3
- string const n = filesystem::path(*i).filename().generic_string();
-#else
- string const n = filesystem::path(*i).filename();
-#endif
- if (starts_with (n, "VTS_") && ends_with (n, ".VOB")) {
- uint64_t const size = filesystem::file_size (filesystem::path (*i));
- vector<string> p;
- split (p, n, is_any_of ("_."));
- if (p.size() == 4) {
- int const a = atoi (p[1].c_str ());
- int const b = atoi (p[2].c_str ());
- if (b == 0) {
- continue;
- }
-
- list<DVDTitle>::iterator j = titles.begin ();
- while (j != titles.end() && j->number != a) {
- ++j;
- }
-
- if (j == titles.end ()) {
- titles.push_back (DVDTitle (a, size));
- } else {
- j->size += size;
- }
- }
- }
- }
-
- titles.sort ();
-
- return titles;
-}
-
-
-bool
-operator< (DVDTitle const & a, DVDTitle const & b)
-{
- return a.number < b.number;
-}
+++ /dev/null
-/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
-
- This program 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.
-
- This program 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 this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <list>
-#include <stdint.h>
-
-class DVDTitle
-{
-public:
- DVDTitle () : number (-1), size (0) {}
- DVDTitle (int n, int s) : number (n), size (s) {}
-
- int number;
- uint64_t size;
-};
-
-extern bool operator< (DVDTitle const &, DVDTitle const &);
-
-extern std::list<DVDTitle> dvd_titles (std::string);
-extern std::string find_dvd ();
#include "ab_transcode_job.h"
#include "transcode_job.h"
#include "scp_dcp_job.h"
-#include "copy_from_dvd_job.h"
#include "make_dcp_job.h"
#include "log.h"
#include "options.h"
JobManager::instance()->add (j);
}
-void
-Film::copy_from_dvd ()
-{
- shared_ptr<Job> j (new CopyFromDVDJob (shared_from_this(), shared_ptr<Job> ()));
- JobManager::instance()->add (j);
-}
-
/** Count the number of frames that have been encoded for this film.
* @return frame count.
*/
void examine_content ();
void send_dcp_to_tms ();
- void copy_from_dvd ();
void make_dcp (bool);
audio_source.cc
check_hashes_job.cc
config.cc
- copy_from_dvd_job.cc
combiner.cc
cross.cc
dcp_content_type.cc
decoder_factory.cc
delay_line.cc
dolby_cp750.cc
- dvd.cc
encoder.cc
encoder_factory.cc
examine_content_job.cc
#include "wx/job_manager_view.h"
#include "wx/config_dialog.h"
#include "wx/job_wrapper.h"
-//#include "gtk/dvd_title_dialog.h"
#include "wx/wx_util.h"
#include "wx/new_film_dialog.h"
#include "wx/properties_dialog.h"
ID_edit_preferences,
ID_jobs_make_dcp,
ID_jobs_send_dcp_to_tms,
- ID_jobs_copy_from_dvd,
ID_jobs_examine_content,
ID_jobs_make_dcp_from_existing_transcode,
ID_help_about
wxMenu* jobs = new wxMenu;
add_item (jobs, "&Make DCP", ID_jobs_make_dcp, NEEDS_FILM);
add_item (jobs, "&Send DCP to TMS", ID_jobs_send_dcp_to_tms, NEEDS_FILM);
-#ifdef DVDOMATIC_POSIX
- add_item (jobs, "Copy from &DVD...", ID_jobs_copy_from_dvd, NEEDS_FILM);
-#endif
jobs->AppendSeparator ();
add_item (jobs, "&Examine content", ID_jobs_examine_content, NEEDS_FILM);
add_item (jobs, "Make DCP from existing &transcode", ID_jobs_make_dcp_from_existing_transcode, NEEDS_FILM);
Connect (ID_edit_preferences, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (Frame::edit_preferences));
Connect (ID_jobs_make_dcp, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (Frame::jobs_make_dcp));
Connect (ID_jobs_send_dcp_to_tms, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (Frame::jobs_send_dcp_to_tms));
- Connect (ID_jobs_copy_from_dvd, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (Frame::jobs_copy_from_dvd));
Connect (ID_jobs_examine_content, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (Frame::jobs_examine_content));
Connect (ID_jobs_make_dcp_from_existing_transcode, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (Frame::jobs_make_dcp_from_existing_transcode));
Connect (ID_help_about, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (Frame::help_about));
JobWrapper::make_dcp (this, film, false);
}
- void jobs_copy_from_dvd (wxCommandEvent &)
- {
- try {
-
-// DVDTitleDialog d;
-// if (d.run () != Gtk::RESPONSE_OK) {
-// return;
-// }
- film->copy_from_dvd ();
- } catch (DVDError& e) {
- error_dialog (this, e.what ());
- }
- }
-
void jobs_send_dcp_to_tms (wxCommandEvent &)
{
film->send_dcp_to_tms ();
+++ /dev/null
-/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
-
- This program 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.
-
- This program 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 this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <cassert>
-#include <iostream>
-#include "lib/exceptions.h"
-#include "dvd_title_dialog.h"
-#include "gtk_util.h"
-
-using namespace std;
-
-DVDTitleDialog::DVDTitleDialog ()
-{
- string const dvd = find_dvd ();
- if (dvd.empty ()) {
- throw DVDError ("could not find DVD");
- }
-
- list<DVDTitle> t = dvd_titles (dvd);
- if (t.empty ()) {
- throw DVDError ("no titles found on DVD");
- }
-
- set_title ("Choose DVD title");
- get_vbox()->set_border_width (6);
- get_vbox()->set_spacing (3);
-
- Gtk::RadioButtonGroup g;
- for (list<DVDTitle>::const_iterator i = t.begin(); i != t.end(); ++i) {
- Gtk::RadioButton* b = manage (new Gtk::RadioButton);
- stringstream s;
-#if HAVE_G_FORMAT_SIZE
- s << "Title " << i->number << ": " << g_format_size (i->size);
-#else
- s << "Title " << i->number << ": " << g_format_size_for_display (i->size);
-#endif
- b->set_label (s.str ());
- if (i == t.begin ()) {
- b->set_active ();
- g = b->get_group ();
- } else {
- b->set_group (g);
- }
- get_vbox()->pack_start (*b);
- _buttons[*i] = b;
- }
-
- add_button ("Cancel", Gtk::RESPONSE_CANCEL);
- add_button ("Copy Title", Gtk::RESPONSE_OK);
-
- show_all ();
-}
-
-DVDTitle
-DVDTitleDialog::selected ()
-{
- std::map<DVDTitle, Gtk::RadioButton *>::const_iterator i = _buttons.begin ();
- while (i != _buttons.end() && i->second->get_active() == false) {
- ++i;
- }
-
- assert (i != _buttons.end ());
- return i->first;
-}
+++ /dev/null
-/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
-
- This program 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.
-
- This program 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 this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <gtkmm.h>
-#include "lib/dvd.h"
-
-class DVDTitleDialog : public Gtk::Dialog
-{
-public:
- DVDTitleDialog ();
-
- DVDTitle selected ();
-
-private:
- std::map<DVDTitle, Gtk::RadioButton *> _buttons;
-};
#include "job_manager.h"
#include "util.h"
#include "exceptions.h"
-#include "dvd.h"
#include "delay_line.h"
#include "image.h"
#include "log.h"
BOOST_CHECK_EQUAL (*i++, "them");
}
-BOOST_AUTO_TEST_CASE (dvd_test)
-{
- list<DVDTitle> const t = dvd_titles ("test/dvd");
- BOOST_CHECK_EQUAL (t.size(), 3);
- list<DVDTitle>::const_iterator i = t.begin ();
-
- BOOST_CHECK_EQUAL (i->number, 1);
- BOOST_CHECK_EQUAL (i->size, 0);
- ++i;
-
- BOOST_CHECK_EQUAL (i->number, 2);
- BOOST_CHECK_EQUAL (i->size, 14);
- ++i;
-
- BOOST_CHECK_EQUAL (i->number, 3);
- BOOST_CHECK_EQUAL (i->size, 7);
-}
-
class NullLog : public Log
{
public: