Added reddit avatar URL detection and avoid option.
This commit is contained in:
parent
d550b88d57
commit
ccfdc16ca8
|
@ -5,13 +5,14 @@ module.exports = {
|
|||
video: '$base$postDate - $itemId - $postTitle$ext',
|
||||
text: '$base$postDate - $postId - $postTitle',
|
||||
album: {
|
||||
extractSingleItem: true,
|
||||
image: '$base$postDate - $albumId - $postTitle/$itemIndex - $itemId$ext',
|
||||
video: '$base$postDate - $albumId - $postTitle/$itemIndex - $itemId$ext'
|
||||
video: '$base$postDate - $albumId - $postTitle/$itemIndex - $itemId$ext',
|
||||
extractSingleItem: true
|
||||
},
|
||||
profile: {
|
||||
image: '$base$userCreated - profile$ext',
|
||||
description: '$base$userCreated - profile ($userVerified$userVerifiedEmail$userGold$profileOver18)'
|
||||
description: '$base$userCreated - profile ($userVerified$userVerifiedEmail$userGold$profileOver18)',
|
||||
avoidAvatar: true
|
||||
},
|
||||
booleans: {
|
||||
extracted: 'extracted-',
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
const config = require('config');
|
||||
const urlPattern = require('url-pattern');
|
||||
|
||||
const interpolate = require('../interpolate.js');
|
||||
const fetchItem = require('../fetch/item.js');
|
||||
|
@ -11,6 +12,12 @@ function saveProfileDetails(user) {
|
|||
if(config.library.profile.image) {
|
||||
const image = user.profile ? user.profile.image : user.image;
|
||||
|
||||
if(config.library.profile.ignoreAvatar && new urlPattern('http(s)\\://(www.)redditstatic.com/avatars/:id(.:ext)(?:query)').match(image)) {
|
||||
console.log('\x1b[33m%s\x1b[0m', `Ignoring standard avatar profile image for '${user.name}'`);
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
const filepath = interpolate(config.library.profile.image, user, null, {
|
||||
// pass profile image as item to interpolate extension variable
|
||||
url: image
|
||||
|
|
Loading…
Reference in New Issue