|
@@ -63,7 +63,7 @@ public final class NowPlayingCommand extends ChatCommand implements IntelligentC
|
63
|
63
|
final MessageTarget target, final boolean isSilent, final CommandArguments args) {
|
64
|
64
|
if (args.getArguments().length > 0 && args.getArguments()[0]
|
65
|
65
|
.equalsIgnoreCase("--sources")) {
|
66
|
|
- doSourceList(origin, isSilent);
|
|
66
|
+ doSourceList(origin, isSilent, args.getArgumentsAsString(1));
|
67
|
67
|
} else if (args.getArguments().length > 0 && args.getArguments()[0]
|
68
|
68
|
.equalsIgnoreCase("--source")) {
|
69
|
69
|
if (args.getArguments().length > 1) {
|
|
@@ -75,7 +75,7 @@ public final class NowPlayingCommand extends ChatCommand implements IntelligentC
|
75
|
75
|
} else {
|
76
|
76
|
if (source.getState() != MediaSourceState.CLOSED) {
|
77
|
77
|
target.getFrame().getCommandParser().parseCommand(origin,
|
78
|
|
- getInformation(source));
|
|
78
|
+ getInformation(source, args.getArgumentsAsString(2)));
|
79
|
79
|
} else {
|
80
|
80
|
sendLine(origin, isSilent, FORMAT_ERROR, "Source is not running.");
|
81
|
81
|
}
|
|
@@ -87,7 +87,8 @@ public final class NowPlayingCommand extends ChatCommand implements IntelligentC
|
87
|
87
|
} else {
|
88
|
88
|
if (parent.hasRunningSource()) {
|
89
|
89
|
target.getFrame().getCommandParser().parseCommand(origin,
|
90
|
|
- getInformation(parent.getBestSource()));
|
|
90
|
+ getInformation(parent.getBestSource(), args.
|
|
91
|
+ getArgumentsAsString(0)));
|
91
|
92
|
} else {
|
92
|
93
|
sendLine(origin, isSilent, FORMAT_ERROR, "No running media sources available.");
|
93
|
94
|
}
|
|
@@ -99,8 +100,10 @@ public final class NowPlayingCommand extends ChatCommand implements IntelligentC
|
99
|
100
|
*
|
100
|
101
|
* @param origin The input window where the command was entered
|
101
|
102
|
* @param isSilent Whether this command is being silenced
|
|
103
|
+ * @param format Format to be passed to getInformation
|
102
|
104
|
*/
|
103
|
|
- private void doSourceList(final InputWindow origin, final boolean isSilent) {
|
|
105
|
+ private void doSourceList(final InputWindow origin, final boolean isSilent,
|
|
106
|
+ final String format) {
|
104
|
107
|
final List<MediaSource> sources = parent.getSources();
|
105
|
108
|
|
106
|
109
|
if (sources.isEmpty()) {
|
|
@@ -115,7 +118,7 @@ public final class NowPlayingCommand extends ChatCommand implements IntelligentC
|
115
|
118
|
|
116
|
119
|
if (source.getState() != MediaSourceState.CLOSED) {
|
117
|
120
|
data[i][1] = source.getState().getNiceName().toLowerCase();
|
118
|
|
- data[i][2] = getInformation(source);
|
|
121
|
+ data[i][2] = getInformation(source, format);
|
119
|
122
|
} else {
|
120
|
123
|
data[i][1] = "not running";
|
121
|
124
|
data[i][2] = "-";
|
|
@@ -132,12 +135,18 @@ public final class NowPlayingCommand extends ChatCommand implements IntelligentC
|
132
|
135
|
* Returns a formatted information string from the requested soruce.
|
133
|
136
|
*
|
134
|
137
|
* @param source MediaSource to query
|
|
138
|
+ * @param format Format to use
|
135
|
139
|
*
|
136
|
140
|
* @return Formatted information string
|
137
|
|
- */
|
138
|
|
- private String getInformation(final MediaSource source) {
|
139
|
|
- return parent.doSubstitution(IdentityManager.getGlobalConfig()
|
140
|
|
- .getOption(parent.getDomain(), "format"), source);
|
|
141
|
+ * @since 0.6.3
|
|
142
|
+ */
|
|
143
|
+ private String getInformation(final MediaSource source, final String format) {
|
|
144
|
+ if (format.isEmpty()) {
|
|
145
|
+ return parent.doSubstitution(IdentityManager.getGlobalConfig()
|
|
146
|
+ .getOption(parent.getDomain(), "format"), source);
|
|
147
|
+ } else {
|
|
148
|
+ return parent.doSubstitution(format, source);
|
|
149
|
+ }
|
141
|
150
|
}
|
142
|
151
|
|
143
|
152
|
/** {@inheritDoc}. */
|