From: Ben Hutchings Date: Thu, 15 Dec 2005 00:46:47 +0000 (+0000) Subject: Added support for "VOB lists" (files containing elements to be inserted into... X-Git-Tag: 0.5~4 X-Git-Url: https://git.decadent.org.uk/gitweb/?p=videolink.git;a=commitdiff_plain;h=5ea39fc96beb4f56198cfb975a6a37bbd61d10ed Added support for "VOB lists" (files containing elements to be inserted into the dvdauthor XML file directly). Added early test of VOB/list file existence, since dvdauthor doesn't test any files until it has processed the previous ones and this may take a long time. --- diff --git a/webdvd.cpp b/webdvd.cpp index 5b3cd9b..cf71bb6 100644 --- a/webdvd.cpp +++ b/webdvd.cpp @@ -219,8 +219,12 @@ namespace .second) { Glib::ustring hostname; - video_paths_.push_back(Glib::filename_from_uri(uri, hostname)); + std::string filename(Glib::filename_from_uri(uri, hostname)); // FIXME: Should check the hostname + if (!Glib::file_test(filename, Glib::FILE_TEST_IS_REGULAR)) + throw std::runtime_error( + filename + " is missing or not a regular file"); + video_paths_.push_back(filename); } } @@ -498,8 +502,11 @@ namespace check(uri->GetPath(path)); // FIXME: This is a bit of a hack. Perhaps we could decide // later based on the MIME type determined by Mozilla? - if (path.Length() > 4 - && std::strcmp(path.EndReading() - 4, ".vob") == 0) + if ((path.Length() > 4 + && std::strcmp(path.EndReading() - 4, ".vob") == 0) + || (path.Length() > 8 + && std::strcmp(path.EndReading() - 8, ".voblist") + == 0)) { PRBool is_file; check(uri->SchemeIs("file", &is_file)); @@ -806,10 +813,25 @@ namespace " \n" " \n" // Record calling page/menu. - "
 g12 = g1; 
\n" + "
 g12 = g1; 
\n"; + + // Write a reference to a linked VOB file, or the contents + // of a linked VOB list file. + const std::string & video_path = video_paths_[video_num - 1]; + if (video_path.compare(video_path.size() - 4, 4, ".vob") == 0) + { // FIXME: Should XML-escape the path - " \n" + file << " \n"; + } + else + { + assert(video_path.compare(video_path.size() - 8, 8, + ".voblist") == 0); + // TODO: Validate the file contents; + file << Glib::file_get_contents(video_path); + } + + file << // If page/menu location has not been changed during the // video, change the location to be the following // link/button when returning to it. In any case,