]> git.vomp.tv Git - vompclient.git/blob - tvmedia.cc
Screenshot support for vector based osd on raspberry pi
[vompclient.git] / tvmedia.cc
1 /*
2     Copyright 2014 Marten Richter
3
4     This file is part of VOMP.
5
6     VOMP is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     VOMP is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with VOMP; if not, write to the Free Software
18     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19 */
20
21 #include "tvmedia.h"
22 #include "movieinfo.h"
23 #include "seriesinfo.h"
24
25
26 TVMediaInfo::TVMediaInfo()
27 {
28         type=2; // movie or series
29         primary_id=0; //movie or series_id
30         secondary_id=0;  //0 or episode id
31         type_pict=-1; // 0 full info, 1 poster, 2 poster banner, 3 poster thumb
32         container=-1; // indices the dataelements with picture in movieinfo or seriesinfo
33         container_member=-1; // index into the container
34         primary_name="";
35 }
36
37
38 TVMediaInfo::TVMediaInfo(const TVMediaInfo& info)
39 {
40         type=info.type; // movie or series
41         primary_id=info.primary_id; //movie or series_id
42         secondary_id=info.secondary_id;  //0 or episode id
43         type_pict=info.type_pict; // 0 full info, 1 poster, 2 poster banner, 3 poster thumb
44         container=info.container; // indices the dataelements with picture in movieinfo or seriesinfo
45         container_member=info.container_member; // index into the container
46         primary_name=info.primary_name;
47
48 }
49
50 void TVMediaInfo::setMovieInfo(const MovieInfo * mi)
51 {
52         type=1; // movie or series
53         primary_id=mi->id; //movie or series_id
54         secondary_id=0;  //0 or episode id
55 }
56
57 void TVMediaInfo::setSeriesInfo(const SeriesInfo *  si)
58 {
59         type=0; // movie or series
60         primary_id=si->id; //movie or series_id
61         secondary_id=si->episode.episodeid;  //0 or episode id
62 }
63
64 void TVMediaInfo::setPosterThumb(const char* recname)
65 {
66         type=3;
67         primary_name=recname;
68 }
69
70 void TVMediaInfo::setDefaultJpeg(int jpeg_index)
71 {
72         type=4;
73         primary_id=jpeg_index;
74 }
75
76 void TVMediaInfo::setPosterThumb(int channel, int eventid)
77 {
78         type=5;
79         primary_id=channel;
80         secondary_id=eventid;
81 }
82
83 void TVMediaInfo::setChannelLogo(int channel)
84 {
85         type=6;
86         primary_id=channel;
87 }
88
89 bool operator<(const TVMediaInfo& rhs, const TVMediaInfo& lhs)
90 {
91         if (rhs.type==lhs.type) {
92                 if (rhs.primary_id==lhs.primary_id) {
93                         if (rhs.secondary_id==lhs.secondary_id) {
94                                 if (rhs.type_pict==lhs.type_pict) {
95                                         if (rhs.container==lhs.container) {
96                                                 if (rhs.primary_name== lhs.primary_name) {
97                                                         return rhs.container_member < lhs.container_member;
98                                                 } else {
99                                                         return rhs.primary_name < lhs.primary_name;
100                                                 }
101                                         } else {
102                                                 return rhs.container<lhs.container;
103                                         }
104
105
106                                 } else {
107                                         return rhs.type_pict<lhs.type_pict;
108                                 }
109
110                         } else {
111                                 return rhs.secondary_id<lhs.secondary_id;
112                         }
113
114                 } else {
115                         return rhs.primary_id<lhs.primary_id;
116                 }
117
118
119         } else {
120                 return rhs.type < lhs.type;
121         }
122 }
123
124 bool operator==(const TVMediaInfo& rhs, const TVMediaInfo& lhs)
125 {
126         return (rhs.type==lhs.type)  && (rhs.primary_id==lhs.primary_id) &&
127              (rhs.secondary_id==lhs.secondary_id) && (rhs.type_pict==lhs.type_pict) &&
128                 (rhs.container==lhs.container)  && (rhs.primary_name== lhs.primary_name)
129                                                 && (rhs.container_member == lhs.container_member);
130 }