mirror of
https://github.com/end-4/dots-hyprland.git
synced 2026-06-05 23:09:26 -05:00
booru: add gui toggle for save in folder by tags
This commit is contained in:
@@ -102,7 +102,7 @@ let configOptions = {
|
||||
'columns': 2,
|
||||
'batchCount': 20,
|
||||
'allowNsfw': false,
|
||||
'sortInFolderByTags': false,
|
||||
'saveInFolderByTags': false,
|
||||
},
|
||||
'pages': {
|
||||
'order': ["apis", "tools"],
|
||||
|
||||
@@ -110,6 +110,15 @@ export const BooruSettings = () => MarginRevealer({
|
||||
self.attribute.enabled.value = BooruService.nsfw;
|
||||
}, 'notify::nsfw')
|
||||
}),
|
||||
ConfigToggle({
|
||||
icon: 'sell',
|
||||
name: 'Save in folder by tags',
|
||||
desc: 'Saves images in folders by their tags',
|
||||
initValue: userOptions.sidebar.image.saveInFolderByTags,
|
||||
onChange: (self, newValue) => {
|
||||
userOptions.sidebar.image.saveInFolderByTags = newValue;
|
||||
},
|
||||
}),
|
||||
]
|
||||
})
|
||||
]
|
||||
@@ -224,7 +233,7 @@ const BooruPage = (taglist, serviceName = 'Booru') => {
|
||||
const currentTags = BooruService.queries.at(-1).realTagList.filter(tag => !tag.includes('rating:'));
|
||||
const tagDirectory = currentTags.join('+');
|
||||
let fileExtension = data.file_ext || 'jpg';
|
||||
const saveCommand = `mkdir -p $(xdg-user-dir PICTURES)/homework/${data.is_nsfw ? '🌶️/' : ''}${userOptions.sidebar.image.sortInFolderByTags ? tagDirectory : ''} && curl -L -o $(xdg-user-dir PICTURES)/homework/${data.is_nsfw ? '🌶️/' : ''}${userOptions.sidebar.image.sortInFolderByTags ? (tagDirectory + '/') : ''}${data.md5}.${fileExtension} '${data.file_url}'`;
|
||||
const saveCommand = `mkdir -p $(xdg-user-dir PICTURES)/homework/${data.is_nsfw ? '🌶️/' : ''}${userOptions.sidebar.image.saveInFolderByTags ? tagDirectory : ''} && curl -L -o $(xdg-user-dir PICTURES)/homework/${data.is_nsfw ? '🌶️/' : ''}${userOptions.sidebar.image.saveInFolderByTags ? (tagDirectory + '/') : ''}${data.md5}.${fileExtension} '${data.file_url}'`;
|
||||
execAsync(['bash', '-c', saveCommand])
|
||||
.then(() => self.label = 'done')
|
||||
.catch(print);
|
||||
|
||||
Reference in New Issue
Block a user