about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2008-09-28 16:51:21 +0000
committerKelly Rauchenberger <fefferburbia@gmail.com>2008-09-28 16:51:21 +0000
commitf894a67b52aaaeba19ebfa8a9e8cb2441093b375 (patch)
treedd6fd64a44cca7027d7f998bc034367461cfa0e8
parentbd90f0965333b247a5e50422d0a1d9292dd9fd5a (diff)
downloadinstadisc-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.java26
-rw-r--r--client/trunk/src/com/fourisland/instadisc/Item/Item.java2
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 @@
1package com.fourisland.instadisc.DownloadItem; 1package com.fourisland.instadisc.DownloadItem;
2 2
3import com.fourisland.instadisc.Item.Item;
4import com.fourisland.instadisc.XmlRpc;
5
3public class PullMode implements DownloadItemMode 6public 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 */
20public class Item { 20public 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");