Ticket #2745: untertitel.diff

File untertitel.diff, 3.7 KB (added by l-case@…, 19 years ago)
Line 
1Index: libs/libmythtv/eit.h
2===================================================================
3--- libs/libmythtv/eit.h (Revision 11815)
4+++ libs/libmythtv/eit.h (Arbeitskopie)
5@@ -133,7 +133,7 @@
6 uint16_t partnumber;
7 uint16_t parttotal;
8 QString syndicatedepisodenumber;
9- unsigned char fixup;
10+ uint32_t fixup;
11 unsigned char flags;
12 unsigned char category_type;
13
14Index: libs/libmythtv/eitfixup.cpp
15===================================================================
16--- libs/libmythtv/eitfixup.cpp (Revision 11815)
17+++ libs/libmythtv/eitfixup.cpp (Arbeitskopie)
18@@ -47,7 +47,8 @@
19 m_mcaActors("(.*\\.)\\s+([^\\.]+ [A-Z][^\\.]+)\\.\\s*"),
20 m_mcaActorsSeparator("(,\\s+)"),
21 m_mcaYear("(.*) \\((\\d{4})\\)\\s*$"),
22- m_mcaCC("(.*)\\. HI Subtitles$")
23+ m_mcaCC("(.*)\\. HI Subtitles$"),
24+ m_RTLSubtitle("([^\\.]+)\\.\\s+(.+)")
25 {
26 }
27
28@@ -83,6 +84,9 @@
29 if (kFixMCA & event.fixup)
30 FixMCA(event);
31
32+ if (kFixRTL & event.fixup)
33+ FixRTL(event);
34+
35 if (event.fixup)
36 {
37 if (!event.title.isEmpty())
38@@ -727,3 +731,40 @@
39 event.category_type = kCategoryMovie;
40 }
41 }
42+
43+/** \fn EITFixUp::FixRTL(DBEvent&) const
44+ * \brief Use this to standardise the RTL group guide in Germany.
45+ */
46+void EITFixUp::FixRTL(DBEvent &event) const
47+{
48+ const uint SUBTITLE_PCT = 35; //% of description to allow subtitle up to
49+ const uint SUBTITLE_MAX_LEN = 128; // max length of subtitle field in db.
50+ int position;
51+ QRegExp tmpExp1;
52+
53+ // No need to continue without a description.
54+ if (event.description.length() <= 0)
55+ {
56+ return;
57+ }
58+ // Try to find subtitle in description
59+ tmpExp1 = m_RTLSubtitle;
60+ if ((position = tmpExp1.search(event.description)) != -1)
61+ {
62+ if ((tmpExp1.cap(1).length() < SUBTITLE_MAX_LEN) &&
63+ ((tmpExp1.cap(1).length()*100)/event.description.length() <
64+ SUBTITLE_PCT))
65+ {
66+ event.subtitle = tmpExp1.cap(1);
67+ event.description = tmpExp1.cap(2);
68+ }
69+ }
70+
71+}
72Index: libs/libmythtv/eithelper.cpp
73===================================================================
74--- libs/libmythtv/eithelper.cpp (Revision 11815)
75+++ libs/libmythtv/eithelper.cpp (Arbeitskopie)
76@@ -562,6 +562,10 @@
77 // MultiChoice Africa
78 fix[ 6144U << 16] = EITFixUp::kFixMCA;
79
80+ // RTL Subtitle parsing
81+ fix[ 1089LL << 32 | 1 << 16] = EITFixUp::kFixRTL;// DVB-S
82+ fix[ 773LL << 32 | 8468U << 16] = EITFixUp::kFixRTL;// DVB-T Berlin
83+
84 ///////////////////////////////////////////////////////////////////////////
85 // Special Early fixups for providers that break DVB EIT spec.
86 // transport_id<<32 | netword_id<<16 | service_id
87Index: libs/libmythtv/eitfixup.h
88===================================================================
89--- libs/libmythtv/eitfixup.h (Revision 11815)
90+++ libs/libmythtv/eitfixup.h (Arbeitskopie)
91@@ -28,6 +28,7 @@
92 kFixSubtitle = 0x0020,
93 kFixAUStar = 0x0040,
94 kFixMCA = 0x0080,
95+ kFixRTL = 0x0400,
96
97 // Early fixups
98 kEFixForceISO8859_1 = 0x0100,
99@@ -54,6 +55,7 @@
100 void FixComHem(DBEvent &event, bool parse_subtitle) const; // Sweden DVB-C
101 void FixAUStar(DBEvent &event) const; // Australia DVB-S
102 void FixMCA(DBEvent &event) const; // MultiChoice Africa DVB-S
103+ void FixRTL(DBEvent &event) const; // RTL group DVB
104
105 const QRegExp m_bellYear;
106 const QRegExp m_bellActors;
107@@ -92,6 +94,7 @@
108 const QRegExp m_mcaActorsSeparator;
109 const QRegExp m_mcaYear;
110 const QRegExp m_mcaCC;
111+ const QRegExp m_RTLSubtitle;
112 };
113
114 #endif // EITFIXUP_H