1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.xnap.util.launcher;
21
22 import java.io.File;
23 import java.io.IOException;
24
25 import org.xnap.XNap;
26
27 /***
28 * Provides player support for Noatun through dcop.
29 */
30 public class NoatunPlayer extends DefaultPlayer
31 {
32
33
34
35
36
37
38
39 public NoatunPlayer()
40 {
41 super("noatun", XNap.tr("Noatun"), "");
42 }
43
44
45
46 public boolean canPlay(File f)
47 {
48 String lower = f.getName().toLowerCase();
49 return super.canPlay(f) || lower.endsWith(".wav")
50 || lower.endsWith(".ogg") || lower.endsWith("mpg")
51 || lower.endsWith("mpeg");
52 }
53
54 public boolean isEditable()
55 {
56 return false;
57 }
58
59 public void enqueue(File file) throws IOException
60 {
61 String args[] = {
62 "dcop", "noatun", "Noatun", "addFile", file.getAbsolutePath(),
63 "false"
64 };
65
66 Runtime.getRuntime().exec(args);
67 }
68
69 public void open(File file) throws IOException
70 {
71 String args[] = {
72 "dcop", "noatun", "Noatun", "addFile", file.getAbsolutePath(),
73 "true"
74 };
75
76 Runtime.getRuntime().exec(args);
77 }
78
79 public void start() throws IOException
80 {
81 String args[] = {
82 "dcop", "noatun", "Noatun", "playpause"
83 };
84
85 Runtime.getRuntime().exec(args);
86 }
87
88 public void stop()
89 {
90 String args[] = {
91 "dcop", "noatun", "Noatun", "stop"
92 };
93
94 try {
95 Runtime.getRuntime().exec(args);
96 }
97 catch (IOException e) {
98 }
99 }
100
101 }