This commit is contained in:
notgne2 2021-01-27 00:15:09 -07:00
parent 09ade29ef1
commit cf0494ac36
No known key found for this signature in database
GPG Key ID: BB661E172B42A7F8
4 changed files with 20 additions and 83 deletions

View File

@ -30,7 +30,7 @@ async function exec(...args) {
return item ? item.trim() : item;
});
const dir = await tmp.dir({ prefix : 'mudl_', unsafeCleanup : true });
const dir = await tmp.dir({ prefix: 'mudl_', unsafeCleanup: true });
let files = [];
let inputType = null;
@ -41,8 +41,8 @@ async function exec(...args) {
inputType = 'file';
files = [{
image : null,
file : process.argv[2],
image: null,
file: process.argv[2],
}];
} else {
console.log('got a link');
@ -57,11 +57,11 @@ async function exec(...args) {
files = filesList.map((rawFilePath) => {
const filePath = Path.parse(rawFilePath);
if (['.png', '.jpg'].includes(filePath.ext)) return null;
if (['.png', '.jpg', '.webp'].includes(filePath.ext)) return null;
const rawImagePath = filesList.find((rawP) => {
const p = Path.parse(rawP);
return ['.png', '.jpg'].includes(p.ext) && p.name === filePath.name;
return ['.png', '.jpg', '.webp'].includes(p.ext) && p.name === filePath.name;
});
let album = pAlbum || null;
@ -101,8 +101,8 @@ async function exec(...args) {
if (title === null) title = 'Unknown';
return {
file : Path.join(dir.path, rawFilePath),
image : Path.join(dir.path, rawImagePath),
file: Path.join(dir.path, rawFilePath),
image: Path.join(dir.path, rawImagePath),
album,
artist,
title,
@ -158,4 +158,4 @@ async function exec(...args) {
console.log('Finished everything, cleaning up...');
await dir.cleanup();
console.log('Done!');
})();
})().catch(console.error);

63
package-lock.json generated
View File

@ -1,63 +0,0 @@
{
"name": "mudl",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"bluebird": {
"version": "3.5.4",
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.4.tgz",
"integrity": "sha512-FG+nFEZChJrbQ9tIccIfZJBz3J7mLrAhxakAbnrJWn8d7aKOC+LWifa0G+p4ZqKp4y13T7juYvdhq9NzKdsrjw=="
},
"fs-extra": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz",
"integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==",
"requires": {
"graceful-fs": "^4.1.2",
"jsonfile": "^4.0.0",
"universalify": "^0.1.0"
}
},
"graceful-fs": {
"version": "4.1.15",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz",
"integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA=="
},
"jsonfile": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
"integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=",
"requires": {
"graceful-fs": "^4.1.6"
}
},
"os-tmpdir": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
"integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ="
},
"tmp": {
"version": "0.0.33",
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
"integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==",
"requires": {
"os-tmpdir": "~1.0.2"
}
},
"tmp-promise": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/tmp-promise/-/tmp-promise-1.0.5.tgz",
"integrity": "sha512-hOabTz9Tp49wCozFwuJe5ISrOqkECm6kzw66XTP23DuzNU7QS/KiZq5LC9Y7QSy8f1rPSLy4bKaViP0OwGI1cA==",
"requires": {
"bluebird": "^3.5.0",
"tmp": "0.0.33"
}
},
"universalify": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
"integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg=="
}
}
}

View File

@ -7,7 +7,7 @@
"tmp-promise": "^1.0.5"
},
"bin": {
"mudl" : "index.js"
"mudl": "index.js"
},
"engines": {
"node": ">= 11.0.0"

22
pnpm-lock.yaml generated
View File

@ -1,16 +1,16 @@
dependencies:
fs-extra: 7.0.1
tmp-promise: 1.1.0
lockfileVersion: 5
lockfileVersion: 5.1
packages:
/balanced-match/1.0.0:
dev: false
resolution:
integrity: sha1-ibTRmasr7kneFk6gK4nORi1xt2c=
/bluebird/3.7.1:
/bluebird/3.7.2:
dev: false
resolution:
integrity: sha512-DdmyoGCleJnkbp3nkbxTLJ18rjDsE4yCggEwKNXkeV123sPNfOCYeDoeuOY+F2FrSjO1YXcTU+dsy96KMy+gcg==
integrity: sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==
/brace-expansion/1.1.11:
dependencies:
balanced-match: 1.0.0
@ -24,7 +24,7 @@ packages:
integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=
/fs-extra/7.0.1:
dependencies:
graceful-fs: 4.2.3
graceful-fs: 4.2.4
jsonfile: 4.0.0
universalify: 0.1.2
dev: false
@ -36,7 +36,7 @@ packages:
dev: false
resolution:
integrity: sha1-FQStJSMVjKpA20onh8sBQRmU6k8=
/glob/7.1.5:
/glob/7.1.6:
dependencies:
fs.realpath: 1.0.0
inflight: 1.0.6
@ -46,11 +46,11 @@ packages:
path-is-absolute: 1.0.1
dev: false
resolution:
integrity: sha512-J9dlskqUXK1OeTOYBEn5s8aMukWMwWfs+rPTn/jn50Ux4MNXVhubL1wu/j2t+H4NVI+cXEcCaYellqaPVGXNqQ==
/graceful-fs/4.2.3:
integrity: sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==
/graceful-fs/4.2.4:
dev: false
resolution:
integrity: sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==
integrity: sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==
/inflight/1.0.6:
dependencies:
once: 1.4.0
@ -65,7 +65,7 @@ packages:
/jsonfile/4.0.0:
dev: false
optionalDependencies:
graceful-fs: 4.2.3
graceful-fs: 4.2.4
resolution:
integrity: sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=
/minimatch/3.0.4:
@ -88,14 +88,14 @@ packages:
integrity: sha1-F0uSaHNVNP+8es5r9TpanhtcX18=
/rimraf/2.7.1:
dependencies:
glob: 7.1.5
glob: 7.1.6
dev: false
hasBin: true
resolution:
integrity: sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==
/tmp-promise/1.1.0:
dependencies:
bluebird: 3.7.1
bluebird: 3.7.2
tmp: 0.1.0
dev: false
resolution: