Added
Link Here
|
1 |
--- source/qm_mpdcom.cpp.orig 2024-02-02 09:26:32 UTC |
2 |
+++ source/qm_mpdcom.cpp |
3 |
@@ -369,32 +369,35 @@ QString qm_mpdCommand::get_mpdconf_path() |
4 |
mpdconf_path = find_config_files(false); |
5 |
} |
6 |
|
7 |
- if (confpath.isEmpty()) |
8 |
+ if (confpath.isEmpty() && mpdconf_path.isEmpty()) |
9 |
b_mpdconf_found = false; |
10 |
else |
11 |
b_mpdconf_found = true; |
12 |
|
13 |
+ if (!mpdconf_path.isEmpty()) |
14 |
+ return mpdconf_path; |
15 |
+ |
16 |
return confpath; |
17 |
} |
18 |
|
19 |
-// Get mpd.conf from /etc/default/mpd |
20 |
+// Get mpd.conf from %%PREFIX%%/etc/musicpd.conf |
21 |
QString qm_mpdCommand::get_etc_default_mpd() |
22 |
{ |
23 |
QFile file; |
24 |
QString line = ""; |
25 |
|
26 |
- file.setFileName("/etc/default/mpd"); |
27 |
+ file.setFileName("%%PREFIX%%/etc/musicpd.conf"); |
28 |
if ( !file.exists() ) |
29 |
{ |
30 |
if (config->cout_extensive) |
31 |
- printf ("MPD's config: Tried /etc/default/mpd but it does not exist\n"); |
32 |
+ printf ("MPD's config: Tried %%PREFIX%%/etc/musicpd.conf but it does not exist\n"); |
33 |
return line; |
34 |
} |
35 |
|
36 |
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) |
37 |
{ |
38 |
if (config->cout_extensive) |
39 |
- printf ("MPD's config: Tried /etc/default/mpd but it is not readable\n"); |
40 |
+ printf ("MPD's config: Tried %%PREFIX%%/etc/musicpd.conf but it is not readable\n"); |
41 |
return line; |
42 |
} |
43 |
else |
44 |
@@ -418,19 +421,19 @@ QString qm_mpdCommand::get_etc_default_mpd() |
45 |
if (!file.exists()) |
46 |
{ |
47 |
if (config->cout_extensive) |
48 |
- printf ("MPD's config in /etc/default/mpd does not exist\n"); |
49 |
+ printf ("MPD's config in %%PREFIX%%/etc/musicpd.conf does not exist\n"); |
50 |
line = ""; |
51 |
} |
52 |
} |
53 |
else |
54 |
{ |
55 |
if (config->cout_extensive) |
56 |
- printf ("MPD's config: Tried /etc/default/mpd but MPDCONF is not set\n"); |
57 |
+ printf ("MPD's config: Tried %%PREFIX%%/etc/musicpd.conf but MPDCONF is not set\n"); |
58 |
} |
59 |
|
60 |
if (!line.isEmpty() && config->cout_extensive) |
61 |
{ |
62 |
- printf ("MPD's config from /etc/default/mpd: %s\n", line.toUtf8().constData()); |
63 |
+ printf ("MPD's config from %%PREFIX%%/etc/musicpd.conf: %s\n", line.toUtf8().constData()); |
64 |
} |
65 |
|
66 |
return line; |
67 |
@@ -2996,7 +2999,7 @@ QString qm_mpdCommand::find_config_files(bool show_dia |
68 |
|
69 |
QString qm_mpdCommand::find_config_files(bool show_dialog) |
70 |
{ |
71 |
-/* If not specified on the command-line or in /etc/default/mpd |
72 |
+/* If not specified on the command-line or in %%PREFIX%%/etc/musicpd.conf |
73 |
MPD searches |
74 |
1st at ~/.config/mpd/mpd.conf |
75 |
2nd at ~/.mpdconf |
76 |
@@ -3062,20 +3065,20 @@ QString qm_mpdCommand::find_config_files(bool show_dia |
77 |
} |
78 |
} |
79 |
|
80 |
- thispath = "/etc/mpd.conf"; |
81 |
+ thispath = "%%PREFIX%%/etc/musicpd.conf"; |
82 |
file.setFileName(thispath); |
83 |
if ( file.exists() ) |
84 |
{ |
85 |
if (file.open(QIODevice::ReadOnly)) |
86 |
{ |
87 |
file.close(); |
88 |
- printf ("located: /etc/mpd.conf\n"); |
89 |
+ printf ("located: %%PREFIX%%/etc/musicpd.conf\n"); |
90 |
return thispath; |
91 |
} |
92 |
else |
93 |
{ |
94 |
if (config->cout_extensive) |
95 |
- printf ("/etc/mpd.conf, but it is not readable\n"); |
96 |
+ printf ("%%PREFIX%%/etc/musicpd.conf, but it is not readable\n"); |
97 |
} |
98 |
} |
99 |
|
100 |
@@ -3196,7 +3199,7 @@ bool qm_mpdCommand::is_mpd_installed(bool showmsg) |
101 |
{ |
102 |
QProcess proc; |
103 |
proc.setProgram("which"); |
104 |
- proc.setArguments({"mpd"}); |
105 |
+ proc.setArguments({"musicpd"}); |
106 |
proc.start(); |
107 |
if (!proc.waitForFinished()) |
108 |
{ |
109 |
@@ -3207,7 +3210,7 @@ bool qm_mpdCommand::is_mpd_installed(bool showmsg) |
110 |
|
111 |
QString output = proc.readAllStandardOutput(); |
112 |
output = output.trimmed(); |
113 |
- if (output.contains("/usr/bin/mpd") || output.contains("/usr/local/bin/mpd") || output.contains("/usr/sbin/mpd")) |
114 |
+ if (output.contains("%%PREFIX%%/bin/musicpd")) |
115 |
{ |
116 |
if (showmsg) |
117 |
printf ("MPD is installed on this system\n"); |
118 |
@@ -3227,8 +3230,8 @@ bool qm_mpdCommand::is_mpd_running(bool showmsg) |
119 |
config->mpd_process_owner = ""; // empty equals not running |
120 |
|
121 |
QProcess proc; |
122 |
- proc.setProgram("pidof"); |
123 |
- proc.setArguments({"mpd"}); |
124 |
+ proc.setProgram("pgrep"); |
125 |
+ proc.setArguments({"musicpd"}); |
126 |
proc.start(); |
127 |
if (!proc.waitForFinished()) |
128 |
return false; |