Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Added Eit Fixup for Danish Cable TV (YouSee) #26

Closed
wants to merge 1 commit into from

2 participants

Tonny Petersen Stuart Auchterlonie
Tonny Petersen
tsp commented July 13, 2012

Extracts the following from EIT:

  • Subtitle
  • Episode, season, season id and part number/total.
  • Original air date (only the year though)
  • Directors and actors
  • Rerun
  • Subtitles, Video (HD, WideScreen) and audio (stereo, Surrond, Dolby, 5.1) properties
Stuart Auchterlonie
Collaborator

Committed in 838c58d
We can now close this pull request

Stuart Auchterlonie
Collaborator

Closing as complete

Stuart Auchterlonie stuarta closed this February 26, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Jul 13, 2012
Tonny Petersen Added Eit Fix for Danish Cable TV (YouSee) b5c014c
This page is out of date. Refresh to see the latest.
209  mythtv/libs/libmythtv/eitfixup.cpp
@@ -121,8 +121,25 @@ EITFixUp::EITFixUp()
121 121
                         "NRK2s historiekveld|Detektimen|Nattkino|Filmklassiker|Film|Kortfilm|P.skemorg[eo]n|"
122 122
                         "Radioteatret|Opera|P2-Akademiet|Nyhetsmorg[eo]n i P2 og Alltid Nyheter:): (.+)"),
123 123
       m_noPremiere("\\s+-\\s+(Sesongpremiere|Premiere|premiere)!?$"),
124  
-      m_Stereo("\\b\\(?[sS]tereo\\)?\\b")
125  
-
  124
+      m_Stereo("\\b\\(?[sS]tereo\\)?\\b"),
  125
+      m_dkEpisode("\\(([0-9]+)\\)"),
  126
+      m_dkPart("\\(([0-9]+):([0-9]+)\\)"),
  127
+      m_dkSubtitle1("^([^:]+): (.+)"),
  128
+      m_dkSubtitle2("^([^:]+) - (.+)"),
  129
+      m_dkSeason1("Sæson ([0-9]+)\\."),
  130
+      m_dkSeason2("- år ([0-9]+)(?: :)"),
  131
+      m_dkFeatures("Features:(.+)"),
  132
+      m_dkWidescreen(" 16:9"),
  133
+      m_dkDolby(" 5:1"),
  134
+      m_dkSurround(" \\(\\(S\\)\\)"),
  135
+      m_dkStereo(" S"),
  136
+      m_dkReplay(" \\(G\\)"),
  137
+      m_dkTxt(" TTV"),
  138
+      m_dkHD(" HD"),
  139
+      m_dkActors("(?:Medvirkende: |Medv\\.: )(.+)"),
  140
+      m_dkPersonsSeparator("(, )|(og )"),
  141
+      m_dkDirector("(?:Instr.: |Instrukt.r: )(.+)$"),
  142
+      m_dkYear(" fra ([0-9]{4})[ \\.]")
126 143
 {
127 144
 }
128 145
 
@@ -182,6 +199,9 @@ void EITFixUp::Fix(DBEventEIT &event) const
182 199
     if (kFixNRK_DVBT & event.fixup)
183 200
         FixNRK_DVBT(event);
184 201
 
  202
+    if (kFixDK & event.fixup)
  203
+        FixDK(event);
  204
+
185 205
     if (kFixCategory & event.fixup)
186 206
         FixCategory(event);
187 207
 
@@ -1765,3 +1785,188 @@ void EITFixUp::FixNRK_DVBT(DBEventEIT &event) const
1765 1785
     }
1766 1786
 }
1767 1787
 
  1788
+/** \fn EITFixUp::FixDK(DBEventEIT&) const
  1789
+ *  \brief Use this to clean YouSee's DVB-C guide in Denmark.
  1790
+ */
  1791
+void EITFixUp::FixDK(DBEventEIT &event) const
  1792
