]> git.basschouten.com Git - openhab-addons.git/blob
3e807381d0335a4799674cea90fe2f8c964afe70
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2020 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.heos.internal.json.payload;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17
18 import com.google.gson.annotations.SerializedName;
19
20 /**
21  * Data class for response payloads from now_playing commands
22  *
23  * @author Martin van Wingerden - Initial contribution
24  */
25 @NonNullByDefault
26 public class Media {
27     public @Nullable String type;
28     public @Nullable String song;
29     public @Nullable String station;
30     public @Nullable String album;
31     public @Nullable String artist;
32     public @Nullable String imageUrl;
33     public @Nullable String albumId;
34     @SerializedName("mid")
35     public @Nullable String mediaId;
36     @SerializedName("qid")
37     public int queueId;
38     @SerializedName("sid")
39     public int sourceId;
40
41     public String combinedSongArtist() {
42         return String.format("%s - %s", artist, song);
43     }
44
45     @Override
46     public String toString() {
47         return "Media{" + "type='" + type + '\'' + ", song='" + song + '\'' + ", station='" + station + '\''
48                 + ", album='" + album + '\'' + ", artist='" + artist + '\'' + ", imageUrl='" + imageUrl + '\''
49                 + ", albumId='" + albumId + '\'' + ", mediaId='" + mediaId + '\'' + ", queueId=" + queueId
50                 + ", sourceId=" + sourceId + '}';
51     }
52 }