Skip to content

Commit

Permalink
Implement multiple channels
Browse files Browse the repository at this point in the history
Closes #4
  • Loading branch information
voruti committed Aug 7, 2021
1 parent e4a0300 commit a7f913b
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@ public class JsonChannelLink implements IConvertible {

@Override
public String toConfigLine(String lineBefore) {
return String.format("%s {channel=\"%s\"}", lineBefore, String.join(":", value.channelUID.segments)).strip();
String format = "channel=\"%s\"}";
if (lineBefore.endsWith("}")) {
lineBefore = lineBefore.substring(0, lineBefore.length() - 1);
format = "%s, " + format;
} else {
format = "%s {" + format;
}

return String.format(format, lineBefore, String.join(":", value.channelUID.segments)).strip();
}


Expand Down

0 comments on commit a7f913b

Please sign in to comment.