+{
  1793
+    // Source: YouSee Rules of Operation v1.16
  1794
+    // url: http://yousee.dk/~/media/pdf/CPE/Rules_Operation.ashx
  1795
+    int        position = -1;
  1796
+    int        episode = -1;
  1797
+    int        season = -1;
  1798
+    QRegExp    tmpRegEx;
  1799
+    // Title search
  1800
+    // episode and part/part total
  1801
+    tmpRegEx = m_dkEpisode;
  1802
+    position = event.title.indexOf(tmpRegEx);
  1803
+    if (position != -1)
  1804
+    {
  1805
+      episode = tmpRegEx.cap(1).toInt();
  1806
+      event.partnumber = tmpRegEx.cap(1).toInt();
  1807
+      event.title = event.title.replace(tmpRegEx, "");
  1808
+    }
  1809
+
  1810
+    tmpRegEx = m_dkPart;
  1811
+    position = event.title.indexOf(tmpRegEx);
  1812
+    if (position != -1)
  1813
+    {
  1814
+      episode = tmpRegEx.cap(1).toInt();
  1815
+      event.partnumber = tmpRegEx.cap(1).toInt();
  1816
+      event.parttotal = tmpRegEx.cap(2).toInt();
  1817
+      event.title = event.title.replace(tmpRegEx, "");
  1818
+    }
  1819
+
  1820
+    // subtitle delimiters
  1821
+    tmpRegEx = m_dkSubtitle1;
  1822
+    position = event.title.indexOf(tmpRegEx);
  1823
+    if (position != -1)
  1824
+    {
  1825
+      event.title = tmpRegEx.cap(1);
  1826
+      event.subtitle = tmpRegEx.cap(2);
  1827
+    }
  1828
+    else
  1829
+    {
  1830
+        tmpRegEx = m_dkSubtitle2;
  1831
+        if(event.title.indexOf(tmpRegEx) != -1)
  1832
+        {
  1833
+            event.title = tmpRegEx.cap(1);
  1834
+            event.subtitle = tmpRegEx.cap(2);
  1835
+        }
  1836
+    }
  1837
+    // Description search
  1838
+    // Season (Sæson [:digit:]+.) => episode = season episode number
  1839
+    // or year (- år [:digit:]+(\\)|:) ) => episode = total episode number
  1840
+    tmpRegEx = m_dkSeason1;
  1841
+    position = event.description.indexOf(tmpRegEx);
  1842
+    if (position != -1)
  1843
+    {
  1844
+      season = tmpRegEx.cap(1).toInt();
  1845
+    }
  1846
+    else
  1847
+    {
  1848
+        tmpRegEx = m_dkSeason2;
  1849
+        if(event.description.indexOf(tmpRegEx) !=  -1)
  1850
+        {
  1851
+            season = tmpRegEx.cap(1).toInt();
  1852
+        }
  1853
+    }
  1854
+
  1855
+    //Feature:
  1856
+    tmpRegEx = m_dkFeatures;
  1857
+    position = event.description.indexOf(tmpRegEx);
  1858
+    if (position != -1)
  1859
+    {
  1860
+        QString features = tmpRegEx.cap(1);
  1861
+        event.description = event.description.replace(tmpRegEx, "");
  1862
+        // 16:9
  1863
+        if (features.indexOf(m_dkWidescreen) !=  -1)
  1864
+            event.videoProps |= VID_WIDESCREEN;
  1865
+        // HDTV
  1866
+        if (features.indexOf(m_dkHD) !=  -1)
  1867
+            event.videoProps |= VID_HDTV;
  1868
+        // Dolby Digital surround
  1869
+        if (features.indexOf(m_dkDolby) !=  -1)
  1870
+            event.audioProps |= AUD_DOLBY;
  1871
+        // surround
  1872
+        if (features.indexOf(m_dkSurround) !=  -1)
  1873
+            event.audioProps |= AUD_SURROUND;
  1874
+        // stereo
  1875
+        if (features.indexOf(m_dkStereo) !=  -1)
  1876
+            event.audioProps |= AUD_STEREO;
  1877
+        // (G)
  1878
+        if (features.indexOf(m_dkReplay) !=  -1)
  1879
+            event.previouslyshown = true;
  1880
+        // TTV
  1881
+        if (features.indexOf(m_dkTxt) !=  -1)
  1882
+            event.subtitleType |= SUB_NORMAL;
  1883
+    }
  1884
+
  1885
+    // Series and program id
  1886
+    // programid is currently not transmitted
  1887
+    // YouSee doesn't use a default authority but uses the first byte after
  1888
+    // the / to indicate if the seriesid is global unique or unique on the
  1889
+    // service id
  1890
+    if (event.seriesId.length() >= 1 && event.seriesId[0] == '/')
  1891
+    {
  1892
+        QString newid;
  1893
+        if (event.seriesId[1] == '1')
  1894
+            newid = QString("%1%2").arg(event.chanid).
  1895
+                    arg(event.seriesId.mid(2,8));
  1896
+        else
  1897
+            newid = event.seriesId.mid(2,8);
  1898
+        event.seriesId = newid;
  1899
+    }
  1900
+
  1901
+    if (event.programId.length() >= 1 && event.programId[0] == '/')
  1902
+        event.programId[0]='_';
  1903
+
  1904
+    // Add season and episode number to subtitle
  1905
+    if(episode>0)
  1906
+    {
  1907
+        event.subtitle = QString("%1 (%2").arg(event.subtitle).arg(episode);
  1908
+        if (event.parttotal >0)
  1909
+            event.subtitle = QString("%1:%2").arg(event.subtitle).
  1910
+                    arg(event.parttotal);
  1911
+        if (season>0)
  1912
+        {
  1913
+            event.syndicatedepisodenumber =
  1914
+                    QString("E%1S%2").arg(episode).arg(season);
  1915
+            event.subtitle = QString("%1 Sæson %2").arg(event.subtitle).
  1916
+                    arg(season);
  1917
+        }
  1918
+        event.subtitle = QString("%1)").arg(event.subtitle);
  1919
+    }
  1920
+    // Find actors and director in description
  1921
+    tmpRegEx = m_dkDirector;
  1922
+    bool directorPresent = false;
  1923
+    position = event.description.indexOf(tmpRegEx);
  1924
+    if (position != -1)
  1925
+    {
  1926
+        QString tmpDirectorsString = tmpRegEx.cap(1);
  1927
+        const QStringList directors =
  1928
+            tmpDirectorsString.split(m_dkPersonsSeparator, QString::SkipEmptyParts);
  1929
+        QStringList::const_iterator it = directors.begin();
  1930
+        for (; it != directors.end(); ++it)
  1931
+        {
  1932
+            tmpDirectorsString = it->split(":").last().trimmed().
  1933
+                    remove(QRegExp("\\.$"));
  1934
+            if (tmpDirectorsString != "")
  1935
+                event.AddPerson(DBPerson::kDirector, tmpDirectorsString);
  1936
+        }
  1937
+        directorPresent = true;
  1938
+    }
  1939
+
  1940
+    tmpRegEx = m_dkActors;
  1941
+    position = event.description.indexOf(tmpRegEx);
  1942
+    if (position != -1)
  1943
+    {
  1944
+        QString tmpActorsString = tmpRegEx.cap(1);
  1945
+        if (directorPresent)
  1946
+            tmpActorsString = tmpActorsString.replace(m_dkDirector,"");
  1947
+        const QStringList actors =
  1948
+            tmpActorsString.split(m_dkPersonsSeparator, QString::SkipEmptyParts);
  1949
+        QStringList::const_iterator it = actors.begin();
  1950
+        for (; it != actors.end(); ++it)
  1951
+        {
  1952
+            tmpActorsString = it->split(":").last().trimmed().
  1953
+                    remove(QRegExp("\\.$"));
  1954
+            if (tmpActorsString != "")
  1955
+                event.AddPerson(DBPerson::kActor, tmpActorsString);
  1956
+        }
  1957
+    }
  1958
+    //find year
  1959
+    tmpRegEx = m_dkYear;
  1960
+    position = event.description.indexOf(tmpRegEx);
  1961
+    if (position != -1)
  1962
+    {
  1963
+        bool ok;
  1964
+        uint y = tmpRegEx.cap(1).toUInt(&ok);
  1965
+        if (ok)
  1966
+            event.originalairdate = QDate(y, 1, 1);
  1967
+    }
  1968
+    // Remove white spaces
  1969
+    event.description = event.description.trimmed();
  1970
+    event.title       = event.title.trimmed();
  1971
+    event.subtitle    = event.subtitle.trimmed();
  1972
+}
20  mythtv/libs/libmythtv/eitfixup.h
@@ -51,6 +51,7 @@ class EITFixUp
51 51
         kFixNO         = 0x10000,
52 52
         kFixNRK_DVBT   = 0x20000,
53 53
         kFixDish       = 0x40000,
  54
+        kFixDK         = 0x80000,
54 55
 
55 56
         // Early fixups
56 57
         kEFixForceISO8859_1  = 0x2000,
@@ -90,6 +91,7 @@ class EITFixUp
90 91
     void FixCategory(DBEventEIT &event) const;      // Generic Category fixes
91 92
     void FixNO(DBEventEIT &event) const;            // Norwegian DVB-S
92 93
     void FixNRK_DVBT(DBEventEIT &event) const;      // Norwegian NRK DVB-T
  94
+    void FixDK(DBEventEIT &event) const;            // Danish YouSee DVB-C
93 95
 
94 96
     static QString AddDVBEITAuthority(uint chanid, const QString &id);
95 97
 
@@ -194,6 +196,24 @@ class EITFixUp
194 196
     const QRegExp m_noNRKCategories;
195 197
     const QRegExp m_noPremiere;
196 198
     const QRegExp m_Stereo;
  199
+    const QRegExp m_dkEpisode;
  200
+    const QRegExp m_dkPart;
  201
+    const QRegExp m_dkSubtitle1;
  202
+    const QRegExp m_dkSubtitle2;
  203
+    const QRegExp m_dkSeason1;
  204
+    const QRegExp m_dkSeason2;
  205
+    const QRegExp m_dkFeatures;
  206
+    const QRegExp m_dkWidescreen;
  207
+    const QRegExp m_dkDolby;
  208
+    const QRegExp m_dkSurround;
  209
+    const QRegExp m_dkStereo;
  210
+    const QRegExp m_dkReplay;
  211
+    const QRegExp m_dkTxt;
  212
+    const QRegExp m_dkHD;
  213
+    const QRegExp m_dkActors;
  214
+    const QRegExp m_dkPersonsSeparator;
  215
+    const QRegExp m_dkDirector;
  216
+    const QRegExp m_dkYear;
197 217
 };
198 218
 
199 219
 #endif // EITFIXUP_H
3  mythtv/libs/libmythtv/eithelper.cpp
@@ -853,6 +853,9 @@ static void init_fixup(QMap<uint64_t,uint> &fix)
853 853
         fix[    15U << 16] = // DVB-C Welho
854 854
         EITFixUp::kFixFI | EITFixUp::kFixCategory;
855 855
 
  856
+    // DVB-C YouSee (Denmark)
  857
+    fix[65024U << 16] = EITFixUp::kFixDK;
  858
+
856 859
     // DVB-S(2) Thor 0.8W Norwegian
857 860
     fix[70U << 16] = EITFixUp::kFixNO;
858 861
 
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.