00001 00009 package org.rosmultimedia.player.media.model; 00010 00011 import java.util.List; 00012 00013 import com.google.gson.Gson; 00014 00020 public class Media { 00021 private int id; 00022 private int mediaid; 00023 private String label; 00024 private String fanart; 00025 private String thumbnail; 00026 //Media.Artwork art; 00027 private int playcount; 00028 private String title; 00029 //Video.Streams streamdetails; 00030 private List<String> director; 00031 //MediaResume resume; 00032 private int runtime; 00033 private String dateadded; 00034 private String file; 00035 private String lastplayed; 00036 private String plot; 00037 //Video.Cast cast; 00038 private List<String> cast; 00039 private double rating; 00040 private List<String> writer; 00041 private String originaltitle; 00042 private String votes; 00043 private int year; 00044 private List<String> genre; 00045 00047 public static Media fromJson(String json) { 00048 return fromJson(json, Media.class); 00049 } 00050 00051 protected static <T extends Media> T fromJson(String json, Class<T> cls) { 00052 T result = null; 00053 00054 result = new Gson().fromJson(json, cls); 00055 00056 return result; 00057 } 00058 00059 public int getId() { 00060 return id; 00061 } 00062 public void setId(int id) { 00063 this.id = id; 00064 } 00065 public int getMediaid() { 00066 return mediaid; 00067 } 00068 public void setMediaid(int mediaid) { 00069 this.mediaid = mediaid; 00070 } 00071 public String getLabel() { 00072 return label; 00073 } 00074 public void setLabel(String label) { 00075 this.label = label; 00076 } 00077 public String getFanart() { 00078 return fanart; 00079 } 00080 public void setFanart(String fanart) { 00081 this.fanart = fanart; 00082 } 00083 public String getThumbnail() { 00084 return thumbnail; 00085 } 00086 public void setThumbnail(String thumbnail) { 00087 this.thumbnail = thumbnail; 00088 } 00089 public int getPlaycount() { 00090 return playcount; 00091 } 00092 public void setPlaycount(int playcount) { 00093 this.playcount = playcount; 00094 } 00095 public String getTitle() { 00096 return title; 00097 } 00098 public void setTitle(String title) { 00099 this.title = title; 00100 } 00101 public List<String> getDirector() { 00102 return director; 00103 } 00104 public void setDirector(List<String> director) { 00105 this.director = director; 00106 } 00107 public int getRuntime() { 00108 return runtime; 00109 } 00110 public void setRuntime(int runtime) { 00111 this.runtime = runtime; 00112 } 00113 public String getDateadded() { 00114 return dateadded; 00115 } 00116 public void setDateadded(String dateadded) { 00117 this.dateadded = dateadded; 00118 } 00119 public String getFile() { 00120 return file; 00121 } 00122 public void setFile(String file) { 00123 this.file = file; 00124 } 00125 public String getLastplayed() { 00126 return lastplayed; 00127 } 00128 public void setLastplayed(String lastplayed) { 00129 this.lastplayed = lastplayed; 00130 } 00131 public String getPlot() { 00132 return plot; 00133 } 00134 public void setPlot(String plot) { 00135 this.plot = plot; 00136 } 00137 public List<String> getCast() { 00138 return cast; 00139 } 00140 public void setCast(List<String> cast) { 00141 this.cast = cast; 00142 } 00143 public double getRating() { 00144 return rating; 00145 } 00146 public void setRating(double rating) { 00147 this.rating = rating; 00148 } 00149 public List<String> getWriter() { 00150 return writer; 00151 } 00152 public void setWriter(List<String> writer) { 00153 this.writer = writer; 00154 } 00155 public String getOriginaltitle() { 00156 return originaltitle; 00157 } 00158 public void setOriginaltitle(String originaltitle) { 00159 this.originaltitle = originaltitle; 00160 } 00161 public String getVotes() { 00162 return votes; 00163 } 00164 public void setVotes(String votes) { 00165 this.votes = votes; 00166 } 00167 00168 public int getYear() { 00169 return year; 00170 } 00171 public void setYear(int year) { 00172 this.year = year; 00173 } 00174 public List<String> getGenre() { 00175 return genre; 00176 } 00177 public void setGenre(List<String> genre) { 00178 this.genre = genre; 00179 } 00180 00184 public String toJson() { 00185 Gson gson = new Gson(); 00186 return gson.toJson(this); 00187 } 00188 }