From 79e4ad20a69463345687bf4f73084b13a6f80c9a Mon Sep 17 00:00:00 2001 From: galushko Date: Fri, 1 Mar 2024 21:03:07 +0200 Subject: [PATCH] Add choose of the folder optionAdd choose of the folder option --- .../com/halushko/kinocat/file/MoveToDestinationFolder.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/file/src/main/java/com/halushko/kinocat/file/MoveToDestinationFolder.java b/file/src/main/java/com/halushko/kinocat/file/MoveToDestinationFolder.java index 2c36dd6..c3268f4 100644 --- a/file/src/main/java/com/halushko/kinocat/file/MoveToDestinationFolder.java +++ b/file/src/main/java/com/halushko/kinocat/file/MoveToDestinationFolder.java @@ -20,12 +20,17 @@ protected String getQueue() { protected String[] getScript(SmartJson rabbitMessage) { List arguments = rabbitMessage.getSubMessage(SmartJsonKeys.COMMAND_ARGUMENTS).convertToList(); String folder = String.valueOf(arguments.get(0)); + String folderPath = Constants.FOLDERS.get(folder); + if(folderPath == null || folderPath.isEmpty()) { + folderPath = Constants.FOLDERS.get(""); + } + String file = String.valueOf(arguments.get(1)).replaceAll("\\s+", "\\\\ "); return new String[]{ "mv", "-f", String.format("%s/%s.torrent", Constants.PATH_TO_UNAPPROVED_FOLDER, file), - String.format("%s/%s.torrent", Constants.FOLDERS.get(folder), UUID.randomUUID()) + String.format("%s/%s.torrent", folderPath, UUID.randomUUID()) }; } } \ No newline at end of file