~ubuntu-branches/ubuntu/trusty/mediathekview/trusty

« back to all changes in this revision

Viewing changes to src/mediathek/controller/starter/Start.java

  • Committer: Package Import Robot
  • Author(s): Markus Koschany
  • Date: 2014-01-07 17:25:52 UTC
  • mfrom: (4.1.6 sid)
  • Revision ID: package-import@ubuntu.com-20140107172552-vkv6uixpou3sa5og
Tags: 4-1
* Imported Upstream version 4.
* Declare compliance with Standards-Version 3.9.5.
* Correct a mistake in the last changelog entry.
  - build-dependencies <-> dependencies
* Override lintian warning:incompatible-java-bytecode-format Java7 because
  Java7 is the current default JRE for Jessie. MediathekView also requires
  Java7 to run and is incompatible with Java6 or earlier.
* debian/control: Add libjackson2-core-java, libtimingframework-java and
  libxz-java to Build-Depends-Indep.
* Drop README.source. Now upstream provides a source tarball.
* Refresh modify-ant-build-system.patch.
* debian/rules: Remove get-orig-source target. No longer needed.
* Update mediathekview.manifest. Add new required libraries to classpath.
* Update debian/watch for new versioning scheme.
* Update debian/copyright for new release. Add BSD-3-clause license.
* Update man pages and remove unsupported options.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*    
 
2
 *    MediathekView
 
3
 *    Copyright (C) 2008   W. Xaver
 
4
 *    W.Xaver[at]googlemail.com
 
5
 *    http://zdfmediathk.sourceforge.net/
 
6
 *    
 
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
 
10
 *    any later version.
 
11
 *
 
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.
 
16
 *
 
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/>.
 
19
 */
 
20
package mediathek.controller.starter;
 
21
 
 
22
import mediathek.tool.Datum;
 
23
import mediathek.tool.MVInputStream;
 
24
 
 
25
public class Start {
 
26
 
 
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";
 
54
    // Stati
 
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;
 
61
 
 
62
    public Start() {
 
63
    }
 
64
 
 
65
    public static String getTextProgress(Start s) {
 
66
        String ret = "";
 
67
        if (s == null) {
 
68
            return "";
 
69
        }
 
70
        if (s.percent == PROGRESS_NICHT_GESTARTET) {
 
71
            // noch nicht gestartet
 
72
        } else if (s.percent == PROGRESS_WARTEN) {
 
73
            ret = "warten";
 
74
        } else if (s.percent == PROGRESS_GESTARTET) {
 
75
            ret = "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) {
 
81
                ret = "fehlerhaft";
 
82
            } else {
 
83
                ret = "fertig";
 
84
            }
 
85
        }
 
86
        return ret;
 
87
    }
 
88
}