Viewing Issue Advanced Details

ID 0001164 Category [DMDirc] Plugin - Now Playing Severity feature
Reproducibility N/A Date Submitted 2008-04-20 01:12 Last Update 2010-02-01 05:29
Reporter MD87 Assigned To Demented-Idiot View Status public
Priority normal Status closed Resolution fixed
Platform Fixed in Version Target Version 0.6.4
Product Version Product Build
Summary 0001164: /nowplaying should be able to specify format
Description
The /nowplaying command should be able to take a custom command/format to use
Needs unit test no
Upstream Bug URL

Relationships

Notes

(0009244)
Greboid (administrator)
2010-01-24 03:43
edited on: 2010-01-24 03:45

getting all the values is nice and abstracted out
plugins source
/set plugin-nowplaying format

(0009245)
MD87 (administrator)
2010-01-24 03:44

getInformation method in NowPlayingCommand needs to take a String format parameter (and use it instead of getting the format from the config).

Then the three places that call getInformation need to be updated to either pass the version from the config or the user-supplied format (based on the number of args)
(0009534)
Version Control (developer)
2010-01-31 02:05

A patchset (1) related to this change has been added to gerrit by Simon Mott

Allows custom formats to be passed to nowplaying command.

Fixes issue 1164
(0009539)
Version Control (developer)
2010-01-31 02:17

A patchset (2) related to this change has been added to gerrit by Simon Mott

Allows custom formats to be passed to nowplaying command.

Fixes issue 1164
Change-Id: I6a21d609ad5d8179085bceb8376444e943f5299d
(0009540)
Version Control (developer)
2010-01-31 02:20

A patchset (3) related to this change has been added to gerrit by Simon Mott

Allows custom formats to be passed to nowplaying command.

Fixes issue 1164
Change-Id: I6a21d609ad5d8179085bceb8376444e943f5299d
(0009543)
Version Control (developer)
2010-01-31 02:28

A patchset (4) related to this change has been added to gerrit by Simon Mott

Allows custom formats to be passed to nowplaying command.

Fixes issue 1164
Change-Id: I6a21d609ad5d8179085bceb8376444e943f5299d
(0009544)
Version Control (developer)
2010-01-31 02:31

A patchset (5) related to this change has been added to gerrit by Simon Mott

Allows custom formats to be passed to nowplaying command.

