From df26129aa8f99ba7da7578de36b28a12cfdec272 Mon Sep 17 00:00:00 2001 From: willems davy Date: Tue, 28 Feb 2017 18:52:31 +0100 Subject: [PATCH] fix themes not displaying due to double video end tags --- config/loader/hyperspin.nut | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/config/loader/hyperspin.nut b/config/loader/hyperspin.nut index 0a1fcaabe..fd1d18942 100644 --- a/config/loader/hyperspin.nut +++ b/config/loader/hyperspin.nut @@ -181,6 +181,21 @@ for ( local i=0; i< fe.displays.len(); i++ ) // Functions definitions // ///////////////////////////////////////////////////////// +function string_replace( string, original, replacement ) +{ + local result = string; + local position = 0; + + position = result.find( original ); + while ( position != null ) + { + result = result.slice( 0, position) + replacement + result.slice(position + original.len() ); + position = result.find( original ); + } + + return result; +} + function strip_ext( name ) { local s = split( name, "." ); @@ -453,6 +468,13 @@ function load( ttype, match_map, hs_sys_dir ) while ( !f.eos() ) raw_xml = raw_xml + f.read_line(); + //fix common error in a lot of themes with wrong end tags + raw_xml = string_replace( raw_xml, "start=\"none\"/>rest=", "start=\"none\"rest=" ); + raw_xml = string_replace( raw_xml, "start=\"left\"/>rest=", "start=\"left\"rest=" ); + raw_xml = string_replace( raw_xml, "start=\"top\"/>rest=", "start=\"top\"rest=" ); + raw_xml = string_replace( raw_xml, "start=\"bottom\"/>rest=", "start=\"bottom\"rest=" ); + raw_xml = string_replace( raw_xml, "start=\"right\"/>rest=", "start=\"right\"rest=" ); + // root tag = "Theme" local xml_root = null; try