]> git.pld-linux.org Git - packages/xbmc.git/blob - xbmc-subtitle_tags.patch
- clean unsupported tag
[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,57 @@
16        subtitleText.Replace("</b", "[/B]");
17        subtitleText.Replace("</u", "");
18  
19 +      subtitleText.Replace("{y:u}", "");
20 +      CStdString strTag;
21 +      CRegExp reg(true);
22 +      if (reg.RegComp("({y:i})"))
23 +      {
24 +          if (reg.RegFind(subtitleText) >= 0)
25 +          {
26 +              strTag = reg.GetMatch(1);
27 +              subtitleText.Replace(strTag, "[I]");
28 +              subtitleText += "[/I]";
29 +          }
30 +      }
31 +      if (reg.RegComp("({y:b})"))
32 +      {
33 +          if (reg.RegFind(subtitleText) >= 0)
34 +          {
35 +              strTag = reg.GetMatch(1);
36 +              subtitleText.Replace(strTag, "[B]");
37 +              subtitleText += "[/B]";
38 +          }
39 +      }
40 +
41 +      bool bChange = false;
42 +      int iPos;
43 +      reg.RegComp("({c:\\$).+}");
44 +      CStdStringArray aLines;
45 +      StringUtils::SplitString(subtitleText, "[CR]", aLines);
46 +      for (unsigned int i=0; i < aLines.size(); ++i)
47 +      {
48 +          if (aLines[i].IsEmpty())
49 +              continue;
50 +
51 +          if (aLines[i].GetAt(0) == '/')
52 +          {
53 +              aLines[i].Delete(0);
54 +              aLines[i] = "[I]" + aLines[i] + "[/I]";
55 +              bChange = true;
56 +          }
57 +          if ( (iPos = reg.RegFind(aLines[i])) >= 0)
58 +          {
59 +              strTag = reg.GetMatch(1);
60 +              aLines[i].Replace(strTag, "[COLOR FF");
61 +              iPos = aLines[i].Find("}", iPos);
62 +              aLines[i].SetAt(iPos, ']');
63 +              aLines[i] += "[/COLOR]";
64 +              bChange = true;
65 +          }
66 +      }
67 +      if (bChange)
68 +          StringUtils::JoinString(aLines, "[CR]", subtitleText);
69 +
70        RESOLUTION res = g_graphicsContext.GetVideoResolution();
71        g_graphicsContext.SetRenderingResolution(res, false);
72  
This page took 0.141178 seconds and 4 git commands to generate.