X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=tools%2Fdumpsubs.cc;h=cf7008ee8aa16b8f3327728393b852d16484fb98;hb=21bf11458a2c393ec60421756a29b0d1469f9fe4;hp=ac582e687c1404cf45d5516488fc200de71929d3;hpb=b365da4229b2a9d0ceef632af6880a38ecb65325;p=libsub.git diff --git a/tools/dumpsubs.cc b/tools/dumpsubs.cc index ac582e6..cf7008e 100644 --- a/tools/dumpsubs.cc +++ b/tools/dumpsubs.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014 Carl Hetherington + Copyright (C) 2014-2020 Carl Hetherington 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 @@ -20,16 +20,17 @@ #include "reader_factory.h" #include "reader.h" #include "collect.h" +#include "util.h" #include #include #include +#include using std::string; using std::cerr; using std::cout; using std::map; -using std::list; -using boost::shared_ptr; +using std::shared_ptr; using namespace sub; static void @@ -77,45 +78,7 @@ main (int argc, char* argv[]) exit (EXIT_FAILURE); } - map metadata = reader->metadata (); - for (map::const_iterator i = metadata.begin(); i != metadata.end(); ++i) { - cout << i->first << ": " << i->second << "\n"; - } - - list subs = collect (reader->subtitles ()); - for (list::const_iterator i = subs.begin(); i != subs.end(); ++i) { - cout << "Subtitle at " << i->from << " -> " << i->to << "\n"; - for (list::const_iterator j = i->lines.begin(); j != i->lines.end(); ++j) { - cout << "\t"; - bool italic = false; - bool underline = false; - for (list::const_iterator k = j->blocks.begin(); k != j->blocks.end(); ++k) { - if (k->italic && !italic) { - cout << ""; - } else if (italic && !k->italic) { - cout << ""; - } - if (k->underline && !underline) { - cout << ""; - } else if (underline && !k->underline) { - cout << ""; - } - - italic = k->italic; - underline = k->underline; - - cout << k->text; - } - - if (italic) { - cout << ""; - } - if (underline) { - cout << ""; - } - cout << "\n"; - } - } + sub::dump (reader, cout); return 0; }