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