diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2008-09-28 16:51:21 +0000 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2008-09-28 16:51:21 +0000 |
commit | f894a67b52aaaeba19ebfa8a9e8cb2441093b375 (patch) | |
tree | dd6fd64a44cca7027d7f998bc034367461cfa0e8 | |
parent | bd90f0965333b247a5e50422d0a1d9292dd9fd5a (diff) | |
download | instadisc-f894a67b52aaaeba19ebfa8a9e8cb2441093b375.tar.gz instadisc-f894a67b52aaaeba19ebfa8a9e8cb2441093b375.tar.bz2 instadisc-f894a67b52aaaeba19ebfa8a9e8cb2441093b375.zip |
Client: Completed steps 12, 13 and 14
Closes #69
-rw-r--r-- | client/trunk/src/com/fourisland/instadisc/DownloadItem/PullMode.java | 26 | ||||
-rw-r--r-- | client/trunk/src/com/fourisland/instadisc/Item/Item.java | 2 |
2 files changed, 21 insertions, 7 deletions
diff --git a/client/trunk/src/com/fourisland/instadisc/DownloadItem/PullMode.java b/client/trunk/src/com/fourisland/instadisc/DownloadItem/PullMode.java index a14ef1c..be9c09a 100644 --- a/client/trunk/src/com/fourisland/instadisc/DownloadItem/PullMode.java +++ b/client/trunk/src/com/fourisland/instadisc/DownloadItem/PullMode.java | |||
@@ -1,28 +1,42 @@ | |||
1 | package com.fourisland.instadisc.DownloadItem; | 1 | package com.fourisland.instadisc.DownloadItem; |
2 | 2 | ||
3 | import com.fourisland.instadisc.Item.Item; | ||
4 | import com.fourisland.instadisc.XmlRpc; | ||
5 | |||
3 | public class PullMode implements DownloadItemMode | 6 | public class PullMode implements DownloadItemMode |
4 | { | 7 | { |
5 | public void modeInitalize() { | 8 | public void modeInitalize() { |
6 | throw new UnsupportedOperationException("Not supported yet."); | ||
7 | } | 9 | } |
8 | 10 | ||
9 | public void modeDeinitalize() { | 11 | public void modeDeinitalize() { |
10 | throw new UnsupportedOperationException("Not supported yet."); | ||
11 | } | 12 | } |
12 | 13 | ||
13 | public void requestRetained() { | 14 | public void requestRetained() { |
14 | throw new UnsupportedOperationException("Not supported yet."); | 15 | XmlRpc xmlrpc = new XmlRpc("requestRetained"); |
16 | Item item = new Item((String) xmlrpc.execute()); | ||
17 | item.start(); | ||
18 | |||
19 | while (item.headerMap.containsKey("More")) | ||
20 | { | ||
21 | xmlrpc = new XmlRpc("sendItem"); | ||
22 | xmlrpc.addParam(Integer.decode(item.headerMap.get("More"))); | ||
23 | item = new Item((String) xmlrpc.execute()); | ||
24 | item.start(); | ||
25 | } | ||
15 | } | 26 | } |
16 | 27 | ||
17 | public void resendItem(int id) { | 28 | public void resendItem(int id) { |
18 | throw new UnsupportedOperationException("Not supported yet."); | 29 | XmlRpc xmlrpc = new XmlRpc("resendItem"); |
30 | xmlrpc.addParam(id); | ||
31 | Item item = new Item((String) xmlrpc.execute()); | ||
32 | item.start(); | ||
19 | } | 33 | } |
20 | 34 | ||
21 | public int setTimer() { | 35 | public int setTimer() { |
22 | throw new UnsupportedOperationException("Not supported yet."); | 36 | return (60 * 5); // 5 minutes |
23 | } | 37 | } |
24 | 38 | ||
25 | public void timerTick() { | 39 | public void timerTick() { |
26 | throw new UnsupportedOperationException("Not supported yet."); | 40 | requestRetained(); |
27 | } | 41 | } |
28 | } \ No newline at end of file | 42 | } \ No newline at end of file |
diff --git a/client/trunk/src/com/fourisland/instadisc/Item/Item.java b/client/trunk/src/com/fourisland/instadisc/Item/Item.java index 272ce2d..49a2c75 100644 --- a/client/trunk/src/com/fourisland/instadisc/Item/Item.java +++ b/client/trunk/src/com/fourisland/instadisc/Item/Item.java | |||
@@ -19,7 +19,7 @@ import java.util.HashMap; | |||
19 | */ | 19 | */ |
20 | public class Item { | 20 | public class Item { |
21 | 21 | ||
22 | HashMap<String, String> headerMap; | 22 | public HashMap<String, String> headerMap; |
23 | 23 | ||
24 | public Item(String result) { | 24 | public Item(String result) { |
25 | String[] headers = result.toString().split("\n"); | 25 | String[] headers = result.toString().split("\n"); |