Update of /cvsroot/jpodder/jPodder3/jpodder/src/java/com/jpodder/data/download
In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv19771/jpodder/src/java/com/jpodder/data/download
Modified Files:
DownloadLogic.java
Log Message:
Index: DownloadLogic.java
===================================================================
RCS file: /cvsroot/jpodder/jPodder3/jpodder/src/java/com/jpodder/data/download/DownloadLogic.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** DownloadLogic.java 27 Apr 2006 06:07:47 -0000 1.2
--- DownloadLogic.java 4 Jun 2006 09:48:20 -0000 1.3
***************
*** 63,67 ****
private static DownloadLogic sSelf;
!
public static DownloadLogic getInstance() {
if (sSelf == null) {
--- 63,69 ----
private static DownloadLogic sSelf;
!
! private boolean mPauzed = false;
!
public static DownloadLogic getInstance() {
if (sSelf == null) {
***************
*** 136,139 ****
--- 138,142 ----
}
+
/**
* This method will create the folder and file to store the download. it
***************
*** 146,150 ****
public void download(Download pDownload) {
! XPersonalEnclosure encl = pDownload.getEnclosure();
XPersonalFeed lFeed = encl.getFeed();
// File lFile = null;
--- 149,157 ----
public void download(Download pDownload) {
! if(mPauzed){
! return; // Downloads are not added in status pauzed.
! }
!
! XPersonalEnclosure encl = pDownload.getEnclosure();
XPersonalFeed lFeed = encl.getFeed();
// File lFile = null;
***************
*** 152,155 ****
--- 159,163 ----
File lFolderFile = new File(lFolder);
+
if (!lFolderFile.exists()) {
// Create the subdirectory & file
***************
*** 176,180 ****
mLog.warn(ie.getMessage());
}
-
}
--- 184,187 ----
***************
*** 183,187 ****
*/
public void pauzeAll() {
! for (int i = 0; i < mDownloadList.size(); i++) {
Download lDownload = (Download) mDownloadList.get(i);
int lState = lDownload.getState();
--- 190,195 ----
*/
public void pauzeAll() {
! mPauzed = true;
! for (int i = 0; i < mDownloadList.size(); i++) {
Download lDownload = (Download) mDownloadList.get(i);
int lState = lDownload.getState();
***************
*** 200,204 ****
*/
public void resumeAll() {
! for (int i = 0; i < mDownloadList.size(); i++) {
Download lDownload = (Download) mDownloadList.get(i);
if (lDownload.getState() == PAUZED) {
--- 208,213 ----
*/
public void resumeAll() {
! this.mPauzed = false;
! for (int i = 0; i < mDownloadList.size(); i++) {
Download lDownload = (Download) mDownloadList.get(i);
if (lDownload.getState() == PAUZED) {
***************
*** 367,371 ****
return false;
}
!
/**
* Reset the download object. (Basically same as a new download object).
--- 376,401 ----
return false;
}
!
! /**
! * Retry a download.(Not possible in status pauzed).
! */
! public void retry(Download pDownload){
! if(!mPauzed){
! resetDownload(pDownload);
! download(pDownload);
! }else{
! mLog.info("Retry not allowed in status pauzed");
! }
! }
!
! /**
! * Check the status of this service.
! * @return
! */
! public boolean getPauzed(){
! return mPauzed;
! }
!
!
/**
* Reset the download object. (Basically same as a new download object).
***************
*** 516,521 ****
/**
! * Repetively update download tasks in the downloadlist. It performs various
! * tasks depending on the status of the task.
*/
public void heartBeat() {
--- 546,551 ----
/**
! * Update elapsed time (+ 1 second) and bandwith for each download.
! *
*/
public void heartBeat() {
|