]> git.basschouten.com Git - openhab-addons.git/blob
8bc023d44fc5c0035a0d6e557ca4b662f27efd60
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2024 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.plex.internal.dto;
14
15 import java.util.List;
16
17 import com.thoughtworks.xstream.annotations.XStreamAlias;
18 import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
19 import com.thoughtworks.xstream.annotations.XStreamImplicit;
20
21 /**
22  *
23  * @author Brian Homeyer - Initial contribution
24  * @author Aron Beurskens - Binding development
25  */
26 @XStreamAlias("MediaContainer")
27 public class MediaContainer {
28     @XStreamAsAttribute
29     private Integer size;
30     @XStreamImplicit
31     @XStreamAsAttribute
32     private List<Video> video = null;
33
34     @XStreamImplicit
35     @XStreamAsAttribute
36     private List<Track> track = null;
37
38     @XStreamImplicit
39     @XStreamAsAttribute
40     private List<Device> device = null;
41
42     public List<Device> getDevice() {
43         return device;
44     }
45
46     public Integer getSize() {
47         return size;
48     }
49
50     public List<Video> getVideo() {
51         return video;
52     }
53
54     public List<Track> getTrack() {
55         return track;
56     }
57
58     /**
59      * Returns a list of video or track objects, depends on what is playing
60      */
61     public List<? extends MediaType> getMediaTypes() {
62         if (video != null) {
63             return video;
64         }
65         if (track != null) {
66             return track;
67         }
68
69         return null;
70     }
71
72     public class MediaType {
73         @XStreamAsAttribute
74         private String title;
75         @XStreamAsAttribute
76         private String thumb;
77         @XStreamAsAttribute
78         private String art;
79         @XStreamAsAttribute
80         private String grandparentThumb;
81         @XStreamAsAttribute
82         private String grandparentTitle;
83         @XStreamAsAttribute
84         private String parentThumb;
85         @XStreamAsAttribute
86         private String parentTitle;
87         @XStreamAsAttribute
88         private long viewOffset;
89         @XStreamAsAttribute
90         private String type;
91         @XStreamAsAttribute
92         private String sessionKey;
93         @XStreamAlias("Media")
94         private Media media;
95         @XStreamAlias("Player")
96         private Player player;
97         @XStreamAlias("User")
98         private User user;
99
100         public String getGrandparentThumb() {
101             return this.grandparentThumb;
102         }
103
104         public void setGrandparentThumb(String grandparentThumb) {
105             this.grandparentThumb = grandparentThumb;
106         }
107
108         public String getGrandparentTitle() {
109             return this.grandparentTitle;
110         }
111
112         public void setGrandparentTitle(String grandparentTitle) {
113             this.grandparentTitle = grandparentTitle;
114         }
115
116         public String getParentThumb() {
117             return this.parentThumb;
118         }
119
120         public void setParentThumb(String parentThumb) {
121             this.parentThumb = parentThumb;
122         }
123
124         public String getParentTitle() {
125             return this.parentTitle;
126         }
127
128         public void setParentTitle(String parentTitle) {
129             this.parentTitle = parentTitle;
130         }
131
132         public Media getMedia() {
133             return this.media;
134         }
135
136         public Player getPlayer() {
137             return this.player;
138         }
139
140         public String getTitle() {
141             return title;
142         }
143
144         public void setTitle(String title) {
145             this.title = title;
146         }
147
148         public long getViewOffset() {
149             return this.viewOffset;
150         }
151
152         public String getType() {
153             return this.type;
154         }
155
156         public String getThumb() {
157             return this.thumb;
158         }
159
160         public void setThumb(String art) {
161             this.thumb = art;
162         }
163
164         public String getArt() {
165             return art;
166         }
167
168         public void setArt(String art) {
169             this.art = art;
170         }
171
172         public String getSessionKey() {
173             return sessionKey;
174         }
175
176         public void setSessionKey(String sessionKey) {
177             this.sessionKey = sessionKey;
178         }
179
180         public User getUser() {
181             return user;
182         }
183
184         public class Player {
185             @XStreamAsAttribute
186             private String machineIdentifier;
187             @XStreamAsAttribute
188             private String state;
189             @XStreamAsAttribute
190             private String local;
191
192             public String getMachineIdentifier() {
193                 return this.machineIdentifier;
194             }
195
196             public String getState() {
197                 return this.state;
198             }
199
200             public void setState(String state) {
201                 this.state = state;
202             }
203
204             public String getLocal() {
205                 return this.local;
206             }
207         }
208
209         public class Media {
210
211             @XStreamAsAttribute
212             private long duration;
213
214             public long getDuration() {
215                 return this.duration;
216             }
217         }
218
219         @XStreamAlias("User")
220         public class User {
221             @XStreamAsAttribute
222             private Integer id;
223
224             public Integer getId() {
225                 return this.id;
226             }
227
228             @XStreamAsAttribute
229             private String title;
230
231             public String getTitle() {
232                 return this.title;
233             }
234         }
235     }
236
237     @XStreamAlias("Video")
238     public class Video extends MediaType {
239     }
240
241     @XStreamAlias("Track")
242     public class Track extends MediaType {
243     }
244
245     @XStreamAlias("Device")
246     public class Device {
247         @XStreamAsAttribute
248         private String name;
249
250         public String getName() {
251             return this.name;
252         }
253
254         @XStreamAlias("Connection")
255         @XStreamImplicit
256         private List<Connection> connection = null;
257
258         public List<Connection> getConnection() {
259             return connection;
260         }
261
262         public class Connection {
263             @XStreamAsAttribute
264             private String protocol;
265             @XStreamAsAttribute
266             private String address;
267
268             public String getProtocol() {
269                 return this.protocol;
270             }
271
272             public String getAddress() {
273                 return this.address;
274             }
275         }
276     }
277 }