3
* Copyright (C) 2008 W. Xaver
4
* W.Xaver[at]googlemail.com
5
* http://zdfmediathk.sourceforge.net/
7
* This program is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20
package mediathek.controller.starter;
22
import mediathek.tool.Datum;
23
import mediathek.tool.MVInputStream;
27
public static final int PROGRESS_NICHT_GESTARTET = -1;
28
public static final int PROGRESS_WARTEN = 0;
29
public static final int PROGRESS_GESTARTET = 1;
30
public static final int PROGRESS_FERTIG = 1000;
31
public int status = STATUS_INIT;
32
public int startcounter = 0;
33
public Process process = null; //Prozess des Download
34
public int percent = -1; // Prozent fertiggestellt: -1=nix, 999=99,9%
35
public long bandbreite = -1; // Downloadbandbreite
36
public boolean stoppen = false;
37
public boolean beginnAnschauen = false;
38
public Datum startZeit = null;
39
public long restSekunden = -1;
40
public MVInputStream mVInputStream = null;
41
// Quelle - start über einen Button - Download - Abo
42
public static final int QUELLE_ALLE = -1;
43
public static final int QUELLE_BUTTON = 1;
44
public static final int QUELLE_DOWNLOAD = 2;
45
public static final int QUELLE_ABO = 3;
46
public static final String QUELLE_ALLE_TXT = "Alle";
47
public static final String QUELLE_BUTTON_TXT = "Button";
48
public static final String QUELLE_DOWNLOAD_TXT = "Download";
49
public static final String QUELLE_ABO_TXT = "Abo";
50
public static final int ART_DOWNLOAD = 1; // direkter Download
51
public static final int ART_PROGRAMM = 2; // Download über ein Programm
52
public static final String ART_DOWNLOAD_TXT = "direkter Download";
53
public static final String ART_PROGRAMM_TXT = "Programm";
55
public static final int STATUS_INIT = 1;
56
public static final int STATUS_RUN = 2;
57
public static final int STATUS_FERTIG = 3;
58
public static final int STATUS_ERR = 4;
59
//Download wird so oft gestartet, falls er beim ersten Mal nicht anspringt
60
public static final int STARTCOUNTER_MAX = 3;
65
public static String getTextProgress(Start s) {
70
if (s.percent == PROGRESS_NICHT_GESTARTET) {
71
// noch nicht gestartet
72
} else if (s.percent == PROGRESS_WARTEN) {
74
} else if (s.percent == PROGRESS_GESTARTET) {
76
} else if (1 < s.percent && s.percent < PROGRESS_FERTIG) {
77
double d = s.percent / 10.0;
78
ret = Double.toString(d) + "%";
79
} else if (s.percent == PROGRESS_FERTIG) {
80
if (s.status == Start.STATUS_ERR) {