minor fixes/changes

This commit is contained in:
X4Lo committed 2024-06-23 17:01:31 +01:00
1 parent 252f15ffd9
commit 336519be70
8 files changed
+41 -10

No files matched your search

-1
View File
@@ -43,7 +43,6 @@
"node_modules/ngx-toastr/toastr.css", "node_modules/ngx-toastr/toastr.css",
"node_modules/perfect-scrollbar/css/perfect-scrollbar.css", "node_modules/perfect-scrollbar/css/perfect-scrollbar.css",
"node_modules/flatpickr/dist/flatpickr.min.css", "node_modules/flatpickr/dist/flatpickr.min.css",
"frontend/src/assets/sass/responsive.css" "frontend/src/assets/sass/responsive.css"
], ],
"scripts": [ "scripts": [
+3 -1
View File
@@ -12,6 +12,8 @@ const { Sequelize } = require('sequelize');
const router = express.Router(); const router = express.Router();
const multer = require('multer'); const multer = require('multer');
const { v4: uuidv4 } = require('uuid'); const { v4: uuidv4 } = require('uuid');
const path = require('path');
const { getMediaFolder } = require('../services/mediaService');
// ! /user-collections // ! /user-collections
// * POST - CREATE UserCollection // * POST - CREATE UserCollection
@@ -82,7 +84,7 @@ router.get('/:id', async (req, res) => {
const storage = multer.diskStorage({ const storage = multer.diskStorage({
destination: function (req, file, cb) { destination: function (req, file, cb) {
cb(null, 'uploads/collections/posters/') cb(null, path.join(getMediaFolder(), 'images', 'collections', 'posters'))
}, },
filename: function (req, file, cb) { filename: function (req, file, cb) {
const uniqueFilename = uuidv4(); const uniqueFilename = uuidv4();
+3 -3
View File
@@ -512,9 +512,9 @@ async function refrechEntry(entryId) {
// ? if the count of a media type == 0, the add the type to mediaToGet // ? if the count of a media type == 0, the add the type to mediaToGet
let mediaToGet = []; let mediaToGet = [];
availableMedia.forEach(({ type, count }) => { for (let key in availableMedia) {
if (count == 0) mediaToGet.push(type); if (availableMedia[key] == 0) mediaToGet.push(availableMedia[key]);
}); }
if (mediaToGet.length != 0) { if (mediaToGet.length != 0) {
downloadedImages = await getEntryMedia(data.id, oldEntry.is_tvseries, mediaToGet); downloadedImages = await getEntryMedia(data.id, oldEntry.is_tvseries, mediaToGet);
+7
View File
@@ -97,6 +97,10 @@ function scheduleDownloads(media, mediaType, mediaDir, downloadTasks, downloaded
); );
} }
function getMediaFolder() {
return getSettings().userDataPath;
}
function createMediaFolders() { function createMediaFolders() {
const settings = getSettings(); const settings = getSettings();
const dataPath = settings.userDataPath; const dataPath = settings.userDataPath;
@@ -104,10 +108,12 @@ function createMediaFolders() {
const posterDir = path.join(dataPath, 'images', 'entries', 'posters'); const posterDir = path.join(dataPath, 'images', 'entries', 'posters');
const backdropDir = path.join(dataPath, 'images', 'entries', 'backdrops'); const backdropDir = path.join(dataPath, 'images', 'entries', 'backdrops');
const logoDir = path.join(dataPath, 'images', 'entries', 'logos'); const logoDir = path.join(dataPath, 'images', 'entries', 'logos');
const collectionsPostersDir = path.join(dataPath, 'images', 'collections', 'posters');
fs.mkdirSync(posterDir, { recursive: true }); fs.mkdirSync(posterDir, { recursive: true });
fs.mkdirSync(backdropDir, { recursive: true }); fs.mkdirSync(backdropDir, { recursive: true });
fs.mkdirSync(logoDir, { recursive: true }); fs.mkdirSync(logoDir, { recursive: true });
fs.mkdirSync(collectionsPostersDir, { recursive: true });
// console.log(`Created media folders.`); // console.log(`Created media folders.`);
} }
@@ -115,4 +121,5 @@ function createMediaFolders() {
module.exports = { module.exports = {
getEntryMedia, getEntryMedia,
createMediaFolders, createMediaFolders,
getMediaFolder,
}; };
@@ -111,8 +111,7 @@ export class UserCollectionGridCardComponent implements OnInit {
// ? EVENTS // ? EVENTS
cardClick() { cardClick() {
if (this.entry.isInLibrary) this.router.navigate([`/entries/${this.entry.id}`]);
this.router.navigate([`/entries/${this.entry.id}`]);
} }
// ? EVENT EMITTER // ? EVENT EMITTER
@@ -3,11 +3,11 @@
</td> </td>
<td> <td>
<div class="d-flex align-items-center gap-3"> <div class="d-flex align-items-center gap-3">
<div class="product-box"> <div class="product-box image-container">
<img [src]="getLogoPath()" width="80" class="rounded-3" alt=""> <img [src]="getLogoPath()" width="80" alt="logo">
</div> </div>
<div class="product-info"> <div class="product-info">
<a href="javascript:;" class="product-title">{{entry.title}}</a> <a class="product-title link-primary cursor-pointer" (click)="cardClick()">{{entry.title}}</a>
<p class="mb-0 product-category" *ngIf="entry.is_tvseries">{{entry.seasons.length}} <p class="mb-0 product-category" *ngIf="entry.is_tvseries">{{entry.seasons.length}}
Season{{entry.seasons.length Season{{entry.seasons.length
> 1 ? 's' : ''}}</p> > 1 ? 's' : ''}}</p>
+22
View File
@@ -30,6 +30,8 @@
"ngx-bootstrap": "^12.0.0", "ngx-bootstrap": "^12.0.0",
"ngx-toastr": "^18.0.0", "ngx-toastr": "^18.0.0",
"perfect-scrollbar": "^1.5.5", "perfect-scrollbar": "^1.5.5",
"primeicons": "^7.0.0",
"primeng": "^17.18.0",
"rxjs": "~7.8.0", "rxjs": "~7.8.0",
"sequelize": "^6.37.1", "sequelize": "^6.37.1",
"tslib": "^2.3.0", "tslib": "^2.3.0",
@@ -14474,6 +14476,26 @@
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/primeicons": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/primeicons/-/primeicons-7.0.0.tgz",
"integrity": "sha512-jK3Et9UzwzTsd6tzl2RmwrVY/b8raJ3QZLzoDACj+oTJ0oX7L9Hy+XnVwgo4QVKlKpnP/Ur13SXV/pVh4LzaDw=="
},
"node_modules/primeng": {
"version": "17.18.0",
"resolved": "https://registry.npmjs.org/primeng/-/primeng-17.18.0.tgz",
"integrity": "sha512-EcvU/0Ex9QoBR6g6db9fDTCTAmzokW70TV5Oroy2gdvXRr3eqlflnOBoArQsmxTaw1oxSsu68YVj3RvcKYWhTg==",
"dependencies": {
"tslib": "^2.3.0"
},
"peerDependencies": {
"@angular/common": "^17.0.0 || ^18.0.0",
"@angular/core": "^17.0.0 || ^18.0.0",
"@angular/forms": "^17.0.0 || ^18.0.0",
"rxjs": "^6.0.0 || ^7.8.1",
"zone.js": "~0.14.0"
}
},
"node_modules/proc-log": { "node_modules/proc-log": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/proc-log/-/proc-log-3.0.0.tgz", "resolved": "https://registry.npmjs.org/proc-log/-/proc-log-3.0.0.tgz",
+2
View File
@@ -53,6 +53,8 @@
"ngx-bootstrap": "^12.0.0", "ngx-bootstrap": "^12.0.0",
"ngx-toastr": "^18.0.0", "ngx-toastr": "^18.0.0",
"perfect-scrollbar": "^1.5.5", "perfect-scrollbar": "^1.5.5",
"primeicons": "^7.0.0",
"primeng": "^17.18.0",
"rxjs": "~7.8.0", "rxjs": "~7.8.0",
"sequelize": "^6.37.1", "sequelize": "^6.37.1",
"tslib": "^2.3.0", "tslib": "^2.3.0",