]> git.basschouten.com Git - openhab-addons.git/blob
8265786dbf33b955017d96a865b95aa431449c30
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 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.upnpcontrol.internal.queue;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17
18 /**
19  *
20  * @author Mark Herwege - Initial contribution
21  */
22 @NonNullByDefault
23 public class UpnpEntryRes {
24
25     private String protocolInfo;
26     private @Nullable Long size;
27     private String duration;
28     private String importUri;
29     private String res = "";
30
31     public UpnpEntryRes(@Nullable String protocolInfo, @Nullable Long size, @Nullable String duration,
32             @Nullable String importUri) {
33         // According to the UPnP standard, res should always contain protocolInfo. Some devices do not respect this
34         // standard in their AVTransport implementation. To avoid null pointer exceptions, take care of this special
35         // case.
36         this.protocolInfo = (protocolInfo == null) ? "*" : protocolInfo.trim();
37         this.size = size;
38         this.duration = (duration == null) ? "" : duration.trim();
39         this.importUri = (importUri == null) ? "" : importUri.trim();
40     }
41
42     /**
43      * @return the res
44      */
45     public String getRes() {
46         return res;
47     }
48
49     /**
50      * @param res the res to set
51      */
52     public void setRes(String res) {
53         this.res = res.trim();
54     }
55
56     public String getProtocolInfo() {
57         return protocolInfo;
58     }
59
60     /**
61      * @return the size
62      */
63     public @Nullable Long getSize() {
64         return size;
65     }
66
67     /**
68      * @return the duration
69      */
70     public String getDuration() {
71         return duration;
72     }
73
74     /**
75      * @return the importUri
76      */
77     public String getImportUri() {
78         return importUri;
79     }
80
81     /**
82      * @return true if this resource defines a thumbnail as specified in the DLNA specs
83      */
84     public boolean isThumbnailRes() {
85         return getProtocolInfo().toLowerCase().contains("dlna.org_pn=jpeg_tn");
86     }
87 }