Fixes issue 1164
Change-Id: I6a21d609ad5d8179085bceb8376444e943f5299d
authorSimon Mott <simon@dmdirc.com>2010-01-31 02:04:38 (GMT)
committer Gregory Holmes <greg@dmdirc.com>2010-01-31 02:38:17 (GMT)
commit06c6683d509d41edc2f6234c18cc3915adff628f (patch) (side-by-side diff)
Allows custom formats to be passed to nowplaying command.
Fixes issue 1164 Change-Id: I6a21d609ad5d8179085bceb8376444e943f5299d Reviewed-on: http://gerrit.dmdirc.com/750 Reviewed-by: Chris Smith <chris@dmdirc.com> Automatic-Compile: Gregory Holmes <greg@dmdirc.com> Reviewed-by: Gregory Holmes <greg@dmdirc.com>
-rw-r--r--src/com/dmdirc/addons/nowplaying/NowPlayingCommand.java27
1 files changed, 18 insertions, 9 deletions
Click to Expand/Collapse
diff src/com/dmdirc/addons/nowplaying/NowPlayingCommand.java
@@ -63,7 +63,7 @@ public final class NowPlayingCommand extends ChatCommand implements IntelligentC
final MessageTarget target, final boolean isSilent, final CommandArguments args) {
if (args.getArguments().length > 0 && args.getArguments()[0]
.equalsIgnoreCase("--sources")) {
- doSourceList(origin, isSilent);
+ doSourceList(origin, isSilent, args.getArgumentsAsString(1));
} else if (args.getArguments().length > 0 && args.getArguments()[0]
.equalsIgnoreCase("--source")) {
if (args.getArguments().length > 1) {
@@ -75,7 +75,7 @@ public final class NowPlayingCommand extends ChatCommand implements IntelligentC
} else {
if (source.getState() != MediaSourceState.CLOSED) {
target.getFrame().getCommandParser().parseCommand(origin,
- getInformation(source));
+ getInformation(source, args.getArgumentsAsString(2)));
} else {
sendLine(origin, isSilent, FORMAT_ERROR, "Source is not running.");
}
@@ -87,7 +87,8 @@ public final class NowPlayingCommand extends ChatCommand implements IntelligentC
} else {
if (parent.hasRunningSource()) {
target.getFrame().getCommandParser().parseCommand(origin,
- getInformation(parent.getBestSource()));
+ getInformation(parent.getBestSource(), args.
+ getArgumentsAsString(0)));
} else {
sendLine(origin, isSilent, FORMAT_ERROR, "No running media sources available.");
}
@@ -99,8 +100,10 @@ public final class NowPlayingCommand extends ChatCommand implements IntelligentC
*
* @param origin The input window where the command was entered
* @param isSilent Whether this command is being silenced
+ * @param format Format to be passed to getInformation
*/
- private void doSourceList(final InputWindow origin, final boolean isSilent) {
+ private void doSourceList(final InputWindow origin, final boolean isSilent,
+ final String format) {
final List<MediaSource> sources = parent.getSources();
if (sources.isEmpty()) {
@@ -115,7 +118,7 @@ public final class NowPlayingCommand extends ChatCommand implements IntelligentC
if (source.getState() != MediaSourceState.CLOSED) {
data[i][1] = source.getState().getNiceName().toLowerCase();
- data[i][2] = getInformation(source);
+ data[i][2] = getInformation(source, format);
} else {
data[i][1] = "not running";
data[i][2] = "-";
@@ -132,12 +135,18 @@ public final class NowPlayingCommand extends ChatCommand implements IntelligentC
* Returns a formatted information string from the requested soruce.
*
* @param source MediaSource to query
+ * @param format Format to use
*
* @return Formatted information string
- */
- private String getInformation(final MediaSource source) {
- return parent.doSubstitution(IdentityManager.getGlobalConfig()
- .getOption(parent.getDomain(), "format"), source);
+ * @since 0.6.3
+ */
+ private String getInformation(final MediaSource source, final String format) {
+ if (format.isEmpty()) {
+ return parent.doSubstitution(IdentityManager.getGlobalConfig()
+ .getOption(parent.getDomain(), "format"), source);
+ } else {
+ return parent.doSubstitution(format, source);
+ }
}
/** {@inheritDoc}. */

Issue History

Date Modified Username Field Change
2008-04-20 01:12 MD87 New Issue
2008-04-20 01:12 MD87 Status new => assigned
2008-04-20 01:12 MD87 Assigned To => MD87
2008-05-26 23:31 MD87 Target Version 0.7 => 0.6.5
2008-07-23 22:01 MD87 Target Version 0.6.3 => 0.7
2009-10-04 03:17 Anonymous Note Added: 0007780
2009-10-04 07:14 Anonymous Note Added: 0007843
2009-10-04 08:35 Anonymous Note Added: 0007872
2009-10-04 10:08 Anonymous Note Added: 0007917
2009-10-04 12:07 Greboid Note Deleted: 0007780
2009-10-04 12:07 Greboid Note Deleted: 0007917
2009-10-04 12:07 Greboid Note Deleted: 0007872
2009-10-04 12:07 Greboid Note Deleted: 0007843
2010-01-24 03:28 Greboid Assigned To MD87 => Demented-Idiot
2010-01-24 03:43 Greboid Note Added: 0009244
2010-01-24 03:44 MD87 Note Added: 0009245
2010-01-24 03:45 Greboid Note Edited: 0009244
2010-01-30 12:13 Greboid Needs unit test => no
2010-01-30 12:13 Greboid Target Version 0.7 => 0.6.4
2010-01-31 02:05 Version Control Checkin
2010-01-31 02:05 Version Control Note Added: 0009534
2010-01-31 02:05 Version Control Status assigned => fix pending
2010-01-31 02:17 Version Control Checkin
2010-01-31 02:17 Version Control Note Added: 0009539
2010-01-31 02:20 Version Control Checkin
2010-01-31 02:20 Version Control Note Added: 0009540
2010-01-31 02:28 Version Control Checkin
2010-01-31 02:28 Version Control Note Added: 0009543
2010-01-31 02:31 Version Control Checkin
2010-01-31 02:31 Version Control Note Added: 0009544
2010-01-31 02:39 Version Control Checkin
2010-01-31 02:39 Version Control Note Added: 0009546
2010-01-31 02:39 Version Control Status fix pending => resolved
2010-01-31 02:39 Version Control Resolution open => fixed
2010-02-01 05:29 MD87 Status resolved => closed