forked from Shinonome/dots-hyprland
booru: config option for saving in folders by tags
and join tags by "+"
This commit is contained in:
@@ -102,6 +102,7 @@ let configOptions = {
|
|||||||
'columns': 2,
|
'columns': 2,
|
||||||
'batchCount': 20,
|
'batchCount': 20,
|
||||||
'allowNsfw': false,
|
'allowNsfw': false,
|
||||||
|
'sortInFolderByTags': false,
|
||||||
},
|
},
|
||||||
'pages': {
|
'pages': {
|
||||||
'order': ["apis", "tools"],
|
'order': ["apis", "tools"],
|
||||||
|
|||||||
@@ -222,9 +222,9 @@ const BooruPage = (taglist, serviceName = 'Booru') => {
|
|||||||
icon: 'save',
|
icon: 'save',
|
||||||
action: (self) => {
|
action: (self) => {
|
||||||
const currentTags = BooruService.queries.at(-1).realTagList.filter(tag => !tag.includes('rating:'));
|
const currentTags = BooruService.queries.at(-1).realTagList.filter(tag => !tag.includes('rating:'));
|
||||||
const tagDirectory = currentTags.join('_');
|
const tagDirectory = currentTags.join('+');
|
||||||
let fileExtension = data.file_ext || 'jpg';
|
let fileExtension = data.file_ext || 'jpg';
|
||||||
const saveCommand = `mkdir -p $(xdg-user-dir PICTURES)/homework/${data.is_nsfw ? '🌶️/' : ''}${tagDirectory} && curl -L -o $(xdg-user-dir PICTURES)/homework/${data.is_nsfw ? '🌶️/' : ''}${tagDirectory}/${data.md5}.${fileExtension} '${data.file_url}'`;
|
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}'`;
|
||||||
execAsync(['bash', '-c', saveCommand])
|
execAsync(['bash', '-c', saveCommand])
|
||||||
.then(() => self.label = 'done')
|
.then(() => self.label = 'done')
|
||||||
.catch(print);
|
.catch(print);
|
||||||
|
|||||||
Reference in New Issue
Block a user