Exemplo n.º 1
0
 public static Video parse(JSONObject o) throws NumberFormatException, JSONException {
   Video v = new Video();
   if (o.has("vid")) v.vid = o.getLong("vid");
   if (o.has("id")) // video.getUserVideos
   v.vid = Long.parseLong(o.getString("id"));
   v.owner_id = o.getLong("owner_id");
   v.title = Api.unescape(o.getString("title"));
   v.duration = o.getLong("duration");
   v.description = Api.unescape(o.optString("description"));
   if (o.has("image")) v.image = o.optString("image");
   v.image_big = o.optString("image_medium");
   if (o.has("thumb")) // video.getUserVideos
   v.image = o.optString("thumb");
   v.link = o.optString("link");
   v.date = o.optLong("date");
   v.player = o.optString("player");
   if (o.has("views")) {
     v.views = o.getLong("views");
   }
   JSONObject files = o.optJSONObject("files");
   if (files != null) {
     v.external = files.optString("external");
     v.mp4_240 = files.optString("mp4_240");
     v.mp4_360 = files.optString("mp4_360");
     v.mp4_480 = files.optString("mp4_480");
     v.mp4_720 = files.optString("mp4_720");
     v.flv_320 = files.optString("flv_320");
   }
   return v;
 }
Exemplo n.º 2
0
 public static Video parseForAttachments(JSONObject o)
     throws NumberFormatException, JSONException {
   Video v = new Video();
   if (o.has("vid")) v.vid = o.getLong("vid");
   if (o.has("id")) // video.getUserVideos
   v.vid = Long.parseLong(o.getString("id"));
   v.owner_id = o.getLong("owner_id");
   v.title = Api.unescape(o.getString("title"));
   v.duration = o.getLong("duration");
   v.description = Api.unescape(o.optString("description"));
   if (o.has("image")) v.image = o.optString("image");
   v.image_big = o.optString("image_big");
   if (o.has("thumb")) // video.getUserVideos
   v.image = o.optString("thumb");
   v.link = o.optString("link");
   v.date = o.optLong("date");
   v.player = o.optString("player");
   if (o.has("views")) {
     v.views = o.getLong("views");
   }
   return v;
 }