diff options
Diffstat (limited to 'src/parse')
| -rw-r--r-- | src/parse/subtitle.cc | 22 | ||||
| -rw-r--r-- | src/parse/subtitle.h | 2 |
2 files changed, 19 insertions, 5 deletions
diff --git a/src/parse/subtitle.cc b/src/parse/subtitle.cc index 612af716..914be677 100644 --- a/src/parse/subtitle.cc +++ b/src/parse/subtitle.cc @@ -84,10 +84,14 @@ Font::Font (list<shared_ptr<Font> > const & font_nodes) LoadFont::LoadFont (shared_ptr<const cxml::Node> node) { - id = node->string_attribute ("Id"); - uri = node->string_attribute ("URI"); + optional<string> x = node->optional_string_attribute ("Id"); + if (!x) { + x = node->optional_string_attribute ("ID"); + } + id = x.get_value_or (""); + + uri = node->optional_string_attribute ("URI"); } - Subtitle::Subtitle (shared_ptr<const cxml::Node> node) { @@ -123,9 +127,19 @@ Subtitle::fade_time (shared_ptr<const cxml::Node> node, string name) Text::Text (shared_ptr<const cxml::Node> node) : v_align (CENTER) { + /* Vertical position */ text = node->content (); - v_position = node->number_attribute<float> ("VPosition"); + optional<float> x = node->optional_number_attribute<float> ("VPosition"); + if (!x) { + x = node->number_attribute<float> ("Vposition"); + } + v_position = x.get (); + + /* Vertical alignment */ optional<string> v = node->optional_string_attribute ("VAlign"); + if (!v) { + v = node->optional_string_attribute ("Valign"); + } if (v) { v_align = string_to_valign (v.get ()); } diff --git a/src/parse/subtitle.h b/src/parse/subtitle.h index c20278a3..3d99d9bc 100644 --- a/src/parse/subtitle.h +++ b/src/parse/subtitle.h @@ -92,7 +92,7 @@ public: LoadFont (boost::shared_ptr<const cxml::Node> node); std::string id; - std::string uri; + boost::optional<std::string> uri; }; } |
