Skip to content

Commit

Permalink
booru: config option for saving in folders by tags
Browse files Browse the repository at this point in the history
and join tags by "+"
  • Loading branch information
end-4 committed Aug 19, 2024
1 parent 7d39885 commit f285bd0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions .config/ags/modules/.configuration/user_options.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ let configOptions = {
'columns': 2,
'batchCount': 20,
'allowNsfw': false,
'sortInFolderByTags': false,
},
'pages': {
'order': ["apis", "tools"],
Expand Down
4 changes: 2 additions & 2 deletions .config/ags/modules/sideleft/apis/booru.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,9 @@ const BooruPage = (taglist, serviceName = 'Booru') => {
icon: 'save',
action: (self) => {
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';
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])
.then(() => self.label = 'done')
.catch(print);
Expand Down

0 comments on commit f285bd0

Please sign in to comment.