]> git.pld-linux.org Git - packages/xbmc.git/blob - xbmc-subtitle_tags.patch
- patch to get goom visualisation usable
[packages/xbmc.git] / xbmc-subtitle_tags.patch
1 --- xbmc-10.0/xbmc/GUIWindowFullScreen.cpp.orig 2010-12-17 07:17:41.000000000 +0100
2 +++ xbmc-10.0/xbmc/GUIWindowFullScreen.cpp      2011-02-04 22:05:15.000000000 +0100
3 @@ -47,9 +47,11 @@
4  #include "LocalizeStrings.h"
5  #include "utils/SingleLock.h"
6  #include "utils/log.h"
7 +#include "utils/RegExp.h"
8  #include "utils/TimeUtils.h"
9  #include "DateTime.h"
10  #include "ButtonTranslator.h"
11 +#include "StringUtils.h"
12  
13  #include <stdio.h>
14  
15 @@ -855,6 +857,56 @@
16        subtitleText.Replace("</b", "[/B]");
17        subtitleText.Replace("</u", "");
18  
19 +      CStdString strTag;
20 +      CRegExp reg(true);
21 +      if (reg.RegComp("({y:i})"))
22 +      {
23 +          if (reg.RegFind(subtitleText) >= 0)
24 +          {
25 +              strTag = reg.GetMatch(1);
26 +              subtitleText.Replace(strTag, "[I]");
27 +              subtitleText += "[/I]";
28 +          }
29 +      }
30 +      if (reg.RegComp("({y:b})"))
31 +      {
32 +          if (reg.RegFind(subtitleText) >= 0)
33 +          {
34 +              strTag = reg.GetMatch(1);
35 +              subtitleText.Replace(strTag, "[B]");
36 +              subtitleText += "[/B]";
37 +          }
38 +      }
39 +
40 +      bool bChange = false;
41 +      int iPos;
42 +      reg.RegComp("({c:\\$).+}");
43 +      CStdStringArray aLines;
44 +      StringUtils::SplitString(subtitleText, "[CR]", aLines);
45 +      for (unsigned int i=0; i < aLines.size(); ++i)
46 +      {
47 +          if (aLines[i].IsEmpty())
48 +              continue;
49 +
50 +          if (aLines[i].GetAt(0) == '/')
51 +          {
52 +              aLines[i].Delete(0);
53 +              aLines[i] = "[I]" + aLines[i] + "[/I]";
54 +              bChange = true;
55 +          }
56 +          if ( (iPos = reg.RegFind(aLines[i])) >= 0)
57 +          {
58 +              strTag = reg.GetMatch(1);
59 +              aLines[i].Replace(strTag, "[COLOR FF");
60 +              iPos = aLines[i].Find("}", iPos);
61 +              aLines[i].SetAt(iPos, ']');
62 +              aLines[i] += "[/COLOR]";
63 +              bChange = true;
64 +          }
65 +      }
66 +      if (bChange)
67 +          StringUtils::JoinString(aLines, "[CR]", subtitleText);
68 +
69        RESOLUTION res = g_graphicsContext.GetVideoResolution();
70        g_graphicsContext.SetRenderingResolution(res, false);
71  
This page took 0.065895 seconds and 4 git commands to generate.