00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 package org.xbmc.android.jsonrpc.api.model;
00022
00023 import android.os.Parcel;
00024 import android.os.Parcelable;
00025 import java.util.ArrayList;
00026 import java.util.Arrays;
00027 import java.util.HashMap;
00028 import java.util.HashSet;
00029 import java.util.List;
00030 import java.util.Set;
00031 import org.codehaus.jackson.JsonNode;
00032 import org.codehaus.jackson.node.ArrayNode;
00033 import org.codehaus.jackson.node.ObjectNode;
00034 import org.xbmc.android.jsonrpc.api.AbstractModel;
00035
00036 public final class VideoModel {
00037
00044 public static class Cast extends AbstractModel {
00045
00046
00047 public static final String NAME = "name";
00048 public static final String ROLE = "role";
00049 public static final String THUMBNAIL = "thumbnail";
00050
00051
00052 public final String name;
00053 public final String role;
00054 public final String thumbnail;
00055
00061 public Cast(String name, String role, String thumbnail) {
00062 this.name = name;
00063 this.role = role;
00064 this.thumbnail = thumbnail;
00065 }
00066
00071 public Cast(JsonNode node) {
00072 name = node.get(NAME).getTextValue();
00073 role = node.get(ROLE).getTextValue();
00074 thumbnail = parseString(node, THUMBNAIL);
00075 }
00076
00077 @Override
00078 public JsonNode toJsonNode() {
00079 final ObjectNode node = OM.createObjectNode();
00080 node.put(NAME, name);
00081 node.put(ROLE, role);
00082 node.put(THUMBNAIL, thumbnail);
00083 return node;
00084 }
00085
00091 static List<Cast> getVideoModelCastList(JsonNode node, String key) {
00092 if (node.has(key)) {
00093 final ArrayNode a = (ArrayNode)node.get(key);
00094 final List<Cast> l = new ArrayList<Cast>(a.size());
00095 for (int i = 0; i < a.size(); i++) {
00096 l.add(new Cast((JsonNode)a.get(i)));
00097 }
00098 return l;
00099 }
00100 return new ArrayList<Cast>(0);
00101 }
00102
00108 @Override
00109 public void writeToParcel(Parcel parcel, int flags) {
00110 parcel.writeValue(name);
00111 parcel.writeValue(role);
00112 parcel.writeValue(thumbnail);
00113 }
00114
00118 protected Cast(Parcel parcel) {
00119 name = parcel.readString();
00120 role = parcel.readString();
00121 thumbnail = parcel.readString();
00122 }
00123
00127 public static final Parcelable.Creator<Cast> CREATOR = new Parcelable.Creator<Cast>() {
00128 @Override
00129 public Cast createFromParcel(Parcel parcel) {
00130 return new Cast(parcel);
00131 }
00132 @Override
00133 public Cast[] newArray(int n) {
00134 return new Cast[n];
00135 }
00136 };
00137
00138 @Override
00139 public int describeContents() {
00140 return 0;
00141 }
00142 }
00143
00150 public static class BaseDetail extends MediaModel.BaseDetail {
00151 public final static String API_TYPE = "Video.Details.Base";
00152
00153
00154 public static final String ART = "art";
00155 public static final String PLAYCOUNT = "playcount";
00156
00157
00158 public final MediaModel.Artwork art;
00159 public final Integer playcount;
00160
00165 public BaseDetail(JsonNode node) {
00166 super(node);
00167 art = node.has(ART) ? new MediaModel.Artwork(node.get(ART)) : null;
00168 playcount = parseInt(node, PLAYCOUNT);
00169 }
00170
00171 @Override
00172 public JsonNode toJsonNode() {
00173 final ObjectNode node = (ObjectNode)super.toJsonNode();
00174 node.put(ART, art.toJsonNode());
00175 node.put(PLAYCOUNT, playcount);
00176 return node;
00177 }
00178
00184 static List<BaseDetail> getVideoModelBaseDetailList(JsonNode node, String key) {
00185 if (node.has(key)) {
00186 final ArrayNode a = (ArrayNode)node.get(key);
00187 final List<BaseDetail> l = new ArrayList<BaseDetail>(a.size());
00188 for (int i = 0; i < a.size(); i++) {
00189 l.add(new BaseDetail((JsonNode)a.get(i)));
00190 }
00191 return l;
00192 }
00193 return new ArrayList<BaseDetail>(0);
00194 }
00195
00201 @Override
00202 public void writeToParcel(Parcel parcel, int flags) {
00203 super.writeToParcel(parcel, flags);
00204 parcel.writeValue(art);
00205 parcel.writeValue(playcount);
00206 }
00207
00211 protected BaseDetail(Parcel parcel) {
00212 super(parcel);
00213 art = parcel.<MediaModel.Artwork>readParcelable(MediaModel.Artwork.class.getClassLoader());
00214 playcount = parcel.readInt();
00215 }
00216
00220 public static final Parcelable.Creator<BaseDetail> CREATOR = new Parcelable.Creator<BaseDetail>() {
00221 @Override
00222 public BaseDetail createFromParcel(Parcel parcel) {
00223 return new BaseDetail(parcel);
00224 }
00225 @Override
00226 public BaseDetail[] newArray(int n) {
00227 return new BaseDetail[n];
00228 }
00229 };
00230
00231 @Override
00232 public int describeContents() {
00233 return 0;
00234 }
00235 }
00236
00243 public static class EpisodeDetail extends FileDetail {
00244 public final static String API_TYPE = "Video.Details.Episode";
00245
00246
00247 public static final String CAST = "cast";
00248 public static final String EPISODE = "episode";
00249 public static final String EPISODEID = "episodeid";
00250 public static final String FIRSTAIRED = "firstaired";
00251 public static final String ORIGINALTITLE = "originaltitle";
00252 public static final String PRODUCTIONCODE = "productioncode";
00253 public static final String RATING = "rating";
00254 public static final String SEASON = "season";
00255 public static final String SHOWTITLE = "showtitle";
00256 public static final String TVSHOWID = "tvshowid";
00257 public static final String UNIQUEID = "uniqueid";
00258 public static final String VOTES = "votes";
00259 public static final String WRITER = "writer";
00260
00261
00262 public final List<Cast> cast;
00263 public final Integer episode;
00264 public final Integer episodeid;
00265 public final String firstaired;
00266 public final String originaltitle;
00267 public final String productioncode;
00268 public final Double rating;
00269 public final Integer season;
00270 public final String showtitle;
00271 public final Integer tvshowid;
00272 public final HashMap<String, String> uniqueid;
00273 public final String votes;
00274 public final List<String> writer;
00275
00280 public EpisodeDetail(JsonNode node) {
00281 super(node);
00282 cast = Cast.getVideoModelCastList(node, CAST);
00283 episode = parseInt(node, EPISODE);
00284 episodeid = parseInt(node, EPISODEID);
00285 firstaired = parseString(node, FIRSTAIRED);
00286 originaltitle = parseString(node, ORIGINALTITLE);
00287 productioncode = parseString(node, PRODUCTIONCODE);
00288 rating = parseDouble(node, RATING);
00289 season = parseInt(node, SEASON);
00290 showtitle = parseString(node, SHOWTITLE);
00291 tvshowid = parseInt(node, TVSHOWID);
00292 uniqueid = getStringMap(node, UNIQUEID);
00293 votes = parseString(node, VOTES);
00294 writer = getStringArray(node, WRITER);
00295 }
00296
00297 @Override
00298 public JsonNode toJsonNode() {
00299 final ObjectNode node = (ObjectNode)super.toJsonNode();
00300 final ArrayNode castArray = OM.createArrayNode();
00301 for (Cast item : cast) {
00302 castArray.add(item.toJsonNode());
00303 }
00304 node.put(CAST, castArray);
00305 node.put(EPISODE, episode);
00306 node.put(EPISODEID, episodeid);
00307 node.put(FIRSTAIRED, firstaired);
00308 node.put(ORIGINALTITLE, originaltitle);
00309 node.put(PRODUCTIONCODE, productioncode);
00310 node.put(RATING, rating);
00311 node.put(SEASON, season);
00312 node.put(SHOWTITLE, showtitle);
00313 node.put(TVSHOWID, tvshowid);
00314 final ObjectNode uniqueidMap = OM.createObjectNode();
00315 for (String key : uniqueid.values()) {
00316 uniqueidMap.put(key, uniqueid.get(key));
00317 }
00318 node.put(UNIQUEID, uniqueidMap);
00319 node.put(VOTES, votes);
00320 final ArrayNode writerArray = OM.createArrayNode();
00321 for (String item : writer) {
00322 writerArray.add(item);
00323 }
00324 node.put(WRITER, writerArray);
00325 return node;
00326 }
00327
00333 static List<EpisodeDetail> getVideoModelEpisodeDetailList(JsonNode node, String key) {
00334 if (node.has(key)) {
00335 final ArrayNode a = (ArrayNode)node.get(key);
00336 final List<EpisodeDetail> l = new ArrayList<EpisodeDetail>(a.size());
00337 for (int i = 0; i < a.size(); i++) {
00338 l.add(new EpisodeDetail((JsonNode)a.get(i)));
00339 }
00340 return l;
00341 }
00342 return new ArrayList<EpisodeDetail>(0);
00343 }
00344
00350 @Override
00351 public void writeToParcel(Parcel parcel, int flags) {
00352 super.writeToParcel(parcel, flags);
00353 parcel.writeInt(cast.size());
00354 for (Cast item : cast) {
00355 parcel.writeParcelable(item, flags);
00356 }
00357 parcel.writeValue(episode);
00358 parcel.writeValue(episodeid);
00359 parcel.writeValue(firstaired);
00360 parcel.writeValue(originaltitle);
00361 parcel.writeValue(productioncode);
00362 parcel.writeValue(rating);
00363 parcel.writeValue(season);
00364 parcel.writeValue(showtitle);
00365 parcel.writeValue(tvshowid);
00366 parcel.writeInt(uniqueid.size());
00367 for (String key : uniqueid.values()) {
00368 parcel.writeValue(key);
00369 parcel.writeValue(uniqueid.get(key));
00370 }
00371 parcel.writeValue(votes);
00372 parcel.writeInt(writer.size());
00373 for (String item : writer) {
00374 parcel.writeValue(item);
00375 }
00376 }
00377
00381 protected EpisodeDetail(Parcel parcel) {
00382 super(parcel);
00383 final int castSize = parcel.readInt();
00384 cast = new ArrayList<Cast>(castSize);
00385 for (int i = 0; i < castSize; i++) {
00386 cast.add(parcel.<Cast>readParcelable(Cast.class.getClassLoader()));
00387 }
00388 episode = parcel.readInt();
00389 episodeid = parcel.readInt();
00390 firstaired = parcel.readString();
00391 originaltitle = parcel.readString();
00392 productioncode = parcel.readString();
00393 rating = parcel.readDouble();
00394 season = parcel.readInt();
00395 showtitle = parcel.readString();
00396 tvshowid = parcel.readInt();
00397 final int uniqueidSize = parcel.readInt();
00398 uniqueid = new HashMap<String, String>();
00399 for (int i = 0; i < uniqueidSize; i++) {
00400 uniqueid.put(parcel.readString(), parcel.readString());
00401 }
00402 votes = parcel.readString();
00403 final int writerSize = parcel.readInt();
00404 writer = new ArrayList<String>(writerSize);
00405 for (int i = 0; i < writerSize; i++) {
00406 writer.add(parcel.readString());
00407 }
00408 }
00409
00413 public static final Parcelable.Creator<EpisodeDetail> CREATOR = new Parcelable.Creator<EpisodeDetail>() {
00414 @Override
00415 public EpisodeDetail createFromParcel(Parcel parcel) {
00416 return new EpisodeDetail(parcel);
00417 }
00418 @Override
00419 public EpisodeDetail[] newArray(int n) {
00420 return new EpisodeDetail[n];
00421 }
00422 };
00423
00424 @Override
00425 public int describeContents() {
00426 return 0;
00427 }
00428 }
00429
00436 public static class FileDetail extends ItemDetail {
00437 public final static String API_TYPE = "Video.Details.File";
00438
00439
00440 public static final String DIRECTOR = "director";
00441 public static final String RESUME = "resume";
00442 public static final String RUNTIME = "runtime";
00443 public static final String STREAMDETAILS = "streamdetails";
00444
00445
00446 public final List<String> director;
00447 public final Resume resume;
00448 public final Integer runtime;
00449 public final Streams streamdetails;
00450
00455 public FileDetail(JsonNode node) {
00456 super(node);
00457 director = getStringArray(node, DIRECTOR);
00458 resume = node.has(RESUME) ? new Resume(node.get(RESUME)) : null;
00459 runtime = parseInt(node, RUNTIME);
00460 streamdetails = node.has(STREAMDETAILS) ? new Streams(node.get(STREAMDETAILS)) : null;
00461 }
00462
00463 @Override
00464 public JsonNode toJsonNode() {
00465 final ObjectNode node = (ObjectNode)super.toJsonNode();
00466 final ArrayNode directorArray = OM.createArrayNode();
00467 for (String item : director) {
00468 directorArray.add(item);
00469 }
00470 node.put(DIRECTOR, directorArray);
00471 node.put(RESUME, resume.toJsonNode());
00472 node.put(RUNTIME, runtime);
00473 node.put(STREAMDETAILS, streamdetails.toJsonNode());
00474 return node;
00475 }
00476
00482 static List<FileDetail> getVideoModelFileDetailList(JsonNode node, String key) {
00483 if (node.has(key)) {
00484 final ArrayNode a = (ArrayNode)node.get(key);
00485 final List<FileDetail> l = new ArrayList<FileDetail>(a.size());
00486 for (int i = 0; i < a.size(); i++) {
00487 l.add(new FileDetail((JsonNode)a.get(i)));
00488 }
00489 return l;
00490 }
00491 return new ArrayList<FileDetail>(0);
00492 }
00493
00499 @Override
00500 public void writeToParcel(Parcel parcel, int flags) {
00501 super.writeToParcel(parcel, flags);
00502 parcel.writeInt(director.size());
00503 for (String item : director) {
00504 parcel.writeValue(item);
00505 }
00506 parcel.writeValue(resume);
00507 parcel.writeValue(runtime);
00508 parcel.writeValue(streamdetails);
00509 }
00510
00514 protected FileDetail(Parcel parcel) {
00515 super(parcel);
00516 final int directorSize = parcel.readInt();
00517 director = new ArrayList<String>(directorSize);
00518 for (int i = 0; i < directorSize; i++) {
00519 director.add(parcel.readString());
00520 }
00521 resume = parcel.<Resume>readParcelable(Resume.class.getClassLoader());
00522 runtime = parcel.readInt();
00523 streamdetails = parcel.<Streams>readParcelable(Streams.class.getClassLoader());
00524 }
00525
00529 public static final Parcelable.Creator<FileDetail> CREATOR = new Parcelable.Creator<FileDetail>() {
00530 @Override
00531 public FileDetail createFromParcel(Parcel parcel) {
00532 return new FileDetail(parcel);
00533 }
00534 @Override
00535 public FileDetail[] newArray(int n) {
00536 return new FileDetail[n];
00537 }
00538 };
00539
00540 @Override
00541 public int describeContents() {
00542 return 0;
00543 }
00544 }
00545
00552 public static class ItemDetail extends MediaDetail {
00553 public final static String API_TYPE = "Video.Details.Item";
00554
00555
00556 public static final String DATEADDED = "dateadded";
00557 public static final String FILE = "file";
00558 public static final String LASTPLAYED = "lastplayed";
00559 public static final String PLOT = "plot";
00560
00561
00562 public final String dateadded;
00563 public final String file;
00564 public final String lastplayed;
00565 public final String plot;
00566
00571 public ItemDetail(JsonNode node) {
00572 super(node);
00573 dateadded = parseString(node, DATEADDED);
00574 file = parseString(node, FILE);
00575 lastplayed = parseString(node, LASTPLAYED);
00576 plot = parseString(node, PLOT);
00577 }
00578
00579 @Override
00580 public JsonNode toJsonNode() {
00581 final ObjectNode node = (ObjectNode)super.toJsonNode();
00582 node.put(DATEADDED, dateadded);
00583 node.put(FILE, file);
00584 node.put(LASTPLAYED, lastplayed);
00585 node.put(PLOT, plot);
00586 return node;
00587 }
00588
00594 static List<ItemDetail> getVideoModelItemDetailList(JsonNode node, String key) {
00595 if (node.has(key)) {
00596 final ArrayNode a = (ArrayNode)node.get(key);
00597 final List<ItemDetail> l = new ArrayList<ItemDetail>(a.size());
00598 for (int i = 0; i < a.size(); i++) {
00599 l.add(new ItemDetail((JsonNode)a.get(i)));
00600 }
00601 return l;
00602 }
00603 return new ArrayList<ItemDetail>(0);
00604 }
00605
00611 @Override
00612 public void writeToParcel(Parcel parcel, int flags) {
00613 super.writeToParcel(parcel, flags);
00614 parcel.writeValue(dateadded);
00615 parcel.writeValue(file);
00616 parcel.writeValue(lastplayed);
00617 parcel.writeValue(plot);
00618 }
00619
00623 protected ItemDetail(Parcel parcel) {
00624 super(parcel);
00625 dateadded = parcel.readString();
00626 file = parcel.readString();
00627 lastplayed = parcel.readString();
00628 plot = parcel.readString();
00629 }
00630
00634 public static final Parcelable.Creator<ItemDetail> CREATOR = new Parcelable.Creator<ItemDetail>() {
00635 @Override
00636 public ItemDetail createFromParcel(Parcel parcel) {
00637 return new ItemDetail(parcel);
00638 }
00639 @Override
00640 public ItemDetail[] newArray(int n) {
00641 return new ItemDetail[n];
00642 }
00643 };
00644
00645 @Override
00646 public int describeContents() {
00647 return 0;
00648 }
00649 }
00650
00657 public static class MediaDetail extends BaseDetail {
00658 public final static String API_TYPE = "Video.Details.Media";
00659
00660
00661 public static final String TITLE = "title";
00662
00663
00664 public final String title;
00665
00670 public MediaDetail(JsonNode node) {
00671 super(node);
00672 title = parseString(node, TITLE);
00673 }
00674
00675 @Override
00676 public JsonNode toJsonNode() {
00677 final ObjectNode node = (ObjectNode)super.toJsonNode();
00678 node.put(TITLE, title);
00679 return node;
00680 }
00681
00687 static List<MediaDetail> getVideoModelMediaDetailList(JsonNode node, String key) {
00688 if (node.has(key)) {
00689 final ArrayNode a = (ArrayNode)node.get(key);
00690 final List<MediaDetail> l = new ArrayList<MediaDetail>(a.size());
00691 for (int i = 0; i < a.size(); i++) {
00692 l.add(new MediaDetail((JsonNode)a.get(i)));
00693 }
00694 return l;
00695 }
00696 return new ArrayList<MediaDetail>(0);
00697 }
00698
00704 @Override
00705 public void writeToParcel(Parcel parcel, int flags) {
00706 super.writeToParcel(parcel, flags);
00707 parcel.writeValue(title);
00708 }
00709
00713 protected MediaDetail(Parcel parcel) {
00714 super(parcel);
00715 title = parcel.readString();
00716 }
00717
00721 public static final Parcelable.Creator<MediaDetail> CREATOR = new Parcelable.Creator<MediaDetail>() {
00722 @Override
00723 public MediaDetail createFromParcel(Parcel parcel) {
00724 return new MediaDetail(parcel);
00725 }
00726 @Override
00727 public MediaDetail[] newArray(int n) {
00728 return new MediaDetail[n];
00729 }
00730 };
00731
00732 @Override
00733 public int describeContents() {
00734 return 0;
00735 }
00736 }
00737
00744 public static class MovieDetail extends FileDetail {
00745 public final static String API_TYPE = "Video.Details.Movie";
00746
00747
00748 public static final String CAST = "cast";
00749 public static final String COUNTRY = "country";
00750 public static final String GENRE = "genre";
00751 public static final String IMDBNUMBER = "imdbnumber";
00752 public static final String MOVIEID = "movieid";
00753 public static final String MPAA = "mpaa";
00754 public static final String ORIGINALTITLE = "originaltitle";
00755 public static final String PLOTOUTLINE = "plotoutline";
00756 public static final String RATING = "rating";
00757 public static final String SET = "set";
00758 public static final String SETID = "setid";
00759 public static final String SHOWLINK = "showlink";
00760 public static final String SORTTITLE = "sorttitle";
00761 public static final String STUDIO = "studio";
00762 public static final String TAG = "tag";
00763 public static final String TAGLINE = "tagline";
00764 public static final String TOP250 = "top250";
00765 public static final String TRAILER = "trailer";
00766 public static final String VOTES = "votes";
00767 public static final String WRITER = "writer";
00768 public static final String YEAR = "year";
00769
00770
00771 public final List<Cast> cast;
00772 public final List<String> country;
00773 public final List<String> genre;
00774 public final String imdbnumber;
00775 public final Integer movieid;
00776 public final String mpaa;
00777 public final String originaltitle;
00778 public final String plotoutline;
00779 public final Double rating;
00780 public final String set;
00781 public final Integer setid;
00782 public final List<String> showlink;
00783 public final String sorttitle;
00784 public final List<String> studio;
00785 public final List<String> tag;
00786 public final String tagline;
00787 public final Integer top250;
00788 public final String trailer;
00789 public final String votes;
00790 public final List<String> writer;
00791 public final Integer year;
00792
00797 public MovieDetail(JsonNode node) {
00798 super(node);
00799 cast = Cast.getVideoModelCastList(node, CAST);
00800 country = getStringArray(node, COUNTRY);
00801 genre = getStringArray(node, GENRE);
00802 imdbnumber = parseString(node, IMDBNUMBER);
00803 movieid = parseInt(node, MOVIEID);
00804 mpaa = parseString(node, MPAA);
00805 originaltitle = parseString(node, ORIGINALTITLE);
00806 plotoutline = parseString(node, PLOTOUTLINE);
00807 rating = parseDouble(node, RATING);
00808 set = parseString(node, SET);
00809 setid = parseInt(node, SETID);
00810 showlink = getStringArray(node, SHOWLINK);
00811 sorttitle = parseString(node, SORTTITLE);
00812 studio = getStringArray(node, STUDIO);
00813 tag = getStringArray(node, TAG);
00814 tagline = parseString(node, TAGLINE);
00815 top250 = parseInt(node, TOP250);
00816 trailer = parseString(node, TRAILER);
00817 votes = parseString(node, VOTES);
00818 writer = getStringArray(node, WRITER);
00819 year = parseInt(node, YEAR);
00820 }
00821
00822 @Override
00823 public JsonNode toJsonNode() {
00824 final ObjectNode node = (ObjectNode)super.toJsonNode();
00825 final ArrayNode castArray = OM.createArrayNode();
00826 for (Cast item : cast) {
00827 castArray.add(item.toJsonNode());
00828 }
00829 node.put(CAST, castArray);
00830 final ArrayNode countryArray = OM.createArrayNode();
00831 for (String item : country) {
00832 countryArray.add(item);
00833 }
00834 node.put(COUNTRY, countryArray);
00835 final ArrayNode genreArray = OM.createArrayNode();
00836 for (String item : genre) {
00837 genreArray.add(item);
00838 }
00839 node.put(GENRE, genreArray);
00840 node.put(IMDBNUMBER, imdbnumber);
00841 node.put(MOVIEID, movieid);
00842 node.put(MPAA, mpaa);
00843 node.put(ORIGINALTITLE, originaltitle);
00844 node.put(PLOTOUTLINE, plotoutline);
00845 node.put(RATING, rating);
00846 node.put(SET, set);
00847 node.put(SETID, setid);
00848 final ArrayNode showlinkArray = OM.createArrayNode();
00849 for (String item : showlink) {
00850 showlinkArray.add(item);
00851 }
00852 node.put(SHOWLINK, showlinkArray);
00853 node.put(SORTTITLE, sorttitle);
00854 final ArrayNode studioArray = OM.createArrayNode();
00855 for (String item : studio) {
00856 studioArray.add(item);
00857 }
00858 node.put(STUDIO, studioArray);
00859 final ArrayNode tagArray = OM.createArrayNode();
00860 for (String item : tag) {
00861 tagArray.add(item);
00862 }
00863 node.put(TAG, tagArray);
00864 node.put(TAGLINE, tagline);
00865 node.put(TOP250, top250);
00866 node.put(TRAILER, trailer);
00867 node.put(VOTES, votes);
00868 final ArrayNode writerArray = OM.createArrayNode();
00869 for (String item : writer) {
00870 writerArray.add(item);
00871 }
00872 node.put(WRITER, writerArray);
00873 node.put(YEAR, year);
00874 return node;
00875 }
00876
00882 static List<MovieDetail> getVideoModelMovieDetailList(JsonNode node, String key) {
00883 if (node.has(key)) {
00884 final ArrayNode a = (ArrayNode)node.get(key);
00885 final List<MovieDetail> l = new ArrayList<MovieDetail>(a.size());
00886 for (int i = 0; i < a.size(); i++) {
00887 l.add(new MovieDetail((JsonNode)a.get(i)));
00888 }
00889 return l;
00890 }
00891 return new ArrayList<MovieDetail>(0);
00892 }
00893
00899 @Override
00900 public void writeToParcel(Parcel parcel, int flags) {
00901 super.writeToParcel(parcel, flags);
00902 parcel.writeInt(cast.size());
00903 for (Cast item : cast) {
00904 parcel.writeParcelable(item, flags);
00905 }
00906 parcel.writeInt(country.size());
00907 for (String item : country) {
00908 parcel.writeValue(item);
00909 }
00910 parcel.writeInt(genre.size());
00911 for (String item : genre) {
00912 parcel.writeValue(item);
00913 }
00914 parcel.writeValue(imdbnumber);
00915 parcel.writeValue(movieid);
00916 parcel.writeValue(mpaa);
00917 parcel.writeValue(originaltitle);
00918 parcel.writeValue(plotoutline);
00919 parcel.writeValue(rating);
00920 parcel.writeValue(set);
00921 parcel.writeValue(setid);
00922 parcel.writeInt(showlink.size());
00923 for (String item : showlink) {
00924 parcel.writeValue(item);
00925 }
00926 parcel.writeValue(sorttitle);
00927 parcel.writeInt(studio.size());
00928 for (String item : studio) {
00929 parcel.writeValue(item);
00930 }
00931 parcel.writeInt(tag.size());
00932 for (String item : tag) {
00933 parcel.writeValue(item);
00934 }
00935 parcel.writeValue(tagline);
00936 parcel.writeValue(top250);
00937 parcel.writeValue(trailer);
00938 parcel.writeValue(votes);
00939 parcel.writeInt(writer.size());
00940 for (String item : writer) {
00941 parcel.writeValue(item);
00942 }
00943 parcel.writeValue(year);
00944 }
00945
00949 protected MovieDetail(Parcel parcel) {
00950 super(parcel);
00951 final int castSize = parcel.readInt();
00952 cast = new ArrayList<Cast>(castSize);
00953 for (int i = 0; i < castSize; i++) {
00954 cast.add(parcel.<Cast>readParcelable(Cast.class.getClassLoader()));
00955 }
00956 final int countrySize = parcel.readInt();
00957 country = new ArrayList<String>(countrySize);
00958 for (int i = 0; i < countrySize; i++) {
00959 country.add(parcel.readString());
00960 }
00961 final int genreSize = parcel.readInt();
00962 genre = new ArrayList<String>(genreSize);
00963 for (int i = 0; i < genreSize; i++) {
00964 genre.add(parcel.readString());
00965 }
00966 imdbnumber = parcel.readString();
00967 movieid = parcel.readInt();
00968 mpaa = parcel.readString();
00969 originaltitle = parcel.readString();
00970 plotoutline = parcel.readString();
00971 rating = parcel.readDouble();
00972 set = parcel.readString();
00973 setid = parcel.readInt();
00974 final int showlinkSize = parcel.readInt();
00975 showlink = new ArrayList<String>(showlinkSize);
00976 for (int i = 0; i < showlinkSize; i++) {
00977 showlink.add(parcel.readString());
00978 }
00979 sorttitle = parcel.readString();
00980 final int studioSize = parcel.readInt();
00981 studio = new ArrayList<String>(studioSize);
00982 for (int i = 0; i < studioSize; i++) {
00983 studio.add(parcel.readString());
00984 }
00985 final int tagSize = parcel.readInt();
00986 tag = new ArrayList<String>(tagSize);
00987 for (int i = 0; i < tagSize; i++) {
00988 tag.add(parcel.readString());
00989 }
00990 tagline = parcel.readString();
00991 top250 = parcel.readInt();
00992 trailer = parcel.readString();
00993 votes = parcel.readString();
00994 final int writerSize = parcel.readInt();
00995 writer = new ArrayList<String>(writerSize);
00996 for (int i = 0; i < writerSize; i++) {
00997 writer.add(parcel.readString());
00998 }
00999 year = parcel.readInt();
01000 }
01001
01005 public static final Parcelable.Creator<MovieDetail> CREATOR = new Parcelable.Creator<MovieDetail>() {
01006 @Override
01007 public MovieDetail createFromParcel(Parcel parcel) {
01008 return new MovieDetail(parcel);
01009 }
01010 @Override
01011 public MovieDetail[] newArray(int n) {
01012 return new MovieDetail[n];
01013 }
01014 };
01015
01016 @Override
01017 public int describeContents() {
01018 return 0;
01019 }
01020 }
01021
01028 public static class MovieSetDetail extends MediaDetail {
01029 public final static String API_TYPE = "Video.Details.MovieSet";
01030
01031
01032 public static final String SETID = "setid";
01033
01034
01035 public final Integer setid;
01036
01041 public MovieSetDetail(JsonNode node) {
01042 super(node);
01043 setid = parseInt(node, SETID);
01044 }
01045
01046 @Override
01047 public JsonNode toJsonNode() {
01048 final ObjectNode node = (ObjectNode)super.toJsonNode();
01049 node.put(SETID, setid);
01050 return node;
01051 }
01052
01058 static List<MovieSetDetail> getVideoModelMovieSetDetailList(JsonNode node, String key) {
01059 if (node.has(key)) {
01060 final ArrayNode a = (ArrayNode)node.get(key);
01061 final List<MovieSetDetail> l = new ArrayList<MovieSetDetail>(a.size());
01062 for (int i = 0; i < a.size(); i++) {
01063 l.add(new MovieSetDetail((JsonNode)a.get(i)));
01064 }
01065 return l;
01066 }
01067 return new ArrayList<MovieSetDetail>(0);
01068 }
01069
01075 @Override
01076 public void writeToParcel(Parcel parcel, int flags) {
01077 super.writeToParcel(parcel, flags);
01078 parcel.writeValue(setid);
01079 }
01080
01084 protected MovieSetDetail(Parcel parcel) {
01085 super(parcel);
01086 setid = parcel.readInt();
01087 }
01088
01092 public static final Parcelable.Creator<MovieSetDetail> CREATOR = new Parcelable.Creator<MovieSetDetail>() {
01093 @Override
01094 public MovieSetDetail createFromParcel(Parcel parcel) {
01095 return new MovieSetDetail(parcel);
01096 }
01097 @Override
01098 public MovieSetDetail[] newArray(int n) {
01099 return new MovieSetDetail[n];
01100 }
01101 };
01102
01103 @Override
01104 public int describeContents() {
01105 return 0;
01106 }
01107 }
01108
01115 public static class MovieSetExtendedDetail extends MovieSetDetail {
01116 public final static String API_TYPE = "Video.Details.MovieSet.Extended";
01117
01118
01119 public static final String LIMITS = "limits";
01120 public static final String MOVIES = "movies";
01121
01122
01123 public final ListModel.LimitsReturned limits;
01124 public final List<MovieDetail> movies;
01125
01130 public MovieSetExtendedDetail(JsonNode node) {
01131 super(node);
01132 limits = node.has(LIMITS) ? new ListModel.LimitsReturned(node.get(LIMITS)) : null;
01133 movies = MovieDetail.getVideoModelMovieDetailList(node, MOVIES);
01134 }
01135
01136 @Override
01137 public JsonNode toJsonNode() {
01138 final ObjectNode node = (ObjectNode)super.toJsonNode();
01139 node.put(LIMITS, limits.toJsonNode());
01140 final ArrayNode moviesArray = OM.createArrayNode();
01141 for (MovieDetail item : movies) {
01142 moviesArray.add(item.toJsonNode());
01143 }
01144 node.put(MOVIES, moviesArray);
01145 return node;
01146 }
01147
01153 static List<MovieSetExtendedDetail> getVideoModelMovieSetExtendedDetailList(JsonNode node, String key) {
01154 if (node.has(key)) {
01155 final ArrayNode a = (ArrayNode)node.get(key);
01156 final List<MovieSetExtendedDetail> l = new ArrayList<MovieSetExtendedDetail>(a.size());
01157 for (int i = 0; i < a.size(); i++) {
01158 l.add(new MovieSetExtendedDetail((JsonNode)a.get(i)));
01159 }
01160 return l;
01161 }
01162 return new ArrayList<MovieSetExtendedDetail>(0);
01163 }
01164
01170 @Override
01171 public void writeToParcel(Parcel parcel, int flags) {
01172 super.writeToParcel(parcel, flags);
01173 parcel.writeValue(limits);
01174 parcel.writeInt(movies.size());
01175 for (MovieDetail item : movies) {
01176 parcel.writeParcelable(item, flags);
01177 }
01178 }
01179
01183 protected MovieSetExtendedDetail(Parcel parcel) {
01184 super(parcel);
01185 limits = parcel.<ListModel.LimitsReturned>readParcelable(ListModel.LimitsReturned.class.getClassLoader());
01186 final int moviesSize = parcel.readInt();
01187 movies = new ArrayList<MovieDetail>(moviesSize);
01188 for (int i = 0; i < moviesSize; i++) {
01189 movies.add(parcel.<MovieDetail>readParcelable(MovieDetail.class.getClassLoader()));
01190 }
01191 }
01192
01196 public static final Parcelable.Creator<MovieSetExtendedDetail> CREATOR = new Parcelable.Creator<MovieSetExtendedDetail>() {
01197 @Override
01198 public MovieSetExtendedDetail createFromParcel(Parcel parcel) {
01199 return new MovieSetExtendedDetail(parcel);
01200 }
01201 @Override
01202 public MovieSetExtendedDetail[] newArray(int n) {
01203 return new MovieSetExtendedDetail[n];
01204 }
01205 };
01206
01207 @Override
01208 public int describeContents() {
01209 return 0;
01210 }
01211 }
01212
01219 public static class MusicVideoDetail extends FileDetail {
01220 public final static String API_TYPE = "Video.Details.MusicVideo";
01221
01222
01223 public static final String ALBUM = "album";
01224 public static final String ARTIST = "artist";
01225 public static final String GENRE = "genre";
01226 public static final String MUSICVIDEOID = "musicvideoid";
01227 public static final String STUDIO = "studio";
01228 public static final String TAG = "tag";
01229 public static final String TRACK = "track";
01230 public static final String YEAR = "year";
01231
01232
01233 public final String album;
01234 public final List<String> artist;
01235 public final List<String> genre;
01236 public final Integer musicvideoid;
01237 public final List<String> studio;
01238 public final List<String> tag;
01239 public final Integer track;
01240 public final Integer year;
01241
01246 public MusicVideoDetail(JsonNode node) {
01247 super(node);
01248 album = parseString(node, ALBUM);
01249 artist = getStringArray(node, ARTIST);
01250 genre = getStringArray(node, GENRE);
01251 musicvideoid = parseInt(node, MUSICVIDEOID);
01252 studio = getStringArray(node, STUDIO);
01253 tag = getStringArray(node, TAG);
01254 track = parseInt(node, TRACK);
01255 year = parseInt(node, YEAR);
01256 }
01257
01258 @Override
01259 public JsonNode toJsonNode() {
01260 final ObjectNode node = (ObjectNode)super.toJsonNode();
01261 node.put(ALBUM, album);
01262 final ArrayNode artistArray = OM.createArrayNode();
01263 for (String item : artist) {
01264 artistArray.add(item);
01265 }
01266 node.put(ARTIST, artistArray);
01267 final ArrayNode genreArray = OM.createArrayNode();
01268 for (String item : genre) {
01269 genreArray.add(item);
01270 }
01271 node.put(GENRE, genreArray);
01272 node.put(MUSICVIDEOID, musicvideoid);
01273 final ArrayNode studioArray = OM.createArrayNode();
01274 for (String item : studio) {
01275 studioArray.add(item);
01276 }
01277 node.put(STUDIO, studioArray);
01278 final ArrayNode tagArray = OM.createArrayNode();
01279 for (String item : tag) {
01280 tagArray.add(item);
01281 }
01282 node.put(TAG, tagArray);
01283 node.put(TRACK, track);
01284 node.put(YEAR, year);
01285 return node;
01286 }
01287
01293 static List<MusicVideoDetail> getVideoModelMusicVideoDetailList(JsonNode node, String key) {
01294 if (node.has(key)) {
01295 final ArrayNode a = (ArrayNode)node.get(key);
01296 final List<MusicVideoDetail> l = new ArrayList<MusicVideoDetail>(a.size());
01297 for (int i = 0; i < a.size(); i++) {
01298 l.add(new MusicVideoDetail((JsonNode)a.get(i)));
01299 }
01300 return l;
01301 }
01302 return new ArrayList<MusicVideoDetail>(0);
01303 }
01304
01310 @Override
01311 public void writeToParcel(Parcel parcel, int flags) {
01312 super.writeToParcel(parcel, flags);
01313 parcel.writeValue(album);
01314 parcel.writeInt(artist.size());
01315 for (String item : artist) {
01316 parcel.writeValue(item);
01317 }
01318 parcel.writeInt(genre.size());
01319 for (String item : genre) {
01320 parcel.writeValue(item);
01321 }
01322 parcel.writeValue(musicvideoid);
01323 parcel.writeInt(studio.size());
01324 for (String item : studio) {
01325 parcel.writeValue(item);
01326 }
01327 parcel.writeInt(tag.size());
01328 for (String item : tag) {
01329 parcel.writeValue(item);
01330 }
01331 parcel.writeValue(track);
01332 parcel.writeValue(year);
01333 }
01334
01338 protected MusicVideoDetail(Parcel parcel) {
01339 super(parcel);
01340 album = parcel.readString();
01341 final int artistSize = parcel.readInt();
01342 artist = new ArrayList<String>(artistSize);
01343 for (int i = 0; i < artistSize; i++) {
01344 artist.add(parcel.readString());
01345 }
01346 final int genreSize = parcel.readInt();
01347 genre = new ArrayList<String>(genreSize);
01348 for (int i = 0; i < genreSize; i++) {
01349 genre.add(parcel.readString());
01350 }
01351 musicvideoid = parcel.readInt();
01352 final int studioSize = parcel.readInt();
01353 studio = new ArrayList<String>(studioSize);
01354 for (int i = 0; i < studioSize; i++) {
01355 studio.add(parcel.readString());
01356 }
01357 final int tagSize = parcel.readInt();
01358 tag = new ArrayList<String>(tagSize);
01359 for (int i = 0; i < tagSize; i++) {
01360 tag.add(parcel.readString());
01361 }
01362 track = parcel.readInt();
01363 year = parcel.readInt();
01364 }
01365
01369 public static final Parcelable.Creator<MusicVideoDetail> CREATOR = new Parcelable.Creator<MusicVideoDetail>() {
01370 @Override
01371 public MusicVideoDetail createFromParcel(Parcel parcel) {
01372 return new MusicVideoDetail(parcel);
01373 }
01374 @Override
01375 public MusicVideoDetail[] newArray(int n) {
01376 return new MusicVideoDetail[n];
01377 }
01378 };
01379
01380 @Override
01381 public int describeContents() {
01382 return 0;
01383 }
01384 }
01385
01392 public static class SeasonDetail extends BaseDetail {
01393 public final static String API_TYPE = "Video.Details.Season";
01394
01395
01396 public static final String EPISODE = "episode";
01397 public static final String SEASON = "season";
01398 public static final String SHOWTITLE = "showtitle";
01399 public static final String TVSHOWID = "tvshowid";
01400 public static final String WATCHEDEPISODES = "watchedepisodes";
01401
01402
01403 public final Integer episode;
01404 public final Integer season;
01405 public final String showtitle;
01406 public final Integer tvshowid;
01407 public final Integer watchedepisodes;
01408
01413 public SeasonDetail(JsonNode node) {
01414 super(node);
01415 episode = parseInt(node, EPISODE);
01416 season = node.get(SEASON).getIntValue();
01417 showtitle = parseString(node, SHOWTITLE);
01418 tvshowid = parseInt(node, TVSHOWID);
01419 watchedepisodes = parseInt(node, WATCHEDEPISODES);
01420 }
01421
01422 @Override
01423 public JsonNode toJsonNode() {
01424 final ObjectNode node = (ObjectNode)super.toJsonNode();
01425 node.put(EPISODE, episode);
01426 node.put(SEASON, season);
01427 node.put(SHOWTITLE, showtitle);
01428 node.put(TVSHOWID, tvshowid);
01429 node.put(WATCHEDEPISODES, watchedepisodes);
01430 return node;
01431 }
01432
01438 static List<SeasonDetail> getVideoModelSeasonDetailList(JsonNode node, String key) {
01439 if (node.has(key)) {
01440 final ArrayNode a = (ArrayNode)node.get(key);
01441 final List<SeasonDetail> l = new ArrayList<SeasonDetail>(a.size());
01442 for (int i = 0; i < a.size(); i++) {
01443 l.add(new SeasonDetail((JsonNode)a.get(i)));
01444 }
01445 return l;
01446 }
01447 return new ArrayList<SeasonDetail>(0);
01448 }
01449
01455 @Override
01456 public void writeToParcel(Parcel parcel, int flags) {
01457 super.writeToParcel(parcel, flags);
01458 parcel.writeValue(episode);
01459 parcel.writeValue(season);
01460 parcel.writeValue(showtitle);
01461 parcel.writeValue(tvshowid);
01462 parcel.writeValue(watchedepisodes);
01463 }
01464
01468 protected SeasonDetail(Parcel parcel) {
01469 super(parcel);
01470 episode = parcel.readInt();
01471 season = parcel.readInt();
01472 showtitle = parcel.readString();
01473 tvshowid = parcel.readInt();
01474 watchedepisodes = parcel.readInt();
01475 }
01476
01480 public static final Parcelable.Creator<SeasonDetail> CREATOR = new Parcelable.Creator<SeasonDetail>() {
01481 @Override
01482 public SeasonDetail createFromParcel(Parcel parcel) {
01483 return new SeasonDetail(parcel);
01484 }
01485 @Override
01486 public SeasonDetail[] newArray(int n) {
01487 return new SeasonDetail[n];
01488 }
01489 };
01490
01491 @Override
01492 public int describeContents() {
01493 return 0;
01494 }
01495 }
01496
01503 public static class TVShowDetail extends ItemDetail {
01504 public final static String API_TYPE = "Video.Details.TVShow";
01505
01506
01507 public static final String CAST = "cast";
01508 public static final String EPISODE = "episode";
01509 public static final String EPISODEGUIDE = "episodeguide";
01510 public static final String GENRE = "genre";
01511 public static final String IMDBNUMBER = "imdbnumber";
01512 public static final String MPAA = "mpaa";
01513 public static final String ORIGINALTITLE = "originaltitle";
01514 public static final String PREMIERED = "premiered";
01515 public static final String RATING = "rating";
01516 public static final String SEASON = "season";
01517 public static final String SORTTITLE = "sorttitle";
01518 public static final String STUDIO = "studio";
01519 public static final String TAG = "tag";
01520 public static final String TVSHOWID = "tvshowid";
01521 public static final String VOTES = "votes";
01522 public static final String WATCHEDEPISODES = "watchedepisodes";
01523 public static final String YEAR = "year";
01524
01525
01526 public final List<Cast> cast;
01527 public final Integer episode;
01528 public final String episodeguide;
01529 public final List<String> genre;
01530 public final String imdbnumber;
01531 public final String mpaa;
01532 public final String originaltitle;
01533 public final String premiered;
01534 public final Double rating;
01535 public final Integer season;
01536 public final String sorttitle;
01537 public final List<String> studio;
01538 public final List<String> tag;
01539 public final Integer tvshowid;
01540 public final String votes;
01541 public final Integer watchedepisodes;
01542 public final Integer year;
01543
01548 public TVShowDetail(JsonNode node) {
01549 super(node);
01550 cast = Cast.getVideoModelCastList(node, CAST);
01551 episode = parseInt(node, EPISODE);
01552 episodeguide = parseString(node, EPISODEGUIDE);
01553 genre = getStringArray(node, GENRE);
01554 imdbnumber = parseString(node, IMDBNUMBER);
01555 mpaa = parseString(node, MPAA);
01556 originaltitle = parseString(node, ORIGINALTITLE);
01557 premiered = parseString(node, PREMIERED);
01558 rating = parseDouble(node, RATING);
01559 season = parseInt(node, SEASON);
01560 sorttitle = parseString(node, SORTTITLE);
01561 studio = getStringArray(node, STUDIO);
01562 tag = getStringArray(node, TAG);
01563 tvshowid = parseInt(node, TVSHOWID);
01564 votes = parseString(node, VOTES);
01565 watchedepisodes = parseInt(node, WATCHEDEPISODES);
01566 year = parseInt(node, YEAR);
01567 }
01568
01569 @Override
01570 public JsonNode toJsonNode() {
01571 final ObjectNode node = (ObjectNode)super.toJsonNode();
01572 final ArrayNode castArray = OM.createArrayNode();
01573 for (Cast item : cast) {
01574 castArray.add(item.toJsonNode());
01575 }
01576 node.put(CAST, castArray);
01577 node.put(EPISODE, episode);
01578 node.put(EPISODEGUIDE, episodeguide);
01579 final ArrayNode genreArray = OM.createArrayNode();
01580 for (String item : genre) {
01581 genreArray.add(item);
01582 }
01583 node.put(GENRE, genreArray);
01584 node.put(IMDBNUMBER, imdbnumber);
01585 node.put(MPAA, mpaa);
01586 node.put(ORIGINALTITLE, originaltitle);
01587 node.put(PREMIERED, premiered);
01588 node.put(RATING, rating);
01589 node.put(SEASON, season);
01590 node.put(SORTTITLE, sorttitle);
01591 final ArrayNode studioArray = OM.createArrayNode();
01592 for (String item : studio) {
01593 studioArray.add(item);
01594 }
01595 node.put(STUDIO, studioArray);
01596 final ArrayNode tagArray = OM.createArrayNode();
01597 for (String item : tag) {
01598 tagArray.add(item);
01599 }
01600 node.put(TAG, tagArray);
01601 node.put(TVSHOWID, tvshowid);
01602 node.put(VOTES, votes);
01603 node.put(WATCHEDEPISODES, watchedepisodes);
01604 node.put(YEAR, year);
01605 return node;
01606 }
01607
01613 static List<TVShowDetail> getVideoModelTVShowDetailList(JsonNode node, String key) {
01614 if (node.has(key)) {
01615 final ArrayNode a = (ArrayNode)node.get(key);
01616 final List<TVShowDetail> l = new ArrayList<TVShowDetail>(a.size());
01617 for (int i = 0; i < a.size(); i++) {
01618 l.add(new TVShowDetail((JsonNode)a.get(i)));
01619 }
01620 return l;
01621 }
01622 return new ArrayList<TVShowDetail>(0);
01623 }
01624
01630 @Override
01631 public void writeToParcel(Parcel parcel, int flags) {
01632 super.writeToParcel(parcel, flags);
01633 parcel.writeInt(cast.size());
01634 for (Cast item : cast) {
01635 parcel.writeParcelable(item, flags);
01636 }
01637 parcel.writeValue(episode);
01638 parcel.writeValue(episodeguide);
01639 parcel.writeInt(genre.size());
01640 for (String item : genre) {
01641 parcel.writeValue(item);
01642 }
01643 parcel.writeValue(imdbnumber);
01644 parcel.writeValue(mpaa);
01645 parcel.writeValue(originaltitle);
01646 parcel.writeValue(premiered);
01647 parcel.writeValue(rating);
01648 parcel.writeValue(season);
01649 parcel.writeValue(sorttitle);
01650 parcel.writeInt(studio.size());
01651 for (String item : studio) {
01652 parcel.writeValue(item);
01653 }
01654 parcel.writeInt(tag.size());
01655 for (String item : tag) {
01656 parcel.writeValue(item);
01657 }
01658 parcel.writeValue(tvshowid);
01659 parcel.writeValue(votes);
01660 parcel.writeValue(watchedepisodes);
01661 parcel.writeValue(year);
01662 }
01663
01667 protected TVShowDetail(Parcel parcel) {
01668 super(parcel);
01669 final int castSize = parcel.readInt();
01670 cast = new ArrayList<Cast>(castSize);
01671 for (int i = 0; i < castSize; i++) {
01672 cast.add(parcel.<Cast>readParcelable(Cast.class.getClassLoader()));
01673 }
01674 episode = parcel.readInt();
01675 episodeguide = parcel.readString();
01676 final int genreSize = parcel.readInt();
01677 genre = new ArrayList<String>(genreSize);
01678 for (int i = 0; i < genreSize; i++) {
01679 genre.add(parcel.readString());
01680 }
01681 imdbnumber = parcel.readString();
01682 mpaa = parcel.readString();
01683 originaltitle = parcel.readString();
01684 premiered = parcel.readString();
01685 rating = parcel.readDouble();
01686 season = parcel.readInt();
01687 sorttitle = parcel.readString();
01688 final int studioSize = parcel.readInt();
01689 studio = new ArrayList<String>(studioSize);
01690 for (int i = 0; i < studioSize; i++) {
01691 studio.add(parcel.readString());
01692 }
01693 final int tagSize = parcel.readInt();
01694 tag = new ArrayList<String>(tagSize);
01695 for (int i = 0; i < tagSize; i++) {
01696 tag.add(parcel.readString());
01697 }
01698 tvshowid = parcel.readInt();
01699 votes = parcel.readString();
01700 watchedepisodes = parcel.readInt();
01701 year = parcel.readInt();
01702 }
01703
01707 public static final Parcelable.Creator<TVShowDetail> CREATOR = new Parcelable.Creator<TVShowDetail>() {
01708 @Override
01709 public TVShowDetail createFromParcel(Parcel parcel) {
01710 return new TVShowDetail(parcel);
01711 }
01712 @Override
01713 public TVShowDetail[] newArray(int n) {
01714 return new TVShowDetail[n];
01715 }
01716 };
01717
01718 @Override
01719 public int describeContents() {
01720 return 0;
01721 }
01722 }
01723
01730 public static class Resume extends AbstractModel {
01731 public final static String API_TYPE = "Video.Resume";
01732
01733
01734 public static final String POSITION = "position";
01735 public static final String TOTAL = "total";
01736
01737
01738 public final Double position;
01739 public final Double total;
01740
01745 public Resume(Double position, Double total) {
01746 this.position = position;
01747 this.total = total;
01748 }
01749
01754 public Resume(JsonNode node) {
01755 position = parseDouble(node, POSITION);
01756 total = parseDouble(node, TOTAL);
01757 }
01758
01759 @Override
01760 public JsonNode toJsonNode() {
01761 final ObjectNode node = OM.createObjectNode();
01762 node.put(POSITION, position);
01763 node.put(TOTAL, total);
01764 return node;
01765 }
01766
01772 static List<Resume> getVideoModelResumeList(JsonNode node, String key) {
01773 if (node.has(key)) {
01774 final ArrayNode a = (ArrayNode)node.get(key);
01775 final List<Resume> l = new ArrayList<Resume>(a.size());
01776 for (int i = 0; i < a.size(); i++) {
01777 l.add(new Resume((JsonNode)a.get(i)));
01778 }
01779 return l;
01780 }
01781 return new ArrayList<Resume>(0);
01782 }
01783
01789 @Override
01790 public void writeToParcel(Parcel parcel, int flags) {
01791 parcel.writeValue(position);
01792 parcel.writeValue(total);
01793 }
01794
01798 protected Resume(Parcel parcel) {
01799 position = parcel.readDouble();
01800 total = parcel.readDouble();
01801 }
01802
01806 public static final Parcelable.Creator<Resume> CREATOR = new Parcelable.Creator<Resume>() {
01807 @Override
01808 public Resume createFromParcel(Parcel parcel) {
01809 return new Resume(parcel);
01810 }
01811 @Override
01812 public Resume[] newArray(int n) {
01813 return new Resume[n];
01814 }
01815 };
01816
01817 @Override
01818 public int describeContents() {
01819 return 0;
01820 }
01821 }
01822
01829 public static class Streams extends AbstractModel {
01830 public final static String API_TYPE = "Video.Streams";
01831
01832
01833 public static final String AUDIO = "audio";
01834 public static final String SUBTITLE = "subtitle";
01835 public static final String VIDEO = "video";
01836
01837
01838 public final List<Audio> audio;
01839 public final List<Subtitle> subtitle;
01840 public final List<Video> video;
01841
01847 public Streams(List<Audio> audio, List<Subtitle> subtitle, List<Video> video) {
01848 this.audio = audio;
01849 this.subtitle = subtitle;
01850 this.video = video;
01851 }
01852
01857 public Streams(JsonNode node) {
01858 audio = Audio.getVideoModelAudioList(node, AUDIO);
01859 subtitle = Subtitle.getVideoModelSubtitleList(node, SUBTITLE);
01860 video = Video.getVideoModelVideoList(node, VIDEO);
01861 }
01862
01863 @Override
01864 public JsonNode toJsonNode() {
01865 final ObjectNode node = OM.createObjectNode();
01866 final ArrayNode audioArray = OM.createArrayNode();
01867 for (Audio item : audio) {
01868 audioArray.add(item.toJsonNode());
01869 }
01870 node.put(AUDIO, audioArray);
01871 final ArrayNode subtitleArray = OM.createArrayNode();
01872 for (Subtitle item : subtitle) {
01873 subtitleArray.add(item.toJsonNode());
01874 }
01875 node.put(SUBTITLE, subtitleArray);
01876 final ArrayNode videoArray = OM.createArrayNode();
01877 for (Video item : video) {
01878 videoArray.add(item.toJsonNode());
01879 }
01880 node.put(VIDEO, videoArray);
01881 return node;
01882 }
01883
01889 static List<Streams> getVideoModelStreamsList(JsonNode node, String key) {
01890 if (node.has(key)) {
01891 final ArrayNode a = (ArrayNode)node.get(key);
01892 final List<Streams> l = new ArrayList<Streams>(a.size());
01893 for (int i = 0; i < a.size(); i++) {
01894 l.add(new Streams((JsonNode)a.get(i)));
01895 }
01896 return l;
01897 }
01898 return new ArrayList<Streams>(0);
01899 }
01900
01906 @Override
01907 public void writeToParcel(Parcel parcel, int flags) {
01908 parcel.writeInt(audio.size());
01909 for (Audio item : audio) {
01910 parcel.writeParcelable(item, flags);
01911 }
01912 parcel.writeInt(subtitle.size());
01913 for (Subtitle item : subtitle) {
01914 parcel.writeParcelable(item, flags);
01915 }
01916 parcel.writeInt(video.size());
01917 for (Video item : video) {
01918 parcel.writeParcelable(item, flags);
01919 }
01920 }
01921
01925 protected Streams(Parcel parcel) {
01926 final int audioSize = parcel.readInt();
01927 audio = new ArrayList<Audio>(audioSize);
01928 for (int i = 0; i < audioSize; i++) {
01929 audio.add(parcel.<Audio>readParcelable(Audio.class.getClassLoader()));
01930 }
01931 final int subtitleSize = parcel.readInt();
01932 subtitle = new ArrayList<Subtitle>(subtitleSize);
01933 for (int i = 0; i < subtitleSize; i++) {
01934 subtitle.add(parcel.<Subtitle>readParcelable(Subtitle.class.getClassLoader()));
01935 }
01936 final int videoSize = parcel.readInt();
01937 video = new ArrayList<Video>(videoSize);
01938 for (int i = 0; i < videoSize; i++) {
01939 video.add(parcel.<Video>readParcelable(Video.class.getClassLoader()));
01940 }
01941 }
01942
01946 public static final Parcelable.Creator<Streams> CREATOR = new Parcelable.Creator<Streams>() {
01947 @Override
01948 public Streams createFromParcel(Parcel parcel) {
01949 return new Streams(parcel);
01950 }
01951 @Override
01952 public Streams[] newArray(int n) {
01953 return new Streams[n];
01954 }
01955 };
01956
01957 @Override
01958 public int describeContents() {
01959 return 0;
01960 }
01961
01966 public static class Audio extends AbstractModel {
01967
01968
01969 public static final String CHANNELS = "channels";
01970 public static final String CODEC = "codec";
01971 public static final String LANGUAGE = "language";
01972
01973
01974 public final Integer channels;
01975 public final String codec;
01976 public final String language;
01977
01983 public Audio(Integer channels, String codec, String language) {
01984 this.channels = channels;
01985 this.codec = codec;
01986 this.language = language;
01987 }
01988
01993 public Audio(JsonNode node) {
01994 channels = parseInt(node, CHANNELS);
01995 codec = parseString(node, CODEC);
01996 language = parseString(node, LANGUAGE);
01997 }
01998
01999 @Override
02000 public JsonNode toJsonNode() {
02001 final ObjectNode node = OM.createObjectNode();
02002 node.put(CHANNELS, channels);
02003 node.put(CODEC, codec);
02004 node.put(LANGUAGE, language);
02005 return node;
02006 }
02007
02013 static List<Audio> getVideoModelAudioList(JsonNode node, String key) {
02014 if (node.has(key)) {
02015 final ArrayNode a = (ArrayNode)node.get(key);
02016 final List<Audio> l = new ArrayList<Audio>(a.size());
02017 for (int i = 0; i < a.size(); i++) {
02018 l.add(new Audio((JsonNode)a.get(i)));
02019 }
02020 return l;
02021 }
02022 return new ArrayList<Audio>(0);
02023 }
02024
02030 @Override
02031 public void writeToParcel(Parcel parcel, int flags) {
02032 parcel.writeValue(channels);
02033 parcel.writeValue(codec);
02034 parcel.writeValue(language);
02035 }
02036
02040 protected Audio(Parcel parcel) {
02041 channels = parcel.readInt();
02042 codec = parcel.readString();
02043 language = parcel.readString();
02044 }
02045
02049 public static final Parcelable.Creator<Audio> CREATOR = new Parcelable.Creator<Audio>() {
02050 @Override
02051 public Audio createFromParcel(Parcel parcel) {
02052 return new Audio(parcel);
02053 }
02054 @Override
02055 public Audio[] newArray(int n) {
02056 return new Audio[n];
02057 }
02058 };
02059
02060 @Override
02061 public int describeContents() {
02062 return 0;
02063 }
02064 }
02065
02070 public static class Subtitle extends AbstractModel {
02071
02072
02073 public static final String LANGUAGE = "language";
02074
02075
02076 public final String language;
02077
02081 public Subtitle(String language) {
02082 this.language = language;
02083 }
02084
02089 public Subtitle(JsonNode node) {
02090 language = parseString(node, LANGUAGE);
02091 }
02092
02093 @Override
02094 public JsonNode toJsonNode() {
02095 final ObjectNode node = OM.createObjectNode();
02096 node.put(LANGUAGE, language);
02097 return node;
02098 }
02099
02105 static List<Subtitle> getVideoModelSubtitleList(JsonNode node, String key) {
02106 if (node.has(key)) {
02107 final ArrayNode a = (ArrayNode)node.get(key);
02108 final List<Subtitle> l = new ArrayList<Subtitle>(a.size());
02109 for (int i = 0; i < a.size(); i++) {
02110 l.add(new Subtitle((JsonNode)a.get(i)));
02111 }
02112 return l;
02113 }
02114 return new ArrayList<Subtitle>(0);
02115 }
02116
02122 @Override
02123 public void writeToParcel(Parcel parcel, int flags) {
02124 parcel.writeValue(language);
02125 }
02126
02130 protected Subtitle(Parcel parcel) {
02131 language = parcel.readString();
02132 }
02133
02137 public static final Parcelable.Creator<Subtitle> CREATOR = new Parcelable.Creator<Subtitle>() {
02138 @Override
02139 public Subtitle createFromParcel(Parcel parcel) {
02140 return new Subtitle(parcel);
02141 }
02142 @Override
02143 public Subtitle[] newArray(int n) {
02144 return new Subtitle[n];
02145 }
02146 };
02147
02148 @Override
02149 public int describeContents() {
02150 return 0;
02151 }
02152 }
02153
02158 public static class Video extends AbstractModel {
02159
02160
02161 public static final String ASPECT = "aspect";
02162 public static final String CODEC = "codec";
02163 public static final String DURATION = "duration";
02164 public static final String HEIGHT = "height";
02165 public static final String WIDTH = "width";
02166
02167
02168 public final Double aspect;
02169 public final String codec;
02170 public final Integer duration;
02171 public final Integer height;
02172 public final Integer width;
02173
02181 public Video(Double aspect, String codec, Integer duration, Integer height, Integer width) {
02182 this.aspect = aspect;
02183 this.codec = codec;
02184 this.duration = duration;
02185 this.height = height;
02186 this.width = width;
02187 }
02188
02193 public Video(JsonNode node) {
02194 aspect = parseDouble(node, ASPECT);
02195 codec = parseString(node, CODEC);
02196 duration = parseInt(node, DURATION);
02197 height = parseInt(node, HEIGHT);
02198 width = parseInt(node, WIDTH);
02199 }
02200
02201 @Override
02202 public JsonNode toJsonNode() {
02203 final ObjectNode node = OM.createObjectNode();
02204 node.put(ASPECT, aspect);
02205 node.put(CODEC, codec);
02206 node.put(DURATION, duration);
02207 node.put(HEIGHT, height);
02208 node.put(WIDTH, width);
02209 return node;
02210 }
02211
02217 static List<Video> getVideoModelVideoList(JsonNode node, String key) {
02218 if (node.has(key)) {
02219 final ArrayNode a = (ArrayNode)node.get(key);
02220 final List<Video> l = new ArrayList<Video>(a.size());
02221 for (int i = 0; i < a.size(); i++) {
02222 l.add(new Video((JsonNode)a.get(i)));
02223 }
02224 return l;
02225 }
02226 return new ArrayList<Video>(0);
02227 }
02228
02234 @Override
02235 public void writeToParcel(Parcel parcel, int flags) {
02236 parcel.writeValue(aspect);
02237 parcel.writeValue(codec);
02238 parcel.writeValue(duration);
02239 parcel.writeValue(height);
02240 parcel.writeValue(width);
02241 }
02242
02246 protected Video(Parcel parcel) {
02247 aspect = parcel.readDouble();
02248 codec = parcel.readString();
02249 duration = parcel.readInt();
02250 height = parcel.readInt();
02251 width = parcel.readInt();
02252 }
02253
02257 public static final Parcelable.Creator<Video> CREATOR = new Parcelable.Creator<Video>() {
02258 @Override
02259 public Video createFromParcel(Parcel parcel) {
02260 return new Video(parcel);
02261 }
02262 @Override
02263 public Video[] newArray(int n) {
02264 return new Video[n];
02265 }
02266 };
02267
02268 @Override
02269 public int describeContents() {
02270 return 0;
02271 }
02272 }
02273 }
02274
02278 public interface EpisodeFields {
02279
02280 public final String TITLE = "title";
02281 public final String PLOT = "plot";
02282 public final String VOTES = "votes";
02283 public final String RATING = "rating";
02284 public final String WRITER = "writer";
02285 public final String FIRSTAIRED = "firstaired";
02286 public final String PLAYCOUNT = "playcount";
02287 public final String RUNTIME = "runtime";
02288 public final String DIRECTOR = "director";
02289 public final String PRODUCTIONCODE = "productioncode";
02290 public final String SEASON = "season";
02291 public final String EPISODE = "episode";
02292 public final String ORIGINALTITLE = "originaltitle";
02293 public final String SHOWTITLE = "showtitle";
02294 public final String CAST = "cast";
02295 public final String STREAMDETAILS = "streamdetails";
02296 public final String LASTPLAYED = "lastplayed";
02297 public final String FANART = "fanart";
02298 public final String THUMBNAIL = "thumbnail";
02299 public final String FILE = "file";
02300 public final String RESUME = "resume";
02301 public final String TVSHOWID = "tvshowid";
02302 public final String DATEADDED = "dateadded";
02303 public final String UNIQUEID = "uniqueid";
02304 public final String ART = "art";
02305
02306 public final static Set<String> values = new HashSet<String>(Arrays.asList(TITLE, PLOT, VOTES, RATING, WRITER, FIRSTAIRED, PLAYCOUNT, RUNTIME, DIRECTOR, PRODUCTIONCODE, SEASON, EPISODE, ORIGINALTITLE, SHOWTITLE, CAST, STREAMDETAILS, LASTPLAYED, FANART, THUMBNAIL, FILE, RESUME, TVSHOWID, DATEADDED, UNIQUEID, ART));
02307 }
02308
02312 public interface MovieFields {
02313
02314 public final String TITLE = "title";
02315 public final String GENRE = "genre";
02316 public final String YEAR = "year";
02317 public final String RATING = "rating";
02318 public final String DIRECTOR = "director";
02319 public final String TRAILER = "trailer";
02320 public final String TAGLINE = "tagline";
02321 public final String PLOT = "plot";
02322 public final String PLOTOUTLINE = "plotoutline";
02323 public final String ORIGINALTITLE = "originaltitle";
02324 public final String LASTPLAYED = "lastplayed";
02325 public final String PLAYCOUNT = "playcount";
02326 public final String WRITER = "writer";
02327 public final String STUDIO = "studio";
02328 public final String MPAA = "mpaa";
02329 public final String CAST = "cast";
02330 public final String COUNTRY = "country";
02331 public final String IMDBNUMBER = "imdbnumber";
02332 public final String RUNTIME = "runtime";
02333 public final String SET = "set";
02334 public final String SHOWLINK = "showlink";
02335 public final String STREAMDETAILS = "streamdetails";
02336 public final String TOP250 = "top250";
02337 public final String VOTES = "votes";
02338 public final String FANART = "fanart";
02339 public final String THUMBNAIL = "thumbnail";
02340 public final String FILE = "file";
02341 public final String SORTTITLE = "sorttitle";
02342 public final String RESUME = "resume";
02343 public final String SETID = "setid";
02344 public final String DATEADDED = "dateadded";
02345 public final String TAG = "tag";
02346 public final String ART = "art";
02347
02348 public final static Set<String> values = new HashSet<String>(Arrays.asList(TITLE, GENRE, YEAR, RATING, DIRECTOR, TRAILER, TAGLINE, PLOT, PLOTOUTLINE, ORIGINALTITLE, LASTPLAYED, PLAYCOUNT, WRITER, STUDIO, MPAA, CAST, COUNTRY, IMDBNUMBER, RUNTIME, SET, SHOWLINK, STREAMDETAILS, TOP250, VOTES, FANART, THUMBNAIL, FILE, SORTTITLE, RESUME, SETID, DATEADDED, TAG, ART));
02349 }
02350
02354 public interface MovieSetFields {
02355
02356 public final String TITLE = "title";
02357 public final String PLAYCOUNT = "playcount";
02358 public final String FANART = "fanart";
02359 public final String THUMBNAIL = "thumbnail";
02360 public final String ART = "art";
02361
02362 public final static Set<String> values = new HashSet<String>(Arrays.asList(TITLE, PLAYCOUNT, FANART, THUMBNAIL, ART));
02363 }
02364
02368 public interface MusicVideoFields {
02369
02370 public final String TITLE = "title";
02371 public final String PLAYCOUNT = "playcount";
02372 public final String RUNTIME = "runtime";
02373 public final String DIRECTOR = "director";
02374 public final String STUDIO = "studio";
02375 public final String YEAR = "year";
02376 public final String PLOT = "plot";
02377 public final String ALBUM = "album";
02378 public final String ARTIST = "artist";
02379 public final String GENRE = "genre";
02380 public final String TRACK = "track";
02381 public final String STREAMDETAILS = "streamdetails";
02382 public final String LASTPLAYED = "lastplayed";
02383 public final String FANART = "fanart";
02384 public final String THUMBNAIL = "thumbnail";
02385 public final String FILE = "file";
02386 public final String RESUME = "resume";
02387 public final String DATEADDED = "dateadded";
02388 public final String TAG = "tag";
02389 public final String ART = "art";
02390
02391 public final static Set<String> values = new HashSet<String>(Arrays.asList(TITLE, PLAYCOUNT, RUNTIME, DIRECTOR, STUDIO, YEAR, PLOT, ALBUM, ARTIST, GENRE, TRACK, STREAMDETAILS, LASTPLAYED, FANART, THUMBNAIL, FILE, RESUME, DATEADDED, TAG, ART));
02392 }
02393
02397 public interface SeasonFields {
02398
02399 public final String SEASON = "season";
02400 public final String SHOWTITLE = "showtitle";
02401 public final String PLAYCOUNT = "playcount";
02402 public final String EPISODE = "episode";
02403 public final String FANART = "fanart";
02404 public final String THUMBNAIL = "thumbnail";
02405 public final String TVSHOWID = "tvshowid";
02406 public final String WATCHEDEPISODES = "watchedepisodes";
02407 public final String ART = "art";
02408
02409 public final static Set<String> values = new HashSet<String>(Arrays.asList(SEASON, SHOWTITLE, PLAYCOUNT, EPISODE, FANART, THUMBNAIL, TVSHOWID, WATCHEDEPISODES, ART));
02410 }
02411
02415 public interface TVShowFields {
02416
02417 public final String TITLE = "title";
02418 public final String GENRE = "genre";
02419 public final String YEAR = "year";
02420 public final String RATING = "rating";
02421 public final String PLOT = "plot";
02422 public final String STUDIO = "studio";
02423 public final String MPAA = "mpaa";
02424 public final String CAST = "cast";
02425 public final String PLAYCOUNT = "playcount";
02426 public final String EPISODE = "episode";
02427 public final String IMDBNUMBER = "imdbnumber";
02428 public final String PREMIERED = "premiered";
02429 public final String VOTES = "votes";
02430 public final String LASTPLAYED = "lastplayed";
02431 public final String FANART = "fanart";
02432 public final String THUMBNAIL = "thumbnail";
02433 public final String FILE = "file";
02434 public final String ORIGINALTITLE = "originaltitle";
02435 public final String SORTTITLE = "sorttitle";
02436 public final String EPISODEGUIDE = "episodeguide";
02437 public final String SEASON = "season";
02438 public final String WATCHEDEPISODES = "watchedepisodes";
02439 public final String DATEADDED = "dateadded";
02440 public final String TAG = "tag";
02441 public final String ART = "art";
02442
02443 public final static Set<String> values = new HashSet<String>(Arrays.asList(TITLE, GENRE, YEAR, RATING, PLOT, STUDIO, MPAA, CAST, PLAYCOUNT, EPISODE, IMDBNUMBER, PREMIERED, VOTES, LASTPLAYED, FANART, THUMBNAIL, FILE, ORIGINALTITLE, SORTTITLE, EPISODEGUIDE, SEASON, WATCHEDEPISODES, DATEADDED, TAG, ART));
02444 }
02445 }