diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-11-19 00:12:52 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-11-19 00:12:52 +0000 |
| commit | 5d80a3e757752dfa71d8bc05d55b6ec2f4050ac1 (patch) | |
| tree | f819cdc9e8a6d2e9386c7a6cebf0185409621e00 /src/lib | |
| parent | fd1b14fd001f5505733513385c74a49a1ea84721 (diff) | |
Remove never-tested DVD ripping / title code.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/copy_from_dvd_job.cc | 124 | ||||
| -rw-r--r-- | src/lib/copy_from_dvd_job.h | 36 | ||||
| -rw-r--r-- | src/lib/dvd.cc | 95 | ||||
| -rw-r--r-- | src/lib/dvd.h | 36 | ||||
| -rw-r--r-- | src/lib/film.cc | 8 | ||||
| -rw-r--r-- | src/lib/film.h | 1 | ||||
| -rw-r--r-- | src/lib/wscript | 2 |
7 files changed, 0 insertions, 302 deletions
diff --git a/src/lib/copy_from_dvd_job.cc b/src/lib/copy_from_dvd_job.cc deleted file mode 100644 index dcf53ac54..000000000 --- a/src/lib/copy_from_dvd_job.cc +++ /dev/null @@ -1,124 +0,0 @@ -/* - 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); - } -} diff --git a/src/lib/copy_from_dvd_job.h b/src/lib/copy_from_dvd_job.h deleted file mode 100644 index 063e94358..000000000 --- a/src/lib/copy_from_dvd_job.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - 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 (); -}; diff --git a/src/lib/dvd.cc b/src/lib/dvd.cc deleted file mode 100644 index 19b59b588..000000000 --- a/src/lib/dvd.cc +++ /dev/null @@ -1,95 +0,0 @@ -/* - 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; -} diff --git a/src/lib/dvd.h b/src/lib/dvd.h deleted file mode 100644 index 28fef4d16..000000000 --- a/src/lib/dvd.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - 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 (); diff --git a/src/lib/film.cc b/src/lib/film.cc index 333fe139b..3f9210080 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -40,7 +40,6 @@ #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" @@ -337,13 +336,6 @@ Film::send_dcp_to_tms () 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. */ diff --git a/src/lib/film.h b/src/lib/film.h index 5e75eefe8..76fe98710 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -65,7 +65,6 @@ public: void examine_content (); void send_dcp_to_tms (); - void copy_from_dvd (); void make_dcp (bool); diff --git a/src/lib/wscript b/src/lib/wscript index 5284dc97f..942975b32 100644 --- a/src/lib/wscript +++ b/src/lib/wscript @@ -12,7 +12,6 @@ def build(bld): audio_source.cc check_hashes_job.cc config.cc - copy_from_dvd_job.cc combiner.cc cross.cc dcp_content_type.cc @@ -21,7 +20,6 @@ def build(bld): decoder_factory.cc delay_line.cc dolby_cp750.cc - dvd.cc encoder.cc encoder_factory.cc examine_content_job.cc |
