2 Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #include <boost/filesystem.hpp>
22 #include <boost/algorithm/string.hpp>
25 using namespace boost;
30 ifstream f ("/etc/mtab");
35 split (b, s, is_any_of (" "));
36 if (b.size() >= 3 && b[2] == "udf") {
37 replace_all (b[1], "\\040", " ");
46 dvd_titles (string dvd)
48 filesystem::path video (dvd);
51 vector<uint64_t> sizes;
53 for (filesystem::directory_iterator i = filesystem::directory_iterator (video); i != filesystem::directory_iterator(); ++i) {
54 #if BOOST_FILESYSTEM_VERSION == 3
55 string const n = filesystem::path(*i).filename().generic_string();
57 string const n = filesystem::path(*i).filename();
59 if (starts_with (n, "VTS_") && ends_with (n, ".VOB")) {
60 uint64_t const size = filesystem::file_size (filesystem::path (*i));
62 split (p, n, is_any_of ("_."));
64 int const a = atoi (p[1].c_str ());
65 int const b = atoi (p[2].c_str ());
66 while (a >= int (sizes.size())) {