|
@@ -47,17 +47,14 @@ public class WindowsMediaSourcePlugin extends Plugin implements MediaSourceManag
|
47
|
47
|
/** Media sources. */
|
48
|
48
|
private final List<MediaSource> sources;
|
49
|
49
|
|
50
|
|
- /** Files dir */
|
51
|
|
- private static final String filesDir = Main.getConfigDir() + "plugins/windowsmediasource_files/";
|
52
|
|
-
|
53
|
50
|
/**
|
54
|
51
|
* Creates a new instance of DcopMediaSourcePlugin.
|
55
|
52
|
*/
|
56
|
53
|
public WindowsMediaSourcePlugin() {
|
57
|
54
|
super();
|
58
|
55
|
sources = new ArrayList<MediaSource>();
|
59
|
|
- sources.add(new DllSource("Winamp", true));
|
60
|
|
- sources.add(new DllSource("iTunes", false));
|
|
56
|
+ sources.add(new DllSource(this, "Winamp", true));
|
|
57
|
+ sources.add(new DllSource(this, "iTunes", false));
|
61
|
58
|
}
|
62
|
59
|
|
63
|
60
|
/** {@inheritDoc} */
|
|
@@ -73,9 +70,9 @@ public class WindowsMediaSourcePlugin extends Plugin implements MediaSourceManag
|
73
|
70
|
* @param method Method to call
|
74
|
71
|
* @return a MediaInfoOutput with the results
|
75
|
72
|
*/
|
76
|
|
- protected static MediaInfoOutput getOutput(final String player, final String method) {
|
|
73
|
+ protected MediaInfoOutput getOutput(final String player, final String method) {
|
77
|
74
|
try {
|
78
|
|
- final Process myProcess = Runtime.getRuntime().exec(new String[]{filesDir + "GetMediaInfo.exe", player, method});
|
|
75
|
+ final Process myProcess = Runtime.getRuntime().exec(new String[]{getFilesDirString() + "GetMediaInfo.exe", player, method});
|
79
|
76
|
final StringBuffer data = new StringBuffer();
|
80
|
77
|
new StreamReader(myProcess.getErrorStream()).start();
|
81
|
78
|
new StreamReader(myProcess.getInputStream(), data).start();
|
|
@@ -107,16 +104,10 @@ public class WindowsMediaSourcePlugin extends Plugin implements MediaSourceManag
|
107
|
104
|
try {
|
108
|
105
|
final ResourceManager res = pi.getResourceManager();
|
109
|
106
|
|
110
|
|
- // Make sure our files dir exists
|
111
|
|
- final File newDir = new File(filesDir);
|
112
|
|
- if (!newDir.exists()) {
|
113
|
|
- newDir.mkdirs();
|
114
|
|
- }
|
115
|
|
-
|
116
|
|
- // Now extract the .dlls and .exe
|
|
107
|
+ // Extract the .dlls and .exe
|
117
|
108
|
try {
|
118
|
|
- res.extractResoucesEndingWith(newDir, ".dll");
|
119
|
|
- res.extractResoucesEndingWith(newDir, ".exe");
|
|
109
|
+ res.extractResoucesEndingWith(getFilesDir(), ".dll");
|
|
110
|
+ res.extractResoucesEndingWith(getFilesDir(), ".exe");
|
120
|
111
|
} catch (IOException ex) {
|
121
|
112
|
Logger.userError(ErrorLevel.MEDIUM, "Unable to extract files for windows media source: " + ex.getMessage(), ex);
|
122
|
113
|
}
|