Skip to content

Commit

Permalink
- add free space display
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmytro Galushko committed Jul 1, 2024
1 parent 4eddab6 commit b9f0321
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 25 deletions.
1 change: 1 addition & 0 deletions config/examples/docker-compose/docker-compose-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ services:
- ./workdir/config/files_from_telegram_hdd:/home/torrent_files_hdd/
- ./workdir/config/files_from_telegram_low:/home/torrent_files_low/
- ./workdir/config/logs:/home/app/logs
- ./workdir/mediadata_hdd/mediadata:/home/app/tmp1
networks:
bot_network_local:
networks:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,23 @@ protected String getResultString(List<String> lines, SmartJson rabbitMessage) {
log.debug(String.format("[CheckDiskFreeSpace] [%s]", String.join(", ", lines)));
StringBuilder sb = new StringBuilder("Вільного місця у сховищі:");

for (val device : Constants.FOLDERS.entrySet()) {
sb.append("\nfolder: ").append(device.getKey()).append(": ").append(device.getValue());
}
for (val device : Constants.DEVICES.entrySet()) {
sb.append("\n device: ").append(device.getKey()).append(": ").append(device.getValue());
}
for (String line : lines) {
sb.append("\nres: ").append(line);
}


for (val device : Constants.FOLDERS.entrySet()) {
val key = device.getKey();
if (Constants.DEVICES.containsKey(key)) {
val value = Constants.DEVICES.get(key);
for (String line : lines) {
if (line.matches(value + ".*")) {
sb.append("\n")
.append(key)
.append(": ")
.append(
line.replaceAll("^\\S+\\s+\\S+\\s+\\S+\\s+", "")
.replaceAll("\\S+\\s+\\S+\\s*$", "")
);
}
for (val device : Constants.FOLDERS.entrySet()) {
boolean flag = false;
for (String line : lines) {
if (line.matches(device.getKey() + ".*")) {
sb.append("\n")
.append(device.getKey())
.append(": ")
.append(
line.replaceAll("^\\S+\\s+\\S+\\s+\\S+\\s+", "")
.replaceAll("\\S+\\s+\\S+\\s*$", "")
);
flag = true;
}
}
if(!flag) {
sb.append("\n").append(device.getKey()).append(": не вказано Filesystem у налаштуваннях");
}
}

return sb.toString();
Expand Down

0 comments on commit b9f0321

Please sign in to comment.