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.call;
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.HashSet;
00028 import java.util.List;
00029 import java.util.Set;
00030 import org.codehaus.jackson.JsonNode;
00031 import org.codehaus.jackson.node.ArrayNode;
00032 import org.codehaus.jackson.node.BooleanNode;
00033 import org.codehaus.jackson.node.DoubleNode;
00034 import org.codehaus.jackson.node.ObjectNode;
00035 import org.xbmc.android.jsonrpc.api.AbstractCall;
00036 import org.xbmc.android.jsonrpc.api.AbstractModel;
00037 import org.xbmc.android.jsonrpc.api.model.GlobalModel;
00038 import org.xbmc.android.jsonrpc.api.model.ListModel;
00039 import org.xbmc.android.jsonrpc.api.model.PlayerModel;
00040 import org.xbmc.android.jsonrpc.api.model.PlaylistModel;
00041
00042 public final class Player {
00043
00051 public static class GetActivePlayers extends AbstractCall<GetActivePlayers.GetActivePlayersResult> {
00052 public final static String API_TYPE = "Player.GetActivePlayers";
00053
00054 @Override
00055 public void writeToParcel(Parcel parcel, int flags) {
00056 super.writeToParcel(parcel, flags);
00057 parcel.writeParcelable(mResult, flags);
00058 }
00059
00063 protected GetActivePlayers(Parcel parcel) {
00064 super(parcel);
00065 }
00066
00070 public static final Parcelable.Creator<GetActivePlayers> CREATOR = new Parcelable.Creator<GetActivePlayers>() {
00071 @Override
00072 public GetActivePlayers createFromParcel(Parcel parcel) {
00073 return new GetActivePlayers(parcel);
00074 }
00075 @Override
00076 public GetActivePlayers[] newArray(int n) {
00077 return new GetActivePlayers[n];
00078 }
00079 };
00080
00084 public GetActivePlayers() {
00085 super();
00086 }
00087
00088 @Override
00089 protected ArrayList<GetActivePlayersResult> parseMany(JsonNode node) {
00090 final ArrayNode results = (ArrayNode) node;
00091 if (results != null) {
00092 final ArrayList<GetActivePlayersResult> ret = new ArrayList<GetActivePlayersResult>(results.size());
00093 for (int i = 0; i < results.size(); i++) {
00094 final ObjectNode item = (ObjectNode)results.get(i);
00095 ret.add(new GetActivePlayersResult(item));
00096 }
00097 return ret;
00098 } else {
00099 return new ArrayList<GetActivePlayersResult>(0);
00100 }
00101 }
00102
00103 @Override
00104 public String getName() {
00105 return API_TYPE;
00106 }
00107
00108 @Override
00109 protected boolean returnsList() {
00110 return true;
00111 }
00112
00117 public static class GetActivePlayersResult extends AbstractModel {
00118
00119
00120 public static final String PLAYERID = "playerid";
00121 public static final String TYPE = "type";
00122
00123
00124 public final Integer playerid;
00125 public final String type;
00126
00131 public GetActivePlayersResult(Integer playerid, String type) {
00132 this.playerid = playerid;
00133 this.type = type;
00134 }
00135
00140 public GetActivePlayersResult(JsonNode node) {
00141 playerid = parseInt(node, PLAYERID);
00142 type = parseString(node, TYPE);
00143 }
00144
00145 @Override
00146 public JsonNode toJsonNode() {
00147 final ObjectNode node = OM.createObjectNode();
00148 node.put(PLAYERID, playerid);
00149 node.put(TYPE, type);
00150 return node;
00151 }
00152
00158 static List<GetActivePlayersResult> getPlayerGetActivePlayersResultList(JsonNode node, String key) {
00159 if (node.has(key)) {
00160 final ArrayNode a = (ArrayNode)node.get(key);
00161 final List<GetActivePlayersResult> l = new ArrayList<GetActivePlayersResult>(a.size());
00162 for (int i = 0; i < a.size(); i++) {
00163 l.add(new GetActivePlayersResult((JsonNode)a.get(i)));
00164 }
00165 return l;
00166 }
00167 return new ArrayList<GetActivePlayersResult>(0);
00168 }
00169
00175 @Override
00176 public void writeToParcel(Parcel parcel, int flags) {
00177 parcel.writeValue(playerid);
00178 parcel.writeValue(type);
00179 }
00180
00184 protected GetActivePlayersResult(Parcel parcel) {
00185 playerid = parcel.readInt();
00186 type = parcel.readString();
00187 }
00188
00192 public static final Parcelable.Creator<GetActivePlayersResult> CREATOR = new Parcelable.Creator<GetActivePlayersResult>() {
00193 @Override
00194 public GetActivePlayersResult createFromParcel(Parcel parcel) {
00195 return new GetActivePlayersResult(parcel);
00196 }
00197 @Override
00198 public GetActivePlayersResult[] newArray(int n) {
00199 return new GetActivePlayersResult[n];
00200 }
00201 };
00202
00203 @Override
00204 public int describeContents() {
00205 return 0;
00206 }
00207
00211 public interface Type {
00212
00213 public final String VIDEO = "video";
00214 public final String AUDIO = "audio";
00215 public final String PICTURE = "picture";
00216
00217 public final static Set<String> values = new HashSet<String>(Arrays.asList(VIDEO, AUDIO, PICTURE));
00218 }
00219 }
00220 }
00221
00229 public static class GetItem extends AbstractCall<ListModel.AllItems> {
00230 public final static String API_TYPE = "Player.GetItem";
00231
00232 @Override
00233 public void writeToParcel(Parcel parcel, int flags) {
00234 super.writeToParcel(parcel, flags);
00235 parcel.writeParcelable(mResult, flags);
00236 }
00237
00241 protected GetItem(Parcel parcel) {
00242 super(parcel);
00243 }
00244
00248 public static final Parcelable.Creator<GetItem> CREATOR = new Parcelable.Creator<GetItem>() {
00249 @Override
00250 public GetItem createFromParcel(Parcel parcel) {
00251 return new GetItem(parcel);
00252 }
00253 @Override
00254 public GetItem[] newArray(int n) {
00255 return new GetItem[n];
00256 }
00257 };
00258 public final static String RESULT = "item";
00259
00265 public GetItem(Integer playerid, String... properties) {
00266 super();
00267 addParameter("playerid", playerid);
00268 addParameter("properties", properties);
00269 }
00270
00271 @Override
00272 protected ListModel.AllItems parseOne(JsonNode node) {
00273 return new ListModel.AllItems((ObjectNode)node.get(RESULT));
00274 }
00275
00276 @Override
00277 public String getName() {
00278 return API_TYPE;
00279 }
00280
00281 @Override
00282 protected boolean returnsList() {
00283 return false;
00284 }
00285 }
00286
00294 public static class GetProperties extends AbstractCall<PlayerModel.PropertyValue> {
00295 public final static String API_TYPE = "Player.GetProperties";
00296
00297 @Override
00298 public void writeToParcel(Parcel parcel, int flags) {
00299 super.writeToParcel(parcel, flags);
00300 parcel.writeParcelable(mResult, flags);
00301 }
00302
00306 protected GetProperties(Parcel parcel) {
00307 super(parcel);
00308 }
00309
00313 public static final Parcelable.Creator<GetProperties> CREATOR = new Parcelable.Creator<GetProperties>() {
00314 @Override
00315 public GetProperties createFromParcel(Parcel parcel) {
00316 return new GetProperties(parcel);
00317 }
00318 @Override
00319 public GetProperties[] newArray(int n) {
00320 return new GetProperties[n];
00321 }
00322 };
00323
00329 public GetProperties(Integer playerid, String... properties) {
00330 super();
00331 addParameter("playerid", playerid);
00332 addParameter("properties", properties);
00333 }
00334
00335 @Override
00336 protected PlayerModel.PropertyValue parseOne(JsonNode node) {
00337 return new PlayerModel.PropertyValue(node);
00338 }
00339
00340 @Override
00341 public String getName() {
00342 return API_TYPE;
00343 }
00344
00345 @Override
00346 protected boolean returnsList() {
00347 return false;
00348 }
00349 }
00350
00358 public static class GoTo extends AbstractCall<String> {
00359 public final static String API_TYPE = "Player.GoTo";
00360
00361 @Override
00362 public void writeToParcel(Parcel parcel, int flags) {
00363 super.writeToParcel(parcel, flags);
00364 parcel.writeValue(mResult);
00365 }
00366
00370 protected GoTo(Parcel parcel) {
00371 super(parcel);
00372 }
00373
00377 public static final Parcelable.Creator<GoTo> CREATOR = new Parcelable.Creator<GoTo>() {
00378 @Override
00379 public GoTo createFromParcel(Parcel parcel) {
00380 return new GoTo(parcel);
00381 }
00382 @Override
00383 public GoTo[] newArray(int n) {
00384 return new GoTo[n];
00385 }
00386 };
00387
00393 public GoTo(Integer playerid, String to) {
00394 super();
00395 addParameter("playerid", playerid);
00396 addParameter("to", to);
00397 }
00398
00404 public GoTo(Integer playerid, Integer to) {
00405 super();
00406 addParameter("playerid", playerid);
00407 addParameter("to", to);
00408 }
00409
00410 @Override
00411 protected String parseOne(JsonNode node) {
00412 return node.getTextValue();
00413 }
00414
00415 @Override
00416 public String getName() {
00417 return API_TYPE;
00418 }
00419
00420 @Override
00421 protected boolean returnsList() {
00422 return false;
00423 }
00424
00428 public interface To {
00429
00430 public final String PREVIOUS = "previous";
00431 public final String NEXT = "next";
00432
00433 public final static Set<String> values = new HashSet<String>(Arrays.asList(PREVIOUS, NEXT));
00434 }
00435 }
00436
00444 public static class Move extends AbstractCall<String> {
00445 public final static String API_TYPE = "Player.Move";
00446
00447 @Override
00448 public void writeToParcel(Parcel parcel, int flags) {
00449 super.writeToParcel(parcel, flags);
00450 parcel.writeValue(mResult);
00451 }
00452
00456 protected Move(Parcel parcel) {
00457 super(parcel);
00458 }
00459
00463 public static final Parcelable.Creator<Move> CREATOR = new Parcelable.Creator<Move>() {
00464 @Override
00465 public Move createFromParcel(Parcel parcel) {
00466 return new Move(parcel);
00467 }
00468 @Override
00469 public Move[] newArray(int n) {
00470 return new Move[n];
00471 }
00472 };
00473
00479 public Move(Integer playerid, String direction) {
00480 super();
00481 addParameter("playerid", playerid);
00482 addParameter("direction", direction);
00483 }
00484
00485 @Override
00486 protected String parseOne(JsonNode node) {
00487 return node.getTextValue();
00488 }
00489
00490 @Override
00491 public String getName() {
00492 return API_TYPE;
00493 }
00494
00495 @Override
00496 protected boolean returnsList() {
00497 return false;
00498 }
00499
00503 public interface Direction {
00504
00505 public final String LEFT = "left";
00506 public final String RIGHT = "right";
00507 public final String UP = "up";
00508 public final String DOWN = "down";
00509
00510 public final static Set<String> values = new HashSet<String>(Arrays.asList(LEFT, RIGHT, UP, DOWN));
00511 }
00512 }
00513
00521 public static class Open extends AbstractCall<String> {
00522 public final static String API_TYPE = "Player.Open";
00523
00524 @Override
00525 public void writeToParcel(Parcel parcel, int flags) {
00526 super.writeToParcel(parcel, flags);
00527 parcel.writeValue(mResult);
00528 }
00529
00533 protected Open(Parcel parcel) {
00534 super(parcel);
00535 }
00536
00540 public static final Parcelable.Creator<Open> CREATOR = new Parcelable.Creator<Open>() {
00541 @Override
00542 public Open createFromParcel(Parcel parcel) {
00543 return new Open(parcel);
00544 }
00545 @Override
00546 public Open[] newArray(int n) {
00547 return new Open[n];
00548 }
00549 };
00550
00556 public Open(ItemPlaylistIdPosition item, Option options) {
00557 super();
00558 addParameter("item", item);
00559 addParameter("options", options);
00560 }
00561
00567 public Open(PlaylistModel.Item item, Option options) {
00568 super();
00569 addParameter("item", item);
00570 addParameter("options", options);
00571 }
00572
00578 public Open(ItemPathRandomRecursive item, Option options) {
00579 super();
00580 addParameter("item", item);
00581 addParameter("options", options);
00582 }
00583
00589 public Open(ItemPartymode item, Option options) {
00590 super();
00591 addParameter("item", item);
00592 addParameter("options", options);
00593 }
00594
00600 public Open(ItemChannelId item, Option options) {
00601 super();
00602 addParameter("item", item);
00603 addParameter("options", options);
00604 }
00605
00609 public Open() {
00610 super();
00611 }
00612
00617 public Open(ItemPlaylistIdPosition item) {
00618 super();
00619 addParameter("item", item);
00620 }
00621
00626 public Open(PlaylistModel.Item item) {
00627 super();
00628 addParameter("item", item);
00629 }
00630
00635 public Open(ItemPathRandomRecursive item) {
00636 super();
00637 addParameter("item", item);
00638 }
00639
00644 public Open(ItemPartymode item) {
00645 super();
00646 addParameter("item", item);
00647 }
00648
00653 public Open(ItemChannelId item) {
00654 super();
00655 addParameter("item", item);
00656 }
00657
00658 @Override
00659 protected String parseOne(JsonNode node) {
00660 return node.getTextValue();
00661 }
00662
00663 @Override
00664 public String getName() {
00665 return API_TYPE;
00666 }
00667
00668 @Override
00669 protected boolean returnsList() {
00670 return false;
00671 }
00672
00677 public static class ItemPlaylistIdPosition extends AbstractModel {
00678
00679
00680 public static final String PLAYLISTID = "playlistid";
00681 public static final String POSITION = "position";
00682
00683
00684 public final Integer playlistid;
00685 public final Integer position;
00686
00691 public ItemPlaylistIdPosition(Integer playlistid, Integer position) {
00692 this.playlistid = playlistid;
00693 this.position = position;
00694 }
00695
00696 @Override
00697 public JsonNode toJsonNode() {
00698 final ObjectNode node = OM.createObjectNode();
00699 node.put(PLAYLISTID, playlistid);
00700 node.put(POSITION, position);
00701 return node;
00702 }
00703
00709 @Override
00710 public void writeToParcel(Parcel parcel, int flags) {
00711 parcel.writeValue(playlistid);
00712 parcel.writeValue(position);
00713 }
00714
00718 protected ItemPlaylistIdPosition(Parcel parcel) {
00719 playlistid = parcel.readInt();
00720 position = parcel.readInt();
00721 }
00722
00726 public static final Parcelable.Creator<ItemPlaylistIdPosition> CREATOR = new Parcelable.Creator<ItemPlaylistIdPosition>() {
00727 @Override
00728 public ItemPlaylistIdPosition createFromParcel(Parcel parcel) {
00729 return new ItemPlaylistIdPosition(parcel);
00730 }
00731 @Override
00732 public ItemPlaylistIdPosition[] newArray(int n) {
00733 return new ItemPlaylistIdPosition[n];
00734 }
00735 };
00736
00737 @Override
00738 public int describeContents() {
00739 return 0;
00740 }
00741 }
00742
00747 public static class ItemPathRandomRecursive extends AbstractModel {
00748
00749
00750 public static final String PATH = "path";
00751 public static final String RANDOM = "random";
00752 public static final String RECURSIVE = "recursive";
00753
00754
00755 public final String path;
00756 public final Boolean random;
00757 public final Boolean recursive;
00758
00764 public ItemPathRandomRecursive(String path, Boolean random, Boolean recursive) {
00765 this.path = path;
00766 this.random = random;
00767 this.recursive = recursive;
00768 }
00769
00770 @Override
00771 public JsonNode toJsonNode() {
00772 final ObjectNode node = OM.createObjectNode();
00773 node.put(PATH, path);
00774 node.put(RANDOM, random);
00775 node.put(RECURSIVE, recursive);
00776 return node;
00777 }
00778
00784 @Override
00785 public void writeToParcel(Parcel parcel, int flags) {
00786 parcel.writeValue(path);
00787 parcel.writeInt(random ? 1 : 0);
00788 parcel.writeInt(recursive ? 1 : 0);
00789 }
00790
00794 protected ItemPathRandomRecursive(Parcel parcel) {
00795 path = parcel.readString();
00796 random = parcel.readInt() == 1;
00797 recursive = parcel.readInt() == 1;
00798 }
00799
00803 public static final Parcelable.Creator<ItemPathRandomRecursive> CREATOR = new Parcelable.Creator<ItemPathRandomRecursive>() {
00804 @Override
00805 public ItemPathRandomRecursive createFromParcel(Parcel parcel) {
00806 return new ItemPathRandomRecursive(parcel);
00807 }
00808 @Override
00809 public ItemPathRandomRecursive[] newArray(int n) {
00810 return new ItemPathRandomRecursive[n];
00811 }
00812 };
00813
00814 @Override
00815 public int describeContents() {
00816 return 0;
00817 }
00818 }
00819
00824 public static class ItemPartymode extends AbstractModel {
00825
00826
00827 public static final String PARTYMODE = "partymode";
00828
00829
00830 public final String partymode;
00831
00835 public ItemPartymode(String partymode) {
00836 this.partymode = partymode;
00837 }
00838
00839 @Override
00840 public JsonNode toJsonNode() {
00841 final ObjectNode node = OM.createObjectNode();
00842 node.put(PARTYMODE, partymode);
00843 return node;
00844 }
00845
00851 @Override
00852 public void writeToParcel(Parcel parcel, int flags) {
00853 parcel.writeValue(partymode);
00854 }
00855
00859 protected ItemPartymode(Parcel parcel) {
00860 partymode = parcel.readString();
00861 }
00862
00866 public static final Parcelable.Creator<ItemPartymode> CREATOR = new Parcelable.Creator<ItemPartymode>() {
00867 @Override
00868 public ItemPartymode createFromParcel(Parcel parcel) {
00869 return new ItemPartymode(parcel);
00870 }
00871 @Override
00872 public ItemPartymode[] newArray(int n) {
00873 return new ItemPartymode[n];
00874 }
00875 };
00876
00877 @Override
00878 public int describeContents() {
00879 return 0;
00880 }
00881 }
00882
00887 public static class ItemChannelId extends AbstractModel {
00888
00889
00890 public static final String CHANNELID = "channelid";
00891
00892
00893 public final Integer channelid;
00894
00898 public ItemChannelId(Integer channelid) {
00899 this.channelid = channelid;
00900 }
00901
00902 @Override
00903 public JsonNode toJsonNode() {
00904 final ObjectNode node = OM.createObjectNode();
00905 node.put(CHANNELID, channelid);
00906 return node;
00907 }
00908
00914 @Override
00915 public void writeToParcel(Parcel parcel, int flags) {
00916 parcel.writeValue(channelid);
00917 }
00918
00922 protected ItemChannelId(Parcel parcel) {
00923 channelid = parcel.readInt();
00924 }
00925
00929 public static final Parcelable.Creator<ItemChannelId> CREATOR = new Parcelable.Creator<ItemChannelId>() {
00930 @Override
00931 public ItemChannelId createFromParcel(Parcel parcel) {
00932 return new ItemChannelId(parcel);
00933 }
00934 @Override
00935 public ItemChannelId[] newArray(int n) {
00936 return new ItemChannelId[n];
00937 }
00938 };
00939
00940 @Override
00941 public int describeContents() {
00942 return 0;
00943 }
00944 }
00945
00950 public static class Option extends AbstractModel {
00951
00952
00953 public static final String REPEAT = "repeat";
00954 public static final String RESUME = "resume";
00955 public static final String SHUFFLED = "shuffled";
00956
00957
00958 public final String repeat;
00959 public final Resume resume;
00960 public final Boolean shuffled;
00961
00967 public Option(String repeat, Resume resume, Boolean shuffled) {
00968 this.repeat = repeat;
00969 this.resume = resume;
00970 this.shuffled = shuffled;
00971 }
00972
00973 @Override
00974 public JsonNode toJsonNode() {
00975 final ObjectNode node = OM.createObjectNode();
00976 node.put(REPEAT, repeat);
00977 node.put(RESUME, resume.toJsonNode());
00978 node.put(SHUFFLED, shuffled);
00979 return node;
00980 }
00981
00987 @Override
00988 public void writeToParcel(Parcel parcel, int flags) {
00989 parcel.writeValue(repeat);
00990 parcel.writeValue(resume);
00991 parcel.writeInt(shuffled ? 1 : 0);
00992 }
00993
00997 protected Option(Parcel parcel) {
00998 repeat = parcel.readString();
00999 resume = parcel.<Resume>readParcelable(Resume.class.getClassLoader());
01000 shuffled = parcel.readInt() == 1;
01001 }
01002
01006 public static final Parcelable.Creator<Option> CREATOR = new Parcelable.Creator<Option>() {
01007 @Override
01008 public Option createFromParcel(Parcel parcel) {
01009 return new Option(parcel);
01010 }
01011 @Override
01012 public Option[] newArray(int n) {
01013 return new Option[n];
01014 }
01015 };
01016
01017 @Override
01018 public int describeContents() {
01019 return 0;
01020 }
01021
01026 public static class Resume extends AbstractModel {
01027
01028
01029 public final Boolean booleanArg;
01030 public final Double positionPercentage;
01031 public final PlayerModel.PositionTime positionTime;
01032
01036 public Resume(Boolean booleanArg) {
01037 this.booleanArg = booleanArg;
01038 this.positionPercentage = null;
01039 this.positionTime = null;
01040 }
01041
01045 public Resume(Double positionPercentage) {
01046 this.positionPercentage = positionPercentage;
01047 this.booleanArg = null;
01048 this.positionTime = null;
01049 }
01050
01054 public Resume(PlayerModel.PositionTime positionTime) {
01055 this.positionTime = positionTime;
01056 this.booleanArg = null;
01057 this.positionPercentage = null;
01058 }
01059
01060 @Override
01061 public JsonNode toJsonNode() {
01062 if (booleanArg != null) {
01063 return booleanArg ? BooleanNode.TRUE : BooleanNode.FALSE;
01064 }
01065 if (positionPercentage != null) {
01066 return new DoubleNode(positionPercentage);
01067 }
01068 if (positionTime != null) {
01069 return positionTime.toJsonNode();
01070 }
01071 return null;
01072 }
01073
01079 @Override
01080 public void writeToParcel(Parcel parcel, int flags) {
01081 parcel.writeInt(booleanArg ? 1 : 0);
01082 parcel.writeValue(positionPercentage);
01083 parcel.writeValue(positionTime);
01084 }
01085
01089 protected Resume(Parcel parcel) {
01090 booleanArg = parcel.readInt() == 1;
01091 positionPercentage = parcel.readDouble();
01092 positionTime = parcel.<PlayerModel.PositionTime>readParcelable(PlayerModel.PositionTime.class.getClassLoader());
01093 }
01094
01098 public static final Parcelable.Creator<Resume> CREATOR = new Parcelable.Creator<Resume>() {
01099 @Override
01100 public Resume createFromParcel(Parcel parcel) {
01101 return new Resume(parcel);
01102 }
01103 @Override
01104 public Resume[] newArray(int n) {
01105 return new Resume[n];
01106 }
01107 };
01108
01109 @Override
01110 public int describeContents() {
01111 return 0;
01112 }
01113 }
01114 }
01115 }
01116
01124 public static class PlayPause extends AbstractCall<PlayerModel.Speed> {
01125 public final static String API_TYPE = "Player.PlayPause";
01126
01127 @Override
01128 public void writeToParcel(Parcel parcel, int flags) {
01129 super.writeToParcel(parcel, flags);
01130 parcel.writeParcelable(mResult, flags);
01131 }
01132
01136 protected PlayPause(Parcel parcel) {
01137 super(parcel);
01138 }
01139
01143 public static final Parcelable.Creator<PlayPause> CREATOR = new Parcelable.Creator<PlayPause>() {
01144 @Override
01145 public PlayPause createFromParcel(Parcel parcel) {
01146 return new PlayPause(parcel);
01147 }
01148 @Override
01149 public PlayPause[] newArray(int n) {
01150 return new PlayPause[n];
01151 }
01152 };
01153
01159 public PlayPause(Integer playerid, GlobalModel.Toggle play) {
01160 super();
01161 addParameter("playerid", playerid);
01162 addParameter("play", play);
01163 }
01164
01169 public PlayPause(Integer playerid) {
01170 super();
01171 addParameter("playerid", playerid);
01172 }
01173
01174 @Override
01175 protected PlayerModel.Speed parseOne(JsonNode node) {
01176 return new PlayerModel.Speed(node);
01177 }
01178
01179 @Override
01180 public String getName() {
01181 return API_TYPE;
01182 }
01183
01184 @Override
01185 protected boolean returnsList() {
01186 return false;
01187 }
01188 }
01189
01197 public static class Rotate extends AbstractCall<String> {
01198 public final static String API_TYPE = "Player.Rotate";
01199
01200 @Override
01201 public void writeToParcel(Parcel parcel, int flags) {
01202 super.writeToParcel(parcel, flags);
01203 parcel.writeValue(mResult);
01204 }
01205
01209 protected Rotate(Parcel parcel) {
01210 super(parcel);
01211 }
01212
01216 public static final Parcelable.Creator<Rotate> CREATOR = new Parcelable.Creator<Rotate>() {
01217 @Override
01218 public Rotate createFromParcel(Parcel parcel) {
01219 return new Rotate(parcel);
01220 }
01221 @Override
01222 public Rotate[] newArray(int n) {
01223 return new Rotate[n];
01224 }
01225 };
01226
01232 public Rotate(Integer playerid, String value) {
01233 super();
01234 addParameter("playerid", playerid);
01235 addParameter("value", value);
01236 }
01237
01242 public Rotate(Integer playerid) {
01243 super();
01244 addParameter("playerid", playerid);
01245 }
01246
01247 @Override
01248 protected String parseOne(JsonNode node) {
01249 return node.getTextValue();
01250 }
01251
01252 @Override
01253 public String getName() {
01254 return API_TYPE;
01255 }
01256
01257 @Override
01258 protected boolean returnsList() {
01259 return false;
01260 }
01261
01265 public interface Value {
01266
01267 public final String CLOCKWISE = "clockwise";
01268 public final String COUNTERCLOCKWISE = "counterclockwise";
01269
01270 public final static Set<String> values = new HashSet<String>(Arrays.asList(CLOCKWISE, COUNTERCLOCKWISE));
01271 }
01272 }
01273
01281 public static class Seek extends AbstractCall<Seek.SeekResult> {
01282 public final static String API_TYPE = "Player.Seek";
01283
01284 @Override
01285 public void writeToParcel(Parcel parcel, int flags) {
01286 super.writeToParcel(parcel, flags);
01287 parcel.writeParcelable(mResult, flags);
01288 }
01289
01293 protected Seek(Parcel parcel) {
01294 super(parcel);
01295 }
01296
01300 public static final Parcelable.Creator<Seek> CREATOR = new Parcelable.Creator<Seek>() {
01301 @Override
01302 public Seek createFromParcel(Parcel parcel) {
01303 return new Seek(parcel);
01304 }
01305 @Override
01306 public Seek[] newArray(int n) {
01307 return new Seek[n];
01308 }
01309 };
01310
01316 public Seek(Integer playerid, Double value) {
01317 super();
01318 addParameter("playerid", playerid);
01319 addParameter("value", value);
01320 }
01321
01327 public Seek(Integer playerid, PlayerModel.PositionTime value) {
01328 super();
01329 addParameter("playerid", playerid);
01330 addParameter("value", value);
01331 }
01332
01338 public Seek(Integer playerid, String value) {
01339 super();
01340 addParameter("playerid", playerid);
01341 addParameter("value", value);
01342 }
01343
01344 @Override
01345 protected SeekResult parseOne(JsonNode node) {
01346 return new SeekResult(node);
01347 }
01348
01349 @Override
01350 public String getName() {
01351 return API_TYPE;
01352 }
01353
01354 @Override
01355 protected boolean returnsList() {
01356 return false;
01357 }
01358
01363 public static class SeekResult extends AbstractModel {
01364
01365
01366 public static final String PERCENTAGE = "percentage";
01367 public static final String TIME = "time";
01368 public static final String TOTALTIME = "totaltime";
01369
01370
01371 public final Double percentage;
01372 public final GlobalModel.Time time;
01373 public final GlobalModel.Time totaltime;
01374
01380 public SeekResult(Double percentage, GlobalModel.Time time, GlobalModel.Time totaltime) {
01381 this.percentage = percentage;
01382 this.time = time;
01383 this.totaltime = totaltime;
01384 }
01385
01390 public SeekResult(JsonNode node) {
01391 percentage = parseDouble(node, PERCENTAGE);
01392 time = node.has(TIME) ? new GlobalModel.Time(node.get(TIME)) : null;
01393 totaltime = node.has(TOTALTIME) ? new GlobalModel.Time(node.get(TOTALTIME)) : null;
01394 }
01395
01396 @Override
01397 public JsonNode toJsonNode() {
01398 final ObjectNode node = OM.createObjectNode();
01399 node.put(PERCENTAGE, percentage);
01400 node.put(TIME, time.toJsonNode());
01401 node.put(TOTALTIME, totaltime.toJsonNode());
01402 return node;
01403 }
01404
01410 static List<SeekResult> getPlayerSeekResultList(JsonNode node, String key) {
01411 if (node.has(key)) {
01412 final ArrayNode a = (ArrayNode)node.get(key);
01413 final List<SeekResult> l = new ArrayList<SeekResult>(a.size());
01414 for (int i = 0; i < a.size(); i++) {
01415 l.add(new SeekResult((JsonNode)a.get(i)));
01416 }
01417 return l;
01418 }
01419 return new ArrayList<SeekResult>(0);
01420 }
01421
01427 @Override
01428 public void writeToParcel(Parcel parcel, int flags) {
01429 parcel.writeValue(percentage);
01430 parcel.writeValue(time);
01431 parcel.writeValue(totaltime);
01432 }
01433
01437 protected SeekResult(Parcel parcel) {
01438 percentage = parcel.readDouble();
01439 time = parcel.<GlobalModel.Time>readParcelable(GlobalModel.Time.class.getClassLoader());
01440 totaltime = parcel.<GlobalModel.Time>readParcelable(GlobalModel.Time.class.getClassLoader());
01441 }
01442
01446 public static final Parcelable.Creator<SeekResult> CREATOR = new Parcelable.Creator<SeekResult>() {
01447 @Override
01448 public SeekResult createFromParcel(Parcel parcel) {
01449 return new SeekResult(parcel);
01450 }
01451 @Override
01452 public SeekResult[] newArray(int n) {
01453 return new SeekResult[n];
01454 }
01455 };
01456
01457 @Override
01458 public int describeContents() {
01459 return 0;
01460 }
01461 }
01462
01466 public interface Value {
01467
01468 public final String SMALLFORWARD = "smallforward";
01469 public final String SMALLBACKWARD = "smallbackward";
01470 public final String BIGFORWARD = "bigforward";
01471 public final String BIGBACKWARD = "bigbackward";
01472
01473 public final static Set<String> values = new HashSet<String>(Arrays.asList(SMALLFORWARD, SMALLBACKWARD, BIGFORWARD, BIGBACKWARD));
01474 }
01475 }
01476
01484 public static class SetAudioStream extends AbstractCall<String> {
01485 public final static String API_TYPE = "Player.SetAudioStream";
01486
01487 @Override
01488 public void writeToParcel(Parcel parcel, int flags) {
01489 super.writeToParcel(parcel, flags);
01490 parcel.writeValue(mResult);
01491 }
01492
01496 protected SetAudioStream(Parcel parcel) {
01497 super(parcel);
01498 }
01499
01503 public static final Parcelable.Creator<SetAudioStream> CREATOR = new Parcelable.Creator<SetAudioStream>() {
01504 @Override
01505 public SetAudioStream createFromParcel(Parcel parcel) {
01506 return new SetAudioStream(parcel);
01507 }
01508 @Override
01509 public SetAudioStream[] newArray(int n) {
01510 return new SetAudioStream[n];
01511 }
01512 };
01513
01519 public SetAudioStream(Integer playerid, String stream) {
01520 super();
01521 addParameter("playerid", playerid);
01522 addParameter("stream", stream);
01523 }
01524
01530 public SetAudioStream(Integer playerid, Integer stream) {
01531 super();
01532 addParameter("playerid", playerid);
01533 addParameter("stream", stream);
01534 }
01535
01536 @Override
01537 protected String parseOne(JsonNode node) {
01538 return node.getTextValue();
01539 }
01540
01541 @Override
01542 public String getName() {
01543 return API_TYPE;
01544 }
01545
01546 @Override
01547 protected boolean returnsList() {
01548 return false;
01549 }
01550
01554 public interface Stream {
01555
01556 public final String PREVIOUS = "previous";
01557 public final String NEXT = "next";
01558
01559 public final static Set<String> values = new HashSet<String>(Arrays.asList(PREVIOUS, NEXT));
01560 }
01561 }
01562
01570 public static class SetPartymode extends AbstractCall<String> {
01571 public final static String API_TYPE = "Player.SetPartymode";
01572
01573 @Override
01574 public void writeToParcel(Parcel parcel, int flags) {
01575 super.writeToParcel(parcel, flags);
01576 parcel.writeValue(mResult);
01577 }
01578
01582 protected SetPartymode(Parcel parcel) {
01583 super(parcel);
01584 }
01585
01589 public static final Parcelable.Creator<SetPartymode> CREATOR = new Parcelable.Creator<SetPartymode>() {
01590 @Override
01591 public SetPartymode createFromParcel(Parcel parcel) {
01592 return new SetPartymode(parcel);
01593 }
01594 @Override
01595 public SetPartymode[] newArray(int n) {
01596 return new SetPartymode[n];
01597 }
01598 };
01599
01605 public SetPartymode(Integer playerid, GlobalModel.Toggle partymode) {
01606 super();
01607 addParameter("playerid", playerid);
01608 addParameter("partymode", partymode);
01609 }
01610
01611 @Override
01612 protected String parseOne(JsonNode node) {
01613 return node.getTextValue();
01614 }
01615
01616 @Override
01617 public String getName() {
01618 return API_TYPE;
01619 }
01620
01621 @Override
01622 protected boolean returnsList() {
01623 return false;
01624 }
01625 }
01626
01634 public static class SetRepeat extends AbstractCall<String> {
01635 public final static String API_TYPE = "Player.SetRepeat";
01636
01637 @Override
01638 public void writeToParcel(Parcel parcel, int flags) {
01639 super.writeToParcel(parcel, flags);
01640 parcel.writeValue(mResult);
01641 }
01642
01646 protected SetRepeat(Parcel parcel) {
01647 super(parcel);
01648 }
01649
01653 public static final Parcelable.Creator<SetRepeat> CREATOR = new Parcelable.Creator<SetRepeat>() {
01654 @Override
01655 public SetRepeat createFromParcel(Parcel parcel) {
01656 return new SetRepeat(parcel);
01657 }
01658 @Override
01659 public SetRepeat[] newArray(int n) {
01660 return new SetRepeat[n];
01661 }
01662 };
01663
01669 public SetRepeat(Integer playerid, String repeat) {
01670 super();
01671 addParameter("playerid", playerid);
01672 addParameter("repeat", repeat);
01673 }
01674
01675 @Override
01676 protected String parseOne(JsonNode node) {
01677 return node.getTextValue();
01678 }
01679
01680 @Override
01681 public String getName() {
01682 return API_TYPE;
01683 }
01684
01685 @Override
01686 protected boolean returnsList() {
01687 return false;
01688 }
01689 }
01690
01698 public static class SetShuffle extends AbstractCall<String> {
01699 public final static String API_TYPE = "Player.SetShuffle";
01700
01701 @Override
01702 public void writeToParcel(Parcel parcel, int flags) {
01703 super.writeToParcel(parcel, flags);
01704 parcel.writeValue(mResult);
01705 }
01706
01710 protected SetShuffle(Parcel parcel) {
01711 super(parcel);
01712 }
01713
01717 public static final Parcelable.Creator<SetShuffle> CREATOR = new Parcelable.Creator<SetShuffle>() {
01718 @Override
01719 public SetShuffle createFromParcel(Parcel parcel) {
01720 return new SetShuffle(parcel);
01721 }
01722 @Override
01723 public SetShuffle[] newArray(int n) {
01724 return new SetShuffle[n];
01725 }
01726 };
01727
01733 public SetShuffle(Integer playerid, GlobalModel.Toggle shuffle) {
01734 super();
01735 addParameter("playerid", playerid);
01736 addParameter("shuffle", shuffle);
01737 }
01738
01739 @Override
01740 protected String parseOne(JsonNode node) {
01741 return node.getTextValue();
01742 }
01743
01744 @Override
01745 public String getName() {
01746 return API_TYPE;
01747 }
01748
01749 @Override
01750 protected boolean returnsList() {
01751 return false;
01752 }
01753 }
01754
01762 public static class SetSpeed extends AbstractCall<PlayerModel.Speed> {
01763 public final static String API_TYPE = "Player.SetSpeed";
01764
01765 @Override
01766 public void writeToParcel(Parcel parcel, int flags) {
01767 super.writeToParcel(parcel, flags);
01768 parcel.writeParcelable(mResult, flags);
01769 }
01770
01774 protected SetSpeed(Parcel parcel) {
01775 super(parcel);
01776 }
01777
01781 public static final Parcelable.Creator<SetSpeed> CREATOR = new Parcelable.Creator<SetSpeed>() {
01782 @Override
01783 public SetSpeed createFromParcel(Parcel parcel) {
01784 return new SetSpeed(parcel);
01785 }
01786 @Override
01787 public SetSpeed[] newArray(int n) {
01788 return new SetSpeed[n];
01789 }
01790 };
01791
01797 public SetSpeed(Integer playerid, Integer speed) {
01798 super();
01799 addParameter("playerid", playerid);
01800 addParameter("speed", speed);
01801 }
01802
01803 @Override
01804 protected PlayerModel.Speed parseOne(JsonNode node) {
01805 return new PlayerModel.Speed(node);
01806 }
01807
01808 @Override
01809 public String getName() {
01810 return API_TYPE;
01811 }
01812
01813 @Override
01814 protected boolean returnsList() {
01815 return false;
01816 }
01817
01821 public interface Speed {
01822
01823 public final Integer MINUS_32 = -32;
01824 public final Integer MINUS_16 = -16;
01825 public final Integer MINUS_8 = -8;
01826 public final Integer MINUS_4 = -4;
01827 public final Integer MINUS_2 = -2;
01828 public final Integer MINUS_1 = -1;
01829 public final Integer ZERO = 0;
01830 public final Integer PLUS_1 = 1;
01831 public final Integer PLUS_2 = 2;
01832 public final Integer PLUS_4 = 4;
01833 public final Integer PLUS_8 = 8;
01834 public final Integer PLUS_16 = 16;
01835 public final Integer PLUS_32 = 32;
01836
01837 public final static Set<Integer> values = new HashSet<Integer>(Arrays.asList(MINUS_32, MINUS_16, MINUS_8, MINUS_4, MINUS_2, MINUS_1, ZERO, PLUS_1, PLUS_2, PLUS_4, PLUS_8, PLUS_16, PLUS_32));
01838 }
01839 }
01840
01848 public static class SetSubtitle extends AbstractCall<String> {
01849 public final static String API_TYPE = "Player.SetSubtitle";
01850
01851 @Override
01852 public void writeToParcel(Parcel parcel, int flags) {
01853 super.writeToParcel(parcel, flags);
01854 parcel.writeValue(mResult);
01855 }
01856
01860 protected SetSubtitle(Parcel parcel) {
01861 super(parcel);
01862 }
01863
01867 public static final Parcelable.Creator<SetSubtitle> CREATOR = new Parcelable.Creator<SetSubtitle>() {
01868 @Override
01869 public SetSubtitle createFromParcel(Parcel parcel) {
01870 return new SetSubtitle(parcel);
01871 }
01872 @Override
01873 public SetSubtitle[] newArray(int n) {
01874 return new SetSubtitle[n];
01875 }
01876 };
01877
01884 public SetSubtitle(Integer playerid, String subtitle, Boolean enable) {
01885 super();
01886 addParameter("playerid", playerid);
01887 addParameter("subtitle", subtitle);
01888 addParameter("enable", enable);
01889 }
01890
01897 public SetSubtitle(Integer playerid, Integer subtitle, Boolean enable) {
01898 super();
01899 addParameter("playerid", playerid);
01900 addParameter("subtitle", subtitle);
01901 addParameter("enable", enable);
01902 }
01903
01909 public SetSubtitle(Integer playerid, String subtitle) {
01910 super();
01911 addParameter("playerid", playerid);
01912 addParameter("subtitle", subtitle);
01913 }
01914
01920 public SetSubtitle(Integer playerid, Integer subtitle) {
01921 super();
01922 addParameter("playerid", playerid);
01923 addParameter("subtitle", subtitle);
01924 }
01925
01926 @Override
01927 protected String parseOne(JsonNode node) {
01928 return node.getTextValue();
01929 }
01930
01931 @Override
01932 public String getName() {
01933 return API_TYPE;
01934 }
01935
01936 @Override
01937 protected boolean returnsList() {
01938 return false;
01939 }
01940
01944 public interface Subtitle {
01945
01946 public final String PREVIOUS = "previous";
01947 public final String NEXT = "next";
01948 public final String OFF = "off";
01949 public final String ON = "on";
01950
01951 public final static Set<String> values = new HashSet<String>(Arrays.asList(PREVIOUS, NEXT, OFF, ON));
01952 }
01953 }
01954
01962 public static class Stop extends AbstractCall<String> {
01963 public final static String API_TYPE = "Player.Stop";
01964
01965 @Override
01966 public void writeToParcel(Parcel parcel, int flags) {
01967 super.writeToParcel(parcel, flags);
01968 parcel.writeValue(mResult);
01969 }
01970
01974 protected Stop(Parcel parcel) {
01975 super(parcel);
01976 }
01977
01981 public static final Parcelable.Creator<Stop> CREATOR = new Parcelable.Creator<Stop>() {
01982 @Override
01983 public Stop createFromParcel(Parcel parcel) {
01984 return new Stop(parcel);
01985 }
01986 @Override
01987 public Stop[] newArray(int n) {
01988 return new Stop[n];
01989 }
01990 };
01991
01996 public Stop(Integer playerid) {
01997 super();
01998 addParameter("playerid", playerid);
01999 }
02000
02001 @Override
02002 protected String parseOne(JsonNode node) {
02003 return node.getTextValue();
02004 }
02005
02006 @Override
02007 public String getName() {
02008 return API_TYPE;
02009 }
02010
02011 @Override
02012 protected boolean returnsList() {
02013 return false;
02014 }
02015 }
02016
02024 public static class Zoom extends AbstractCall<String> {
02025 public final static String API_TYPE = "Player.Zoom";
02026
02027 @Override
02028 public void writeToParcel(Parcel parcel, int flags) {
02029 super.writeToParcel(parcel, flags);
02030 parcel.writeValue(mResult);
02031 }
02032
02036 protected Zoom(Parcel parcel) {
02037 super(parcel);
02038 }
02039
02043 public static final Parcelable.Creator<Zoom> CREATOR = new Parcelable.Creator<Zoom>() {
02044 @Override
02045 public Zoom createFromParcel(Parcel parcel) {
02046 return new Zoom(parcel);
02047 }
02048 @Override
02049 public Zoom[] newArray(int n) {
02050 return new Zoom[n];
02051 }
02052 };
02053
02059 public Zoom(Integer playerid, String zoom) {
02060 super();
02061 addParameter("playerid", playerid);
02062 addParameter("zoom", zoom);
02063 }
02064
02070 public Zoom(Integer playerid, Integer zoom) {
02071 super();
02072 addParameter("playerid", playerid);
02073 addParameter("zoom", zoom);
02074 }
02075
02076 @Override
02077 protected String parseOne(JsonNode node) {
02078 return node.getTextValue();
02079 }
02080
02081 @Override
02082 public String getName() {
02083 return API_TYPE;
02084 }
02085
02086 @Override
02087 protected boolean returnsList() {
02088 return false;
02089 }
02090
02094 public interface ZoomValue {
02095
02096 public final String IN = "in";
02097 public final String OUT = "out";
02098
02099 public final static Set<String> values = new HashSet<String>(Arrays.asList(IN, OUT));
02100 }
02101 }
02102 }