summaryrefslogtreecommitdiff
path: root/media-plugins/vdr-graphlcd/files/0.1.5/graphlcd-0.1.5-radiotext-lcr-service.diff
blob: 8c2c180ab2c29f8233a7788c11ee15d25fad6069 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
diff -Naur graphlcd-0.1.4.orig/state.c graphlcd-0.1.4/state.c
--- graphlcd-0.1.4.orig/state.c	2007-02-04 23:35:16.317687570 +0100
+++ graphlcd-0.1.4/state.c	2007-02-04 23:42:12.065780817 +0100
@@ -16,6 +16,7 @@
 
 #include <vdr/eitscan.h>
 #include <vdr/i18n.h>
+#include <vdr/plugin.h>
 
 #include "compat.h"
 
@@ -654,6 +655,8 @@
 
 void cGraphLCDState::GetProgramme()
 {
+    bool ptitle = false;
+
     mutex.Lock();
 #if VDRVERSNUM < 10300
     const cEventInfo * present = NULL, * following = NULL;
@@ -670,9 +673,11 @@
                 {
                     event.presentTime = present->GetTime();
                     event.presentTitle = "";
-                    if (!isempty(present->GetTitle()))
+                    if (!isempty(present->GetTitle())) {
                         event.presentTitle = present->GetTitle();
                     event.presentSubtitle = "";
+					ptitle = true;
+					}
                     if (!isempty(present->GetSubtitle()))
                         event.presentSubtitle = present->GetSubtitle();
                 }
@@ -704,9 +709,11 @@
                 {
                     event.presentTime = present->StartTime();
                     event.presentTitle = "";
-                    if (!isempty(present->Title()))
+                    if (!isempty(present->Title())) {
                         event.presentTitle = present->Title();
                     event.presentSubtitle = "";
+					ptitle = true;
+					}
                     if (!isempty(present->ShortText()))
                         event.presentSubtitle = present->ShortText();
                 }
@@ -724,6 +731,54 @@
         }
     }
 #endif
+
+#if VDRVERSNUM >= 10330
+   { // get&display Radiotext
+       cPlugin *p;
+       p = cPluginManager::CallFirstService("RadioTextService-v1.0", NULL);
+       if (p) {
+           RadioTextService_v1_0 rtext;
+           if (cPluginManager::CallFirstService("RadioTextService-v1.0", &rtext)) {
+               if (rtext.rds_info == 2 && strstr(rtext.rds_title, "---") == NULL) {
+                   char rtpinfo[2][65], rtstr[140];
+                   strcpy(rtpinfo[0], rtext.rds_title);
+                   strcpy(rtpinfo[1], rtext.rds_artist);
+                   sprintf(rtstr, "%02d:%02d  %s | %s", rtext.title_start->tm_hour, rtext.title_start->tm_min, trim(((std::string)(rtpinfo[0]))).c_str(), trim(((std::string)(rtpinfo[1]))).c_str());
+                       ptitle ? event.presentSubtitle = rtstr : event.presentTitle = rtstr;
+               }
+               else if (rtext.rds_info > 0) {
+                   char rtstr[65];
+                   strcpy(rtstr, rtext.rds_text);
+                   ptitle ? event.presentSubtitle = trim(rtstr) : event.presentTitle = trim(rtstr);
+               }
+           }
+       }
+   }
+#endif
+ 
+#if VDRVERSNUM >= 10330
+   { // get&display LcrData
+       cPlugin *p;
+       p = cPluginManager::CallFirstService("LcrService-v1.0", NULL);
+       if (p)
+       {
+           LcrService_v1_0 lcrData;
+           if (cPluginManager::CallFirstService("LcrService-v1.0", &lcrData))
+           {
+               if ( strstr( lcrData.destination, "---" ) == NULL )
+               {
+                   char lcrStringParts[3][25], lcrString[100];
+                   strcpy( lcrStringParts[0], (const char *)lcrData.destination );
+                   strcpy( lcrStringParts[1], (const char *)lcrData.price );
+                   strcpy( lcrStringParts[2], (const char *)lcrData.pulse );
+                   sprintf(lcrString, "%s | %s", trim((std::string)(lcrStringParts[1])).c_str(), trim((std::string)(lcrStringParts[2])).c_str());
+                   event.presentTitle = trim(lcrStringParts[0]);
+                   event.presentSubtitle = trim(lcrString);
+               }
+           }
+       }
+   }
+#endif
     mutex.Unlock();
 }
 
diff -Naur graphlcd-0.1.4.orig/state.h graphlcd-0.1.4/state.h
--- graphlcd-0.1.4.orig/state.h	2007-02-04 23:35:16.317687570 +0100
+++ graphlcd-0.1.4/state.h	2007-02-04 23:43:05.728759351 +0100
@@ -130,4 +130,21 @@
     tVolumeState GetVolumeState();
 };
 
+// Radiotext
+struct RadioTextService_v1_0 {
+  int rds_info;
+  int rds_pty;
+  char *rds_text;
+  char *rds_title;
+  char *rds_artist;
+  struct tm *title_start;
+};
+
+// LcrData
+struct LcrService_v1_0 {
+  cString destination;
+  cString price;
+  cString pulse;
+};
+
 #endif