Переглянути джерело

Fixes issue 1487.


git-svn-id: http://svn.dmdirc.com/trunk@4639 00569f92-eb28-0410-84fd-f71c24880f
tags/0.6.3m1rc1
Shane Mc Cormack 16 роки тому
джерело
коміт
e9602f87c5

+ 13
- 0
src/com/dmdirc/addons/mediasource_dcop/AmarokSource.java Переглянути файл

@@ -55,6 +55,19 @@ public class AmarokSource implements MediaSource {
55 55
         return Boolean.parseBoolean(result);
56 56
     }
57 57
     
58
+    /** {@inheritDoc} */
59
+    @Override
60
+    public boolean isStopped() {
61
+        final String result = DcopPlugin.getDcopResult(
62
+                "dcop amarok player status").get(0);
63
+        
64
+        try {
65
+            return (Integer.parseInt(result) == 0);
66
+        } catch (NumberFormatException nfe) {
67
+            return false;
68
+        }
69
+    }
70
+    
58 71
     /** {@inheritDoc} */
59 72
     @Override
60 73
     public String getAppName() {

+ 9
- 1
src/com/dmdirc/addons/mediasource_dcop/KaffeineSource.java Переглянути файл

@@ -38,12 +38,20 @@ public class KaffeineSource implements MediaSource {
38 38
     }
39 39
     
40 40
     /** {@inheritDoc} */
41
-    public boolean isRunning() {        
41
+    public boolean isRunning() {
42 42
         return DcopPlugin.getDcopResult("dcop kaffeine KaffeineIface isPlaying").size() > 0;
43 43
     }
44 44
     
45 45
     /** {@inheritDoc} */
46 46
     public boolean isPlaying() {
47
+        // This also returns true for paused, which makes it rather useless!
48
+        final String result = DcopPlugin.getDcopResult("dcop kaffeine KaffeineIface isPlaying").get(0);
49
+        
50
+        return Boolean.parseBoolean(result);
51
+    }
52
+    
53
+    /** {@inheritDoc} */
54
+    public boolean isStopped() {
47 55
         final String result = DcopPlugin.getDcopResult("dcop kaffeine KaffeineIface isPlaying").get(0);
48 56
         
49 57
         return Boolean.parseBoolean(result);

+ 8
- 0
src/com/dmdirc/addons/mediasource_dcop/NoatunSource.java Переглянути файл

@@ -50,6 +50,14 @@ public class NoatunSource implements MediaSource {
50 50
         return "2".equals(result.trim());
51 51
     }
52 52
     
53
+    /** {@inheritDoc} */
54
+    public boolean isStopped() {
55
+        final String result = DcopPlugin.getDcopResult(
56
+                "dcop noatun Noatun state").get(0);
57
+        
58
+        return "0".equals(result.trim());
59
+    }
60
+    
53 61
     /** {@inheritDoc} */
54 62
     public String getAppName() {
55 63
         return "Noatun";

+ 7
- 0
src/com/dmdirc/addons/mediasource_vlc/VlcMediaSourcePlugin.java Переглянути файл

@@ -60,6 +60,13 @@ public class VlcMediaSourcePlugin extends Plugin implements MediaSource {
60 60
     public boolean isPlaying() {
61 61
         return information.get("state").equalsIgnoreCase("playing");
62 62
     }
63
+    
64
+
65
+    /** {@inheritDoc} */
66
+    @Override    
67
+    public boolean isStopped() {
68
+        return information.get("state").equalsIgnoreCase("stop");
69
+    }
63 70
 
64 71
     /** {@inheritDoc} */
65 72
     @Override    

+ 5
- 0
src/com/dmdirc/addons/mediasource_windows/DllSource.java Переглянути файл

@@ -83,6 +83,11 @@ public class DllSource implements MediaSource {
83 83
 		return getOutput("getPlayState").equalsIgnoreCase("playing");
84 84
 	}
85 85
 	
86
+	/** {@inheritDoc} */
87
+	public boolean isStopped() {
88
+		return getOutput("getPlayState").equalsIgnoreCase("stopped");
89
+	}
90
+	
86 91
 	/** {@inheritDoc} */
87 92
 	public String getArtist() {
88 93
 		if (useArtistTitle) {

+ 6
- 0
src/com/dmdirc/addons/nowplaying/ConfigPanel.java Переглянути файл

@@ -256,6 +256,12 @@ public class ConfigPanel extends JPanel implements PreferencesInterface, KeyList
256 256
             return true;
257 257
         }
258 258
 
259
+        /** {@inheritDoc} */
260
+        @Override
261
+        public boolean isStopped() {
262
+            return false;
263
+        }
264
+
259 265
         /** {@inheritDoc} */
260 266
         @Override
261 267
         public String getAppName() {

+ 8
- 0
src/com/dmdirc/addons/nowplaying/MediaSource.java Переглянути файл

@@ -44,6 +44,14 @@ public interface MediaSource {
44 44
      */
45 45
     boolean isPlaying();
46 46
     
47
+    /**
48
+     * Determine if this source is stopped or not.
49
+     * 
50
+     * @return True if this source is stopped, false otherwise
51
+     * @since 0.6.3
52
+     */
53
+    boolean isStopped();
54
+    
47 55
     /**
48 56
      * Retrieves the name of the application that this source is for.
49 57
      * 

Завантаження…
Відмінити
Зберегти