workspace
Révision | 22c1f1b7b5aa5f26121bf065ba4b5021ddeec18a (tree) |
---|---|
l'heure | 2011-12-01 10:47:54 |
Auteur | harioroidios <kiyonari1986@gmai...> |
Commiter | harioroidios |
feeds an insufficient attribute is added.
@@ -16,6 +16,11 @@ public interface Feeds { | ||
16 | 16 | public ContentEntity getContent(); |
17 | 17 | public String getDuration(); |
18 | 18 | public String getAspectRatio(); |
19 | - public String getCommentCount(); | |
19 | + public float getRating(); | |
20 | + public int getLikeCount(); | |
21 | + public int getRatingCount(); | |
22 | + public int getViewCount(); | |
23 | + public int getFavoriteCount(); | |
24 | + public int getCommentCount(); | |
20 | 25 | public AccessControlEntity getAccessControl(); |
21 | 26 | } |
@@ -15,12 +15,10 @@ public class Version { | ||
15 | 15 | public static String getVersion() { |
16 | 16 | return VERSION; |
17 | 17 | } |
18 | - /* | |
19 | 18 | private static final String developer_key="AI39si7Tguq6DbpUUt4kJp2hvXxurSgehZ6I7H91L0az3wU8udWoRPOBqOoT1fnlpGahzuU1q_aZnLqEckDjfCTnqDSmXLvFAw"; |
20 | 19 | private static final String client_id="YouTubeSample"; |
21 | 20 | private static final String user_id="kiyonari1986@gmail.com"; |
22 | 21 | private static final String password="harigae1986"; |
23 | - */ | |
24 | 22 | /** |
25 | 23 | * prints the version string |
26 | 24 | * |
@@ -28,7 +26,6 @@ public class Version { | ||
28 | 26 | */ |
29 | 27 | public static void main(String[] args) { |
30 | 28 | System.out.println(TITLE + " " + VERSION); |
31 | - /* | |
32 | 29 | ConfigurationBuilder conf = new ConfigurationBuilder(); |
33 | 30 | conf.setDeveloperKey(developer_key); |
34 | 31 | conf.setClientID(client_id); |
@@ -50,7 +47,6 @@ public class Version { | ||
50 | 47 | // TODO 自動生成された catch ブロック |
51 | 48 | e.printStackTrace(); |
52 | 49 | } |
53 | - */ | |
54 | 50 | } |
55 | 51 | |
56 | 52 | } |
@@ -21,9 +21,10 @@ import yt4droid.internal.org.json.JSONException; | ||
21 | 21 | import yt4droid.internal.org.json.JSONObject; |
22 | 22 | |
23 | 23 | import static yt4droid.util.JSONParseUtil.getRawString; |
24 | -import static yt4droid.util.JSONParseUtil.getDate; | |
25 | 24 | import static yt4droid.util.JSONParseUtil.getArrangement; |
26 | 25 | import static yt4droid.util.JSONParseUtil.parseTrendsDate; |
26 | +import static yt4droid.util.JSONParseUtil.getInt; | |
27 | +import static yt4droid.util.JSONParseUtil.getFloat; | |
27 | 28 | |
28 | 29 | public class FeedsParser implements Feeds{ |
29 | 30 |
@@ -40,7 +41,12 @@ public class FeedsParser implements Feeds{ | ||
40 | 41 | private ContentEntity content; |
41 | 42 | private String duration; |
42 | 43 | private String aspectRatio; |
43 | - private String commentCount; | |
44 | + private float rating; | |
45 | + private int likeCount; | |
46 | + private int ratingCount; | |
47 | + private int viewCount; | |
48 | + private int favoriteCount; | |
49 | + private int commentCount; | |
44 | 50 | private AccessControlEntity accessControl; |
45 | 51 | |
46 | 52 | protected FeedsParser(HttpResponse res, Configuration conf) throws YoutubeException{ |
@@ -75,7 +81,12 @@ public class FeedsParser implements Feeds{ | ||
75 | 81 | } |
76 | 82 | duration = getRawString("duration", json); |
77 | 83 | aspectRatio = getRawString("aspectRatio", json); |
78 | - commentCount = getRawString("commentCount", json); | |
84 | + rating = getFloat("rating", json); | |
85 | + likeCount = getInt("likeCount", json); | |
86 | + ratingCount = getInt("ratingCount", json); | |
87 | + viewCount = getInt("viewCount", json); | |
88 | + favoriteCount = getInt("favoriteCount", json); | |
89 | + commentCount = getInt("commentCount", json); | |
79 | 90 | try { |
80 | 91 | accessControl = new AccessControlEntityImpl(json); |
81 | 92 | } catch (JSONException ignore) { |
@@ -148,7 +159,37 @@ public class FeedsParser implements Feeds{ | ||
148 | 159 | } |
149 | 160 | |
150 | 161 | @Override |
151 | - public String getCommentCount() { | |
162 | + public float getRating() { | |
163 | + // TODO 自動生成されたメソッド・スタブ | |
164 | + return rating; | |
165 | + } | |
166 | + | |
167 | + @Override | |
168 | + public int getLikeCount() { | |
169 | + // TODO 自動生成されたメソッド・スタブ | |
170 | + return likeCount; | |
171 | + } | |
172 | + | |
173 | + @Override | |
174 | + public int getRatingCount() { | |
175 | + // TODO 自動生成されたメソッド・スタブ | |
176 | + return ratingCount; | |
177 | + } | |
178 | + | |
179 | + @Override | |
180 | + public int getViewCount() { | |
181 | + // TODO 自動生成されたメソッド・スタブ | |
182 | + return viewCount; | |
183 | + } | |
184 | + | |
185 | + @Override | |
186 | + public int getFavoriteCount() { | |
187 | + // TODO 自動生成されたメソッド・スタブ | |
188 | + return favoriteCount; | |
189 | + } | |
190 | + | |
191 | + @Override | |
192 | + public int getCommentCount() { | |
152 | 193 | return commentCount; |
153 | 194 | } |
154 | 195 |
@@ -176,5 +217,4 @@ public class FeedsParser implements Feeds{ | ||
176 | 217 | throw ye; |
177 | 218 | } |
178 | 219 | } |
179 | - | |
180 | 220 | } |
@@ -153,6 +153,16 @@ public class JSONParseUtil { | ||
153 | 153 | return Double.valueOf(str2); |
154 | 154 | } |
155 | 155 | } |
156 | + | |
157 | + public static float getFloat(String name, JSONObject json){ | |
158 | + String str = getRawString(name, json); | |
159 | + if(null == str || "".equals(str) || "null".equals(str)) { | |
160 | + return -1f; | |
161 | + } | |
162 | + else{ | |
163 | + return Float.valueOf(str); | |
164 | + } | |
165 | + } | |
156 | 166 | |
157 | 167 | public static boolean getBoolean(String name, JSONObject json) { |
158 | 168 | String str = getRawString(name, json); |