Merge branch 'master' of https://github.com/X4Lo/Showy
This commit is contained in:
commit
710ebcc934
82 files changed
+1419
-383
No files matched your search
@@ -1,8 +1,14 @@
|
|||||||
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
||||||
|
|
||||||
|
# ! me
|
||||||
|
settings.json
|
||||||
|
sequelize.log
|
||||||
|
showy.log
|
||||||
|
|
||||||
# Compiled output
|
# Compiled output
|
||||||
/dist
|
/dist
|
||||||
/dist_exe
|
/dist_exe
|
||||||
|
/dist_electron
|
||||||
/uploads
|
/uploads
|
||||||
/tmp
|
/tmp
|
||||||
/out-tsc
|
/out-tsc
|
||||||
|
|||||||
+8
-2
@@ -13,7 +13,7 @@
|
|||||||
"build": {
|
"build": {
|
||||||
"builder": "@angular-devkit/build-angular:application",
|
"builder": "@angular-devkit/build-angular:application",
|
||||||
"options": {
|
"options": {
|
||||||
"outputPath": "dist/show-z",
|
"outputPath": "dist/showy",
|
||||||
"index": "frontend/src/index.html",
|
"index": "frontend/src/index.html",
|
||||||
"browser": "frontend/src/main.ts",
|
"browser": "frontend/src/main.ts",
|
||||||
"polyfills": ["zone.js"],
|
"polyfills": ["zone.js"],
|
||||||
@@ -28,6 +28,7 @@
|
|||||||
"frontend/src/assets/css/bootstrap.min.css",
|
"frontend/src/assets/css/bootstrap.min.css",
|
||||||
"frontend/src/assets/css/bootstrap-extended.css",
|
"frontend/src/assets/css/bootstrap-extended.css",
|
||||||
|
|
||||||
|
"frontend/src/assets/plugins/bs-stepper/css/bs-stepper.css",
|
||||||
"frontend/src/assets/plugins/metismenu/metisMenu.min.css",
|
"frontend/src/assets/plugins/metismenu/metisMenu.min.css",
|
||||||
"frontend/src/assets/plugins/metismenu/mm-vertical.css",
|
"frontend/src/assets/plugins/metismenu/mm-vertical.css",
|
||||||
"frontend/src/assets/plugins/simplebar/css/simplebar.css",
|
"frontend/src/assets/plugins/simplebar/css/simplebar.css",
|
||||||
@@ -37,7 +38,6 @@
|
|||||||
"frontend/src/assets/sass/semi-dark.css",
|
"frontend/src/assets/sass/semi-dark.css",
|
||||||
"frontend/src/assets/sass/dark-theme.css",
|
"frontend/src/assets/sass/dark-theme.css",
|
||||||
|
|
||||||
|
|
||||||
"frontend/src/assets/sass/bordered-theme.css",
|
"frontend/src/assets/sass/bordered-theme.css",
|
||||||
|
|
||||||
"node_modules/ngx-toastr/toastr.css",
|
"node_modules/ngx-toastr/toastr.css",
|
||||||
@@ -67,6 +67,12 @@
|
|||||||
},
|
},
|
||||||
"configurations": {
|
"configurations": {
|
||||||
"production": {
|
"production": {
|
||||||
|
"fileReplacements": [
|
||||||
|
{
|
||||||
|
"replace": "frontend/src/environments/environment.ts",
|
||||||
|
"with": "frontend/src/environments/environment.prod.ts"
|
||||||
|
}
|
||||||
|
],
|
||||||
"budgets": [
|
"budgets": [
|
||||||
{
|
{
|
||||||
"type": "initial",
|
"type": "initial",
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
|
|
||||||
const CustomError = require('../errors/CustomError');
|
const CustomError = require('../errors/CustomError');
|
||||||
|
const { logToFile } = require('../services/logService');
|
||||||
|
|
||||||
module.exports = (err, req, res, next) => {
|
module.exports = (err, req, res, next) => {
|
||||||
if (err instanceof CustomError) {
|
if (err instanceof CustomError) {
|
||||||
res.status(err.statusCode()).json({ message: err.message });
|
res.status(err.statusCode()).json({ message: err.message });
|
||||||
|
logToFile(`Error (${err.statusCode()}) ${err.message}`)
|
||||||
} else {
|
} else {
|
||||||
console.log(`📌 Error: `, err)
|
console.log(`📌 Error: `, err)
|
||||||
|
logToFile(`Error (500) ${err}`)
|
||||||
res.status(500).json({ message: 'Internal server error' });
|
res.status(500).json({ message: 'Internal server error' });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1,15 +1,18 @@
|
|||||||
const express = require('express');
|
const express = require('express');
|
||||||
|
const entryRouter = express.Router();
|
||||||
|
|
||||||
const { fetchEntryData } = require('../services/tmdbService');
|
const { fetchEntryData } = require('../services/tmdbService');
|
||||||
|
const { saveEntry, refrechEntry } = require('../services/entryService');
|
||||||
|
const { bulkImportMovies, bulkImportTmdb, bulkImportEpisodes } = require('../services/importerService');
|
||||||
|
|
||||||
const Entry = require('../models/Entry');
|
const Entry = require('../models/Entry');
|
||||||
const EntryId = require('../models/EntryId');
|
const EntryId = require('../models/EntryId');
|
||||||
const EntryRating = require('../models/EntryRating');
|
const EntryRating = require('../models/EntryRating');
|
||||||
const Genre = require('../models/Genre');
|
const Genre = require('../models/Genre');
|
||||||
const EntrySeen = require('../models/EntrySeen');
|
const EntrySeen = require('../models/EntrySeen');
|
||||||
const { saveEntry, refrechEntry } = require('../services/entryService');
|
|
||||||
const Season = require('../models/Season');
|
const Season = require('../models/Season');
|
||||||
const { bulkImportMovies, bulkImportTmdb, bulkImportEpisodes } = require('../services/importerService');
|
|
||||||
const Media = require('../models/Media');
|
const Media = require('../models/Media');
|
||||||
const entryRouter = express.Router();
|
const Episode = require('../models/Episode');
|
||||||
|
|
||||||
// ! /entries
|
// ! /entries
|
||||||
// * GET - ALL ENTRIES
|
// * GET - ALL ENTRIES
|
||||||
@@ -65,13 +68,15 @@ entryRouter.get('/:id', async (req, res) => {
|
|||||||
attributes: [] // Do not fetch any attributes from the join table
|
attributes: [] // Do not fetch any attributes from the join table
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
order: [
|
||||||
|
[{ model: EntrySeen, as: 'entrySeen' }, 'date_seen', 'DESC'] // Order the entry-seen list
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
if (!entry) { // ! entry not found
|
if (!entry) { // ! entry not found
|
||||||
res.status(404).json({ message: 'Entry not found' });
|
res.status(404).json({ message: 'Entry not found' });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const entryData = entry.get({ plain: true });
|
const entryData = entry.get({ plain: true });
|
||||||
const genres = entryData.genres.map(genre => genre.name);
|
const genres = entryData.genres.map(genre => genre.name);
|
||||||
|
|
||||||
@@ -83,6 +88,47 @@ entryRouter.get('/:id', async (req, res) => {
|
|||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// * GET - Get seasons of an entry
|
||||||
|
entryRouter.get('/:id/seasons', async (req, res) => {
|
||||||
|
try {
|
||||||
|
const { id } = req.params;
|
||||||
|
|
||||||
|
if (id == null) { // ! entry id not provided
|
||||||
|
res.status(404).json({ message: 'Entry id not provided' });
|
||||||
|
}
|
||||||
|
|
||||||
|
const entry = await Entry.findByPk(id);
|
||||||
|
|
||||||
|
if (!entry) {
|
||||||
|
res.status(404).json({ message: 'Entry not found' });
|
||||||
|
}
|
||||||
|
|
||||||
|
const seasons = await Season.findAll({
|
||||||
|
where: {
|
||||||
|
entry_id: id
|
||||||
|
},
|
||||||
|
attributes: ['id', 'season_number'],
|
||||||
|
include: [
|
||||||
|
{ model: Episode, as: 'episodes', attributes: ['id', 'episode_number'], }
|
||||||
|
],
|
||||||
|
order: [
|
||||||
|
['season_number', 'ASC'],
|
||||||
|
[{ model: Episode, as: 'episodes' }, 'episode_number', 'ASC'],
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
if (seasons.length == 0) { // ! no content
|
||||||
|
res.status(404).json({ message: 'No seasons' });
|
||||||
|
}
|
||||||
|
|
||||||
|
res.status(200).json(seasons);
|
||||||
|
} catch (error) {
|
||||||
|
res.status(500).json({ error: error.message });
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// ! POST
|
// ! POST
|
||||||
// * POST - CREATE ENTRY
|
// * POST - CREATE ENTRY
|
||||||
entryRouter.post('/', async (req, res) => {
|
entryRouter.post('/', async (req, res) => {
|
||||||
@@ -172,7 +218,10 @@ entryRouter.put('/:id', async (req, res) => {
|
|||||||
if (oldEntry.is_tvseries) includes.push({ model: Season, as: 'seasons' });
|
if (oldEntry.is_tvseries) includes.push({ model: Season, as: 'seasons' });
|
||||||
|
|
||||||
const updatedEntry = await Entry.findByPk(id, {
|
const updatedEntry = await Entry.findByPk(id, {
|
||||||
include: includes
|
include: includes,
|
||||||
|
order: [
|
||||||
|
[{ model: EntrySeen, as: 'entrySeen' }, 'date_seen', 'DESC'] // Order the entry-seen list
|
||||||
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
const entryData = updatedEntry.get({ plain: true });
|
const entryData = updatedEntry.get({ plain: true });
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ const entryRouter = require('./entry.routes');
|
|||||||
const entryRatingsRouter = require('./entry-ratings.routes');
|
const entryRatingsRouter = require('./entry-ratings.routes');
|
||||||
const seasonRouter = require('./season.routes');
|
const seasonRouter = require('./season.routes');
|
||||||
const episodeSeenRouter = require('./episode-seen.routes');
|
const episodeSeenRouter = require('./episode-seen.routes');
|
||||||
|
const settingsRouter = require('./settings.routes');
|
||||||
|
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
|
|
||||||
@@ -18,4 +19,6 @@ router.use('/entry-ratings', entryRatingsRouter);
|
|||||||
router.use('/seasons', seasonRouter);
|
router.use('/seasons', seasonRouter);
|
||||||
router.use('/episode-seen', episodeSeenRouter);
|
router.use('/episode-seen', episodeSeenRouter);
|
||||||
|
|
||||||
|
router.use('/settings', settingsRouter);
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
@@ -4,7 +4,7 @@ const Episode = require('../models/Episode');
|
|||||||
const seasonRouter = express.Router();
|
const seasonRouter = express.Router();
|
||||||
|
|
||||||
// ! /seasons
|
// ! /seasons
|
||||||
// POST /seasons - Create a new season
|
// * POST - Create a new season
|
||||||
seasonRouter.post('/', async (req, res) => {
|
seasonRouter.post('/', async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const season = await Season.create(req.body);
|
const season = await Season.create(req.body);
|
||||||
@@ -14,7 +14,7 @@ seasonRouter.post('/', async (req, res) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// GET /seasons - Retrieve all seasons
|
// * GET - Retrieve all seasons
|
||||||
seasonRouter.get('/', async (req, res) => {
|
seasonRouter.get('/', async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const seasons = await Season.findAll();
|
const seasons = await Season.findAll();
|
||||||
@@ -24,7 +24,7 @@ seasonRouter.get('/', async (req, res) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// GET /seasons/:id - Retrieve a specific season by id
|
// * GET - Retrieve a specific season by id
|
||||||
seasonRouter.get('/:id', async (req, res) => {
|
seasonRouter.get('/:id', async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const season = await Season.findByPk(req.params.id, {
|
const season = await Season.findByPk(req.params.id, {
|
||||||
@@ -44,6 +44,7 @@ seasonRouter.get('/:id', async (req, res) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// * GET - Retrieve episodes of a season
|
||||||
seasonRouter.get('/:id/episodes', async (req, res) => {
|
seasonRouter.get('/:id/episodes', async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const episodes = await Episode.findAll({
|
const episodes = await Episode.findAll({
|
||||||
@@ -62,7 +63,7 @@ seasonRouter.get('/:id/episodes', async (req, res) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// PUT /seasons/:id - Update a season
|
// * PUT - Update a season
|
||||||
seasonRouter.put('/:id', async (req, res) => {
|
seasonRouter.put('/:id', async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const [updated] = await Season.update(req.body, {
|
const [updated] = await Season.update(req.body, {
|
||||||
@@ -79,7 +80,7 @@ seasonRouter.put('/:id', async (req, res) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// DELETE /seasons/:id - Delete a season
|
// * DELETE - Delete a season
|
||||||
seasonRouter.delete('/:id', async (req, res) => {
|
seasonRouter.delete('/:id', async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const deleted = await Season.destroy({
|
const deleted = await Season.destroy({
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
const express = require('express');
|
||||||
|
const { updateSettings, getSettings } = require('../services/settingsService');
|
||||||
|
const settingsRouter = express.Router();
|
||||||
|
|
||||||
|
const settingsFileFormat = {
|
||||||
|
"dataFolderPath": "",
|
||||||
|
"tmdbApiUrl": "",
|
||||||
|
"tmdbApiKey": "",
|
||||||
|
"frontPort": "",
|
||||||
|
"backPort": "",
|
||||||
|
"portableMode": "",
|
||||||
|
};
|
||||||
|
|
||||||
|
// ! /settings
|
||||||
|
settingsRouter.put('/', async (req, res) => {
|
||||||
|
const settings = req.body;
|
||||||
|
|
||||||
|
updateSettings(settings);
|
||||||
|
|
||||||
|
res.status(200).send(getSettings());
|
||||||
|
});
|
||||||
|
|
||||||
|
settingsRouter.get('/', (req, res) => {
|
||||||
|
try {
|
||||||
|
const settings = getSettings();
|
||||||
|
|
||||||
|
res.status(200).json(settings);
|
||||||
|
} catch (err) {
|
||||||
|
res.status(500).send('Error retrieving settings');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = settingsRouter;
|
||||||
+46
-25
@@ -1,22 +1,30 @@
|
|||||||
// server.js
|
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const bodyParser = require('body-parser');
|
const bodyParser = require('body-parser');
|
||||||
const routes = require('./routes/routes.js');
|
const routes = require('./routes/routes.js');
|
||||||
const sequelize = require('./db/database.js');
|
const sequelize = require('./db/database.js');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
const PORT = process.env.PORT || 4000;
|
|
||||||
const relations = require('./db/relations.js');
|
const relations = require('./db/relations.js');
|
||||||
const sequelizeHooks = require('./db/sequelizeHooks.js');
|
const sequelizeHooks = require('./db/sequelizeHooks.js');
|
||||||
const { initializeGenres, initializeData } = require('./db/dataInitializer.js');
|
const { initializeData } = require('./db/dataInitializer.js');
|
||||||
const killerRouter = require('./routes/killer.routes.js');
|
const killerRouter = require('./routes/killer.routes.js');
|
||||||
|
const errorHandler = require('./middleware/errorHandler');
|
||||||
|
const { getSettings } = require('./services/settingsService.js');
|
||||||
|
const { logToFile } = require('./services/logService.js');
|
||||||
|
|
||||||
// Middleware
|
// ? variables
|
||||||
|
let settings = getSettings()
|
||||||
|
const PORT = settings["backPort"] || 4000;
|
||||||
|
const parrentProcess = JSON.parse(process.env.PARENT_PROCESS || '{}');
|
||||||
|
|
||||||
|
// ? Middleware
|
||||||
app.use(bodyParser.json()); // for parsing application/json
|
app.use(bodyParser.json()); // for parsing application/json
|
||||||
app.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded
|
app.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded
|
||||||
|
|
||||||
// CORS Middleware to allow requests from any origin
|
// * CORS Middleware to allow requests from any origin
|
||||||
app.use((req, res, next) => {
|
app.use((req, res, next) => {
|
||||||
res.header('Access-Control-Allow-Origin', '*');
|
res.header('Access-Control-Allow-Origin', '*');
|
||||||
res.header(
|
res.header(
|
||||||
@@ -30,52 +38,65 @@ app.use((req, res, next) => {
|
|||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
// ? Routes
|
// ? Routes : media access routes
|
||||||
// * media access route
|
app.use('/api/v1/media/:category/:type/:file', (req, res, next) => {
|
||||||
app.use('/api/v1/media/:category/:type', (req, res, next) => {
|
|
||||||
const category = req.params.category;
|
const category = req.params.category;
|
||||||
const type = req.params.type;
|
const type = req.params.type;
|
||||||
|
const file = req.params.file;
|
||||||
|
|
||||||
if (!['entries', 'collections', 'franchises'].includes(category)) {
|
if (!['entries', 'collections', 'franchises'].includes(category)) {
|
||||||
return res.status(404).send('Not Found');
|
return res.status(404).send('Not Found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!['backdrops', 'posters', 'others'].includes(type)) {
|
if (!['backdrops', 'posters', 'logos', 'others'].includes(type)) {
|
||||||
return res.status(404).send('Not Found');
|
return res.status(404).send('Not Found');
|
||||||
}
|
}
|
||||||
|
|
||||||
const options = {
|
const settings = getSettings();
|
||||||
fallthrough: false, // ! Important: don't call next middleware if file isn't found
|
const dataPath = settings.userDataPath;
|
||||||
};
|
|
||||||
|
|
||||||
express.static(path.join(__dirname, '..', `uploads/${category}/${type}`), options)(req, res, next);
|
const mediaPath = path.join(dataPath, 'images', category, type);
|
||||||
|
// const mediaPath = path.join(__dirname, '..', `data/images/${category}/${type}`);
|
||||||
|
const filePath = path.join(mediaPath, file);
|
||||||
|
logToFile(filePath)
|
||||||
|
fs.access(filePath, fs.constants.F_OK, (err) => {
|
||||||
|
if (err) {
|
||||||
|
return res.status(404).send('Not Found');
|
||||||
|
}
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
fallthrough: false, // ! Important: don't call next middleware if file isn't found
|
||||||
|
};
|
||||||
|
|
||||||
|
// express.static(filePath, options)(req, res, next);
|
||||||
|
// Serve the file using fs.createReadStream
|
||||||
|
const stream = fs.createReadStream(filePath);
|
||||||
|
stream.pipe(res);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// * other api routes
|
// ? other api routes
|
||||||
app.use('/api/v1', routes);
|
app.use('/api/v1', routes);
|
||||||
|
|
||||||
|
// ? Error handling middleware
|
||||||
// ! Error handling middleware
|
|
||||||
const errorHandler = require('./middleware/errorHandler');
|
|
||||||
app.use(errorHandler);
|
app.use(errorHandler);
|
||||||
|
|
||||||
// ! KILLER ROUTE: used to crash the backend
|
// ? KILLER ROUTE: used to crash the backend
|
||||||
app.use('/killer', killerRouter);
|
app.use('/killer', killerRouter);
|
||||||
|
|
||||||
// Start the server
|
// * Start the server
|
||||||
|
const doUpdate = false;
|
||||||
|
const doForce = false;
|
||||||
console.log(`Syncing database schema...`);
|
console.log(`Syncing database schema...`);
|
||||||
sequelize
|
sequelize
|
||||||
// .sync({force: true}) // will drop all tables and recreate them.
|
// .sync({force: true}) // will drop all tables and recreate them.
|
||||||
// .sync({ alter: true }) // will attempt to automatically alter tables to fit the model definitions.
|
.sync({ alter: doUpdate }) // will attempt to automatically alter tables to fit the model definitions.
|
||||||
.sync()
|
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
console.log(`Database schema synced...`);
|
console.log(`Database schema synced.`);
|
||||||
initializeData();
|
initializeData();
|
||||||
|
|
||||||
app.listen(PORT, () => {
|
app.listen(PORT, () => {
|
||||||
//const Entry = require("./models/Entry.js")
|
console.log(`Backend server running on http://localhost:${PORT}/`);
|
||||||
console.log(`Backend server running on http://localhost:${PORT}`);
|
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
|
|||||||
@@ -515,7 +515,10 @@ async function refrechEntry(entryId) {
|
|||||||
if (oldEntry.is_tvseries) includes.push({ model: Season, as: 'seasons' });
|
if (oldEntry.is_tvseries) includes.push({ model: Season, as: 'seasons' });
|
||||||
|
|
||||||
const updatedEntry = await Entry.findByPk(entryId, {
|
const updatedEntry = await Entry.findByPk(entryId, {
|
||||||
include: includes
|
include: includes,
|
||||||
|
order: [
|
||||||
|
[{ model: EntrySeen, as: 'entrySeen' }, 'date_seen', 'DESC'] // Order the entry-seen list
|
||||||
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
const entryData = updatedEntry.get({ plain: true });
|
const entryData = updatedEntry.get({ plain: true });
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
// logService.js
|
||||||
|
const fs = require('fs');
|
||||||
|
const util = require('util');
|
||||||
|
|
||||||
|
// Convert fs.writeFile to a promise-based function
|
||||||
|
const writeFile = util.promisify(fs.writeFile);
|
||||||
|
|
||||||
|
// Ensure the log file exists and is accessible
|
||||||
|
const logFilePath = 'showy.log';
|
||||||
|
fs.open(logFilePath, 'a', (err, fd) => {
|
||||||
|
if (err) {
|
||||||
|
console.error("Failed to open log file:", err);
|
||||||
|
} else {
|
||||||
|
fs.close(fd, (err) => {
|
||||||
|
if (err) console.error("Failed to close log file:", err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Asynchronous function to append a message to the log file
|
||||||
|
async function logToFile(message) {
|
||||||
|
try {
|
||||||
|
await writeFile(logFilePath, `${message}\n`, { flag: 'a' });
|
||||||
|
} catch (err) {
|
||||||
|
console.error("Failed to write to log file:", err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
logToFile,
|
||||||
|
};
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
const parrentProcess = JSON.parse(process.env.PARENT_PROCESS || '{}');
|
||||||
|
|
||||||
|
let userDataPath = '';
|
||||||
|
const defaultSettings = {
|
||||||
|
userDataPath: '',
|
||||||
|
tmdbApiUrl: '',
|
||||||
|
tmdbApiKey: '',
|
||||||
|
frontPort: '',
|
||||||
|
backPort: '',
|
||||||
|
portableMode: '',
|
||||||
|
};
|
||||||
|
|
||||||
|
function getUserDataPath() {
|
||||||
|
// return parrentProcess.electron_path || path.join(__dirname, '..', '..', 'data');
|
||||||
|
return path.join(__dirname, '..', '..');
|
||||||
|
}
|
||||||
|
|
||||||
|
function getSettingsFilePath() {
|
||||||
|
return path.join(getUserDataPath(), 'settings.json');
|
||||||
|
}
|
||||||
|
|
||||||
|
function getSettings() {
|
||||||
|
const settingsFilePath = getSettingsFilePath();
|
||||||
|
|
||||||
|
try {
|
||||||
|
const settingsData = fs.readFileSync(settingsFilePath);
|
||||||
|
// console.log(`Loaded settings file.`);
|
||||||
|
return JSON.parse(settingsData);
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error reading settings file:', err);
|
||||||
|
console.log('Creating default settings file...');
|
||||||
|
|
||||||
|
let newSettingsFile = { ...defaultSettings };
|
||||||
|
|
||||||
|
let defaultDataPath = path.join(getUserDataPath(), 'data')
|
||||||
|
|
||||||
|
newSettingsFile.userDataPath = defaultDataPath;
|
||||||
|
newSettingsFile.backPort = 4000;
|
||||||
|
|
||||||
|
fs.mkdirSync(defaultDataPath, { recursive: true });
|
||||||
|
fs.writeFileSync(settingsFilePath, JSON.stringify(newSettingsFile, null, 2));
|
||||||
|
console.log('Default settings file created.');
|
||||||
|
|
||||||
|
return defaultSettings;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateSettings(newSettings) {
|
||||||
|
const settingsFilePath = getSettingsFilePath();
|
||||||
|
|
||||||
|
let updatedSettings = { ...userDataPath, ...newSettings };
|
||||||
|
fs.mkdirSync(newSettings.userDataPath, { recursive: true }); // making sure the newly set data path is created before saving the new config
|
||||||
|
fs.writeFileSync(settingsFilePath, JSON.stringify(updatedSettings, null, 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
getSettings,
|
||||||
|
updateSettings
|
||||||
|
};
|
||||||
@@ -1,26 +1,30 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { RouterModule, Routes } from '@angular/router';
|
import { RouterModule, Routes } from '@angular/router';
|
||||||
import { HomeComponent } from './features/home/home.component';
|
import { HomeComponent } from './features/home/home.component';
|
||||||
import { SearchComponent } from './features/discover/search/search.component';
|
import { SearchPageComponent } from './features/discover/search-page/search-page.component';
|
||||||
import { TrendingComponent } from './features/discover/trending/trending.component';
|
import { TrendingComponent } from './features/discover/trending/trending.component';
|
||||||
import { PopularComponent } from './features/discover/popular/popular.component';
|
import { PopularComponent } from './features/discover/popular/popular.component';
|
||||||
import { LibraryComponent } from './features/library/library.component';
|
import { LibraryComponent } from './features/library/library.component';
|
||||||
import { FavoritComponent } from './features/favorit/favorit.component';
|
import { FavoritComponent } from './features/favorit/favorit.component';
|
||||||
import { WatchlistComponent } from './features/watchlist/watchlist.component';
|
import { WatchlistComponent } from './features/watchlist/watchlist.component';
|
||||||
import { SettingsComponent } from './features/settings/settings.component';
|
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{ path: '', redirectTo: '/home', pathMatch: 'full' },
|
{ path: '', redirectTo: '/home', pathMatch: 'full' },
|
||||||
{ path: 'home', component: HomeComponent },
|
{ path: 'home', component: HomeComponent },
|
||||||
{ path: 'search', component: SearchComponent },
|
{ path: 'search', component: SearchPageComponent },
|
||||||
{ path: 'popular', component: PopularComponent },
|
{ path: 'popular', component: PopularComponent },
|
||||||
{ path: 'trending', component: TrendingComponent },
|
{ path: 'trending', component: TrendingComponent },
|
||||||
|
|
||||||
{ path: 'library', component: LibraryComponent },
|
{ path: 'library', component: LibraryComponent },
|
||||||
{ path: 'favorit', component: FavoritComponent },
|
{ path: 'favorit', component: FavoritComponent },
|
||||||
{ path: 'watchlist', component: WatchlistComponent },
|
{ path: 'watchlist', component: WatchlistComponent },
|
||||||
{ path: 'settings', component: SettingsComponent },
|
{
|
||||||
// { path: 'entry', component: LibraryComponent },
|
path: 'settings',
|
||||||
|
loadChildren: () =>
|
||||||
|
import('./features/settings/settings.module').then(
|
||||||
|
(m) => m.SettingsModule
|
||||||
|
),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'entries',
|
path: 'entries',
|
||||||
loadChildren: () =>
|
loadChildren: () =>
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
import { AfterViewInit, Component, ElementRef, ViewChild } from '@angular/core';
|
import { AfterViewInit, Component, ElementRef, ViewChild } from '@angular/core';
|
||||||
|
import { NavigationEnd, Router } from '@angular/router';
|
||||||
|
import { filter } from 'rxjs';
|
||||||
|
|
||||||
import PerfectScrollbar from 'perfect-scrollbar';
|
import PerfectScrollbar from 'perfect-scrollbar';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -7,12 +10,25 @@ import PerfectScrollbar from 'perfect-scrollbar';
|
|||||||
styleUrl: './app.component.css',
|
styleUrl: './app.component.css',
|
||||||
})
|
})
|
||||||
export class AppComponent implements AfterViewInit {
|
export class AppComponent implements AfterViewInit {
|
||||||
|
title = 'Showy';
|
||||||
|
|
||||||
@ViewChild('scrollContainer', { static: true }) scrollContainer!: ElementRef;
|
@ViewChild('scrollContainer', { static: true }) scrollContainer!: ElementRef;
|
||||||
private ps!: PerfectScrollbar;
|
private ps!: PerfectScrollbar;
|
||||||
|
|
||||||
title = 'ShowZ';
|
constructor(private router: Router) {}
|
||||||
|
|
||||||
ngAfterViewInit() {
|
ngAfterViewInit() {
|
||||||
this.ps = new PerfectScrollbar(this.scrollContainer.nativeElement);
|
this.ps = new PerfectScrollbar(this.scrollContainer.nativeElement);
|
||||||
|
|
||||||
|
this.router.events
|
||||||
|
.pipe(filter(event => event instanceof NavigationEnd))
|
||||||
|
.subscribe(() => {
|
||||||
|
this.scrollToTop();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
scrollToTop() {
|
||||||
|
this.scrollContainer.nativeElement.scrollTop = 0;
|
||||||
|
this.ps.update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -14,7 +14,7 @@ import { CommonModule, DatePipe } from '@angular/common';
|
|||||||
import { HomeComponent } from './features/home/home.component';
|
import { HomeComponent } from './features/home/home.component';
|
||||||
import { PopularComponent } from './features/discover/popular/popular.component';
|
import { PopularComponent } from './features/discover/popular/popular.component';
|
||||||
import { TrendingComponent } from './features/discover/trending/trending.component';
|
import { TrendingComponent } from './features/discover/trending/trending.component';
|
||||||
import { SearchComponent } from './features/discover/search/search.component';
|
import { SearchPageComponent } from './features/discover/search-page/search-page.component';
|
||||||
import { LibraryComponent } from './features/library/library.component';
|
import { LibraryComponent } from './features/library/library.component';
|
||||||
|
|
||||||
import { DynamicEntryListComponent } from './shared/components/lists/dynamic-entry-list/dynamic-entry-list.component';
|
import { DynamicEntryListComponent } from './shared/components/lists/dynamic-entry-list/dynamic-entry-list.component';
|
||||||
@@ -23,7 +23,6 @@ import { MainCardComponent } from './shared/components/cards/main-card/main-card
|
|||||||
import { FavoritComponent } from './features/favorit/favorit.component';
|
import { FavoritComponent } from './features/favorit/favorit.component';
|
||||||
import { WatchlistComponent } from './features/watchlist/watchlist.component';
|
import { WatchlistComponent } from './features/watchlist/watchlist.component';
|
||||||
import { SharedModule } from './shared/shared.module';
|
import { SharedModule } from './shared/shared.module';
|
||||||
import { SettingsComponent } from './features/settings/settings.component';
|
|
||||||
import { ToastrModule } from 'ngx-toastr';
|
import { ToastrModule } from 'ngx-toastr';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
@@ -53,11 +52,10 @@ import { ToastrModule } from 'ngx-toastr';
|
|||||||
HomeComponent,
|
HomeComponent,
|
||||||
PopularComponent,
|
PopularComponent,
|
||||||
TrendingComponent,
|
TrendingComponent,
|
||||||
SearchComponent,
|
SearchPageComponent,
|
||||||
LibraryComponent,
|
LibraryComponent,
|
||||||
FavoritComponent,
|
FavoritComponent,
|
||||||
WatchlistComponent,
|
WatchlistComponent,
|
||||||
SettingsComponent,
|
|
||||||
|
|
||||||
// ? temp shared components
|
// ? temp shared components
|
||||||
MainCardComponent,
|
MainCardComponent,
|
||||||
|
|||||||
@@ -580,19 +580,19 @@
|
|||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<hr class="dropdown-divider">
|
<hr class="dropdown-divider">
|
||||||
<a class="dropdown-item d-flex align-items-center gap-2 py-2" href="javascript:;"><i
|
<a class="dropdown-item d-flex align-items-center gap-2 py-2" href="javascript:;">
|
||||||
class="material-icons-outlined">person_outline</i>Profile</a>
|
<i class="material-icons-outlined">person_outline</i>Profile</a>
|
||||||
<a class="dropdown-item d-flex align-items-center gap-2 py-2" href="javascript:;"><i
|
<a class="dropdown-item d-flex align-items-center gap-2 py-2" href="javascript:;">
|
||||||
class="material-icons-outlined">local_bar</i>Setting</a>
|
<i class="material-icons-outlined">local_bar</i>Setting</a>
|
||||||
<a class="dropdown-item d-flex align-items-center gap-2 py-2" href="javascript:;"><i
|
<a class="dropdown-item d-flex align-items-center gap-2 py-2" href="javascript:;">
|
||||||
class="material-icons-outlined">dashboard</i>Dashboard</a>
|
<i class="material-icons-outlined">dashboard</i>Dashboard</a>
|
||||||
<a class="dropdown-item d-flex align-items-center gap-2 py-2" href="javascript:;"><i
|
<a class="dropdown-item d-flex align-items-center gap-2 py-2" href="javascript:;">
|
||||||
class="material-icons-outlined">account_balance</i>Earning</a>
|
<i class="material-icons-outlined">account_balance</i>Earning</a>
|
||||||
<a class="dropdown-item d-flex align-items-center gap-2 py-2" href="javascript:;"><i
|
<a class="dropdown-item d-flex align-items-center gap-2 py-2" href="javascript:;">
|
||||||
class="material-icons-outlined">cloud_download</i>Downloads</a>
|
<i class="material-icons-outlined">cloud_download</i>Downloads</a>
|
||||||
<hr class="dropdown-divider">
|
<hr class="dropdown-divider">
|
||||||
<a class="dropdown-item d-flex align-items-center gap-2 py-2" href="javascript:;"><i
|
<a class="dropdown-item d-flex align-items-center gap-2 py-2" href="javascript:;">
|
||||||
class="material-icons-outlined">power_settings_new</i>Logout</a>
|
<i class="material-icons-outlined">power_settings_new</i>Logout</a>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ a {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-wrapper .sidebar-header .logo-img {
|
.sidebar-wrapper .sidebar-header .logo-img {
|
||||||
width: 48px;
|
height: 40px;
|
||||||
|
width: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-wrapper .sidebar-header,
|
.sidebar-wrapper .sidebar-header,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<img src="assets/images/logo3.png" class="logo-img" alt="">
|
<img src="assets/images/logo3.png" class="logo-img" alt="">
|
||||||
</div>
|
</div>
|
||||||
<div class="logo-name flex-grow-1">
|
<div class="logo-name flex-grow-1">
|
||||||
<h5 class="mb-0">ShowzY</h5>
|
<h5 class="mb-0">Showy</h5>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="sidebar-close">
|
<!-- <div class="sidebar-close">
|
||||||
<span class="material-icons-outlined">close</span>
|
<span class="material-icons-outlined">close</span>
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { EntrySeen } from '../../shared/models/entrySeen.model';
|
|
||||||
import { EntryRating } from '../../shared/models/entryRating.model';
|
import { EntryRating } from '../../shared/models/entryRating.model';
|
||||||
|
import { environment } from '../../../environments/environment.prod';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class EntryRatingsService {
|
export class EntryRatingsService {
|
||||||
private backend_apiUrl = 'http://localhost:4000/api/v1';
|
private backend_apiUrl = environment.API_URL;
|
||||||
private apiAction = 'entry-ratings';
|
private apiAction = 'entry-ratings';
|
||||||
|
|
||||||
constructor(private http: HttpClient) {}
|
constructor(private http: HttpClient) {}
|
||||||
@@ -16,7 +16,7 @@ export class EntryRatingsService {
|
|||||||
return this.http.put<EntryRating>(
|
return this.http.put<EntryRating>(
|
||||||
`${this.backend_apiUrl}/${this.apiAction}/${entryRatings.id}`,
|
`${this.backend_apiUrl}/${this.apiAction}/${entryRatings.id}`,
|
||||||
{
|
{
|
||||||
entryR: entryRatings
|
entryR: entryRatings,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { EntrySeen } from '../../shared/models/entrySeen.model';
|
import { EntrySeen } from '../../shared/models/entrySeen.model';
|
||||||
|
import { environment } from '../../../environments/environment.prod';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class EntrySeenService {
|
export class EntrySeenService {
|
||||||
private backend_apiUrl = 'http://localhost:4000/api/v1';
|
private backend_apiUrl = environment.API_URL;
|
||||||
private apiAction = 'entry-seen';
|
private apiAction = 'entry-seen';
|
||||||
|
|
||||||
constructor(private http: HttpClient) {}
|
constructor(private http: HttpClient) {}
|
||||||
@@ -22,6 +23,16 @@ export class EntrySeenService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateEntrySeen(entrySeen: EntrySeen) {
|
||||||
|
return this.http.put<EntrySeen>(
|
||||||
|
`${this.backend_apiUrl}/${this.apiAction}/${entrySeen.id}`,
|
||||||
|
{
|
||||||
|
date_seen: entrySeen.date_seen,
|
||||||
|
seen_with: entrySeen.seen_with,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// get entry seen by entry id
|
// get entry seen by entry id
|
||||||
getEntrySeenById(id: string) {
|
getEntrySeenById(id: string) {
|
||||||
return this.http.get<EntrySeen[]>(
|
return this.http.get<EntrySeen[]>(
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ import { Observable, map } from 'rxjs';
|
|||||||
import { Entry } from '../../shared/models/entry.model';
|
import { Entry } from '../../shared/models/entry.model';
|
||||||
import { EntryId } from '../../shared/models/entryId.model';
|
import { EntryId } from '../../shared/models/entryId.model';
|
||||||
import { EntryRating } from '../../shared/models/entryRating.model';
|
import { EntryRating } from '../../shared/models/entryRating.model';
|
||||||
// import { environment } from '../../../environments/environment';
|
import { environment } from '../../../environments/environment.prod';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class EntryService {
|
export class EntryService {
|
||||||
private backend_apiUrl = 'http://localhost:4000/api/v1';
|
private backend_apiUrl = environment.API_URL;
|
||||||
private apiAction = 'entries';
|
private apiAction = 'entries';
|
||||||
|
|
||||||
constructor(private http: HttpClient) {}
|
constructor(private http: HttpClient) {}
|
||||||
|
|||||||
@@ -2,12 +2,13 @@ import { Injectable } from '@angular/core';
|
|||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { EpisodeSeen } from '../../shared/models/episodeSeen.model';
|
import { EpisodeSeen } from '../../shared/models/episodeSeen.model';
|
||||||
import { EpisodeSeenDto } from '../../shared/models/dtos/episode-seen.dto';
|
import { EpisodeSeenDto } from '../../shared/models/dtos/episode-seen.dto';
|
||||||
|
import { environment } from '../../../environments/environment.prod';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class EpisodeSeenService {
|
export class EpisodeSeenService {
|
||||||
private backend_apiUrl = 'http://localhost:4000/api/v1';
|
private backend_apiUrl = environment.API_URL;
|
||||||
private apiAction = 'episode-seen';
|
private apiAction = 'episode-seen';
|
||||||
|
|
||||||
constructor(private http: HttpClient) {}
|
constructor(private http: HttpClient) {}
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
|
import { environment } from '../../../environments/environment.prod';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class EpisodeService {
|
export class EpisodeService {
|
||||||
private backend_apiUrl = 'http://localhost:4000/api/v1';
|
private backend_apiUrl = environment.API_URL;
|
||||||
private apiAction = 'episodes';
|
private apiAction = 'episodes';
|
||||||
|
|
||||||
constructor(private http: HttpClient) {}
|
constructor(private http: HttpClient) {}
|
||||||
|
|||||||
@@ -2,12 +2,13 @@ import { Injectable } from '@angular/core';
|
|||||||
import { MovieDateSeen } from '../../shared/models/dtos/movieDateSeen.model';
|
import { MovieDateSeen } from '../../shared/models/dtos/movieDateSeen.model';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { Entry } from '../../shared/models/entry.model';
|
import { Entry } from '../../shared/models/entry.model';
|
||||||
|
import { environment } from '../../../environments/environment.prod';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class ImporterService {
|
export class ImporterService {
|
||||||
private backend_apiUrl = 'http://localhost:4000/api/v1';
|
private backend_apiUrl = environment.API_URL;
|
||||||
private apiAction = 'entries';
|
private apiAction = 'entries';
|
||||||
|
|
||||||
constructor(private http: HttpClient) {}
|
constructor(private http: HttpClient) {}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { catchError, switchMap, tap } from 'rxjs/operators';
|
|||||||
import { Entry } from '../../shared/models/entry.model';
|
import { Entry } from '../../shared/models/entry.model';
|
||||||
import { EntryId } from '../../shared/models/entryId.model';
|
import { EntryId } from '../../shared/models/entryId.model';
|
||||||
import { EntryRating } from '../../shared/models/entryRating.model';
|
import { EntryRating } from '../../shared/models/entryRating.model';
|
||||||
|
import { environment } from '../../../environments/environment.prod';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
@@ -13,7 +14,8 @@ export class LibraryService implements OnInit {
|
|||||||
private libraryEntriesSubject = new ReplaySubject<Entry[]>(1);
|
private libraryEntriesSubject = new ReplaySubject<Entry[]>(1);
|
||||||
private entriesLoaded = false;
|
private entriesLoaded = false;
|
||||||
|
|
||||||
private backend_apiUrl = ' http://localhost:4000/api/v1';
|
private backend_apiUrl = environment.API_URL;
|
||||||
|
private apiAction = 'entries';
|
||||||
|
|
||||||
constructor(private http: HttpClient) {}
|
constructor(private http: HttpClient) {}
|
||||||
|
|
||||||
@@ -48,7 +50,7 @@ export class LibraryService implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fetchAllEntries(forceFetch: boolean = false): Observable<Entry[]> {
|
private fetchAllEntries(forceFetch: boolean = false): Observable<Entry[]> {
|
||||||
const endPoint = `${this.backend_apiUrl}/entries`;
|
const endPoint = `${this.backend_apiUrl}/${this.apiAction}`;
|
||||||
|
|
||||||
// If data is already loaded and not force fetching, immediately return the cached observable.
|
// If data is already loaded and not force fetching, immediately return the cached observable.
|
||||||
if (this.entriesLoaded && !forceFetch) {
|
if (this.entriesLoaded && !forceFetch) {
|
||||||
@@ -80,10 +82,13 @@ export class LibraryService implements OnInit {
|
|||||||
if (existingEntry) {
|
if (existingEntry) {
|
||||||
return of(existingEntry);
|
return of(existingEntry);
|
||||||
} else {
|
} else {
|
||||||
return this.http.post<Entry>(`${this.backend_apiUrl}/entries`, {
|
return this.http.post<Entry>(
|
||||||
tmdb_id: tmdb_id,
|
`${this.backend_apiUrl}/${this.apiAction}`,
|
||||||
is_tvserie: is_tvserie,
|
{
|
||||||
});
|
tmdb_id: tmdb_id,
|
||||||
|
is_tvserie: is_tvserie,
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@@ -91,7 +96,7 @@ export class LibraryService implements OnInit {
|
|||||||
|
|
||||||
deleteEntry(id: number): Observable<any> {
|
deleteEntry(id: number): Observable<any> {
|
||||||
// Directly attempt to delete the entry without fetching all entries first.
|
// Directly attempt to delete the entry without fetching all entries first.
|
||||||
return this.http.delete(`${this.backend_apiUrl}/entries/${id}`);
|
return this.http.delete(`${this.backend_apiUrl}/${this.apiAction}/${id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
isInLibrary(tmdb_id: string): Observable<Entry | null> {
|
isInLibrary(tmdb_id: string): Observable<Entry | null> {
|
||||||
|
|||||||
@@ -2,12 +2,13 @@ import { Injectable } from '@angular/core';
|
|||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { Season } from '../../shared/models/season.model';
|
import { Season } from '../../shared/models/season.model';
|
||||||
import { Episode } from '../../shared/models/episode.models';
|
import { Episode } from '../../shared/models/episode.models';
|
||||||
|
import { environment } from '../../../environments/environment.prod';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class SeasonService {
|
export class SeasonService {
|
||||||
private backend_apiUrl = 'http://localhost:4000/api/v1';
|
private backend_apiUrl = environment.API_URL;
|
||||||
private apiAction = 'seasons';
|
private apiAction = 'seasons';
|
||||||
|
|
||||||
constructor(private http: HttpClient) {}
|
constructor(private http: HttpClient) {}
|
||||||
@@ -31,4 +32,10 @@ export class SeasonService {
|
|||||||
`${this.backend_apiUrl}/${this.apiAction}/${id}/episodes`
|
`${this.backend_apiUrl}/${this.apiAction}/${id}/episodes`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getSeasonsWithEpisodesByEntryId(entryId: number) {
|
||||||
|
return this.http.get<Season[]>(
|
||||||
|
`${this.backend_apiUrl}/entries/${entryId}/seasons`
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { HttpClient } from '@angular/common/http';
|
||||||
|
import { environment } from '../../../environments/environment.prod';
|
||||||
|
import { Settings } from '../../shared/models/settings.model';
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root',
|
||||||
|
})
|
||||||
|
export class SettingsService {
|
||||||
|
private backend_apiUrl = environment.API_URL;
|
||||||
|
private apiAction = 'settings';
|
||||||
|
|
||||||
|
constructor(private http: HttpClient) {}
|
||||||
|
|
||||||
|
getSettings() {
|
||||||
|
return this.http.get<Settings>(`${this.backend_apiUrl}/${this.apiAction}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateSettings(settings: Settings) {
|
||||||
|
return this.http.put<any>(
|
||||||
|
`${this.backend_apiUrl}/${this.apiAction}`,
|
||||||
|
settings
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import { Observable, from, map, of, switchMap, toArray } from 'rxjs';
|
|||||||
import { Entry } from '../../shared/models/entry.model';
|
import { Entry } from '../../shared/models/entry.model';
|
||||||
import { EntryId } from '../../shared/models/entryId.model';
|
import { EntryId } from '../../shared/models/entryId.model';
|
||||||
import { EntryRating } from '../../shared/models/entryRating.model';
|
import { EntryRating } from '../../shared/models/entryRating.model';
|
||||||
|
import { environment } from '../../../environments/environment.prod';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
@@ -14,8 +15,8 @@ export class TmdbService {
|
|||||||
constructor(private http: HttpClient) {}
|
constructor(private http: HttpClient) {}
|
||||||
|
|
||||||
// private apiUrl = environment.apiBaseUrl;
|
// private apiUrl = environment.apiBaseUrl;
|
||||||
private tmdb_apiUrl = 'https://api.themoviedb.org/3';
|
private tmdb_apiUrl = environment.TMDB_API_URL;
|
||||||
private tmdb_apiKey = '5323ef3dc430df54dcb9e58c37fd22bb';
|
private tmdb_apiKey = environment.TMDB_API_KEY;
|
||||||
|
|
||||||
fetchdata(endPoint: string): Observable<any> {
|
fetchdata(endPoint: string): Observable<any> {
|
||||||
if (this.cach[endPoint]) {
|
if (this.cach[endPoint]) {
|
||||||
@@ -34,9 +35,6 @@ export class TmdbService {
|
|||||||
|
|
||||||
getEntriesUsingEndPoint(endPoint: string): Observable<Entry[]> {
|
getEntriesUsingEndPoint(endPoint: string): Observable<Entry[]> {
|
||||||
return this.fetchdata(endPoint).pipe(
|
return this.fetchdata(endPoint).pipe(
|
||||||
// map((response) =>
|
|
||||||
// response.results.map((movie: any) => this.adaptMovieToEntry(movie))
|
|
||||||
// )
|
|
||||||
map((response) => {
|
map((response) => {
|
||||||
// Check if the data is from cache and has `exist` property
|
// Check if the data is from cache and has `exist` property
|
||||||
if (response.exist) {
|
if (response.exist) {
|
||||||
|
|||||||
@@ -4,12 +4,13 @@ import { Observable } from 'rxjs';
|
|||||||
import { UserCollection } from '../../shared/models/userCollection.model';
|
import { UserCollection } from '../../shared/models/userCollection.model';
|
||||||
import { UserCollectionEntry } from '../../shared/models/userCollectionEntry.model';
|
import { UserCollectionEntry } from '../../shared/models/userCollectionEntry.model';
|
||||||
import { Entry } from '../../shared/models/entry.model';
|
import { Entry } from '../../shared/models/entry.model';
|
||||||
|
import { environment } from '../../../environments/environment.prod';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class UserCollectionService {
|
export class UserCollectionService {
|
||||||
private backend_apiUrl = 'http://localhost:4000/api/v1';
|
private backend_apiUrl = environment.API_URL;
|
||||||
private apiAction = 'user-collections';
|
private apiAction = 'user-collections';
|
||||||
|
|
||||||
constructor(private http: HttpClient) {}
|
constructor(private http: HttpClient) {}
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@
|
|||||||
<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">
|
||||||
<img src="https://picsum.photos/70" width="70" class="rounded-3" alt="">
|
<img [src]="getLogoPath()" width="80" class="rounded-3" alt="">
|
||||||
</div>
|
</div>
|
||||||
<div class="product-info">
|
<div class="product-info">
|
||||||
<a href="javascript:;" class="product-title">{{entry.title}}</a>
|
<a href="javascript:;" class="product-title">{{entry.title}}</a>
|
||||||
|
|||||||
+22
@@ -64,6 +64,28 @@ export class CollectionTableLineComponent implements OnInit {
|
|||||||
return `https://image.tmdb.org/t/p/w500` + this.entry.poster_path;
|
return `https://image.tmdb.org/t/p/w500` + this.entry.poster_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getLogoPath() {
|
||||||
|
// * Is in library: use a local logo
|
||||||
|
if (this.entry.medias) {
|
||||||
|
const selectedLogos = this.entry.medias.filter(
|
||||||
|
(m) => m.type == 'logo' && m.is_selected
|
||||||
|
);
|
||||||
|
|
||||||
|
if (
|
||||||
|
selectedLogos.length &&
|
||||||
|
selectedLogos[0] &&
|
||||||
|
selectedLogos[0].path
|
||||||
|
) {
|
||||||
|
const name = selectedLogos[0].path.split('.')[0];
|
||||||
|
const extention = selectedLogos[0].path.split('.')[1];
|
||||||
|
return `http://localhost:4000/api/v1/media/entries/logos/${name}.${extention}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// * No poster found, use default poster image as a last stand
|
||||||
|
return 'assets/images/default/default-logo.png';
|
||||||
|
}
|
||||||
|
|
||||||
removeEntryFromList() {
|
removeEntryFromList() {
|
||||||
const dialogRef = this.dialog.open(ConfirmModalComponent, {
|
const dialogRef = this.dialog.open(ConfirmModalComponent, {
|
||||||
width: '400px',
|
width: '400px',
|
||||||
|
|||||||
+18
-4
@@ -6,15 +6,29 @@
|
|||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.list-line {
|
.collection-card {
|
||||||
border-radius: 1px;
|
border-radius: 1px;
|
||||||
padding: 2px;
|
padding: 5px;
|
||||||
|
min-height: 225px;
|
||||||
|
margin: 10px 10px;
|
||||||
|
}
|
||||||
|
.card-coat{
|
||||||
|
height: 100%;
|
||||||
|
border-radius: 5px;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.list-line:hover {
|
.card-coat:hover {
|
||||||
background-color: var(--shz-light-bgh);
|
background-color: var(--shz-light-bgh);
|
||||||
}
|
}
|
||||||
|
|
||||||
:host-context([data-bs-theme="dark"]) .list-line:hover {
|
:host-context([data-bs-theme="dark"]) .card-coat:hover {
|
||||||
background-color: var(--shz-dark-bgh);
|
background-color: var(--shz-dark-bgh);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#poster {
|
||||||
|
border-radius: 5px;
|
||||||
|
min-height: 225px;
|
||||||
|
height: 225px;
|
||||||
|
object-fit:cover;
|
||||||
|
}
|
||||||
+8
-9
@@ -1,11 +1,10 @@
|
|||||||
<div class="d-flex align-items-start gap-2 list-line" @fadeInOut>
|
<div class="card-coat">
|
||||||
<img [src]="getPostPath()" width="70" height="105" class="" alt="List poster" (click)="redirectTo()">
|
<div class="d-flex flex-column align-items-center collection-card" @fadeInOut>
|
||||||
<div class="flex-grow-1 list-item-1">
|
<img id="poster" [src]="getPostPath()" width="150" class="" alt="List poster" (click)="redirectTo()">
|
||||||
<h6 class="mb-0 list-title" (click)="redirectTo()">{{list.name}}</h6>
|
<div class="list-item-1 mt-2 text-center">
|
||||||
<p class="mb-0">Created: {{getCreatedDate() | dateFormat}}</p>
|
<h6 class="mb-0 list-title" (click)="redirectTo()">{{list.name}}</h6>
|
||||||
<p class="mb-0">Contains: {{list.userCollectionEntries.length}} title(s)</p>
|
<!-- <p class="mb-0">Created: {{getCreatedDate() | dateFormat}}</p> -->
|
||||||
|
<!-- <p class="mb-0">Contains: {{list.userCollectionEntries.length}} title(s)</p> -->
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="form-check form-check-inline me-0">
|
|
||||||
<input class="form-check-input ms-0" type="checkbox">
|
|
||||||
</div> -->
|
|
||||||
</div>
|
</div>
|
||||||
+6
@@ -0,0 +1,6 @@
|
|||||||
|
.collections-container{
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fill,
|
||||||
|
minmax(150px, 2fr));
|
||||||
|
gap: 20px;
|
||||||
|
}
|
||||||
+9
-4
@@ -30,14 +30,19 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card-body p-0">
|
<div class="card-body p-0">
|
||||||
<div class="p-3 ps ps--active-y">
|
|
||||||
|
<div class="collections-container">
|
||||||
|
<app-userCollections-list-item *ngFor="let list of collectionsToShow"
|
||||||
|
[list]="list" @animateDestroy></app-userCollections-list-item>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- <div class="p-3 ps ps--active-y">
|
||||||
<div class="d-flex flex-column gap-3">
|
<div class="d-flex flex-column gap-3">
|
||||||
<!-- item start -->
|
|
||||||
<app-userCollections-list-item *ngFor="let list of collectionsToShow"
|
<app-userCollections-list-item *ngFor="let list of collectionsToShow"
|
||||||
[list]="list" @animateDestroy></app-userCollections-list-item>
|
[list]="list" @animateDestroy></app-userCollections-list-item>
|
||||||
<!-- item end -->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div> -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,21 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { SearchPageComponent } from './search-page.component';
|
||||||
|
|
||||||
|
describe('SearchPageComponent', () => {
|
||||||
|
let component: SearchPageComponent;
|
||||||
|
let fixture: ComponentFixture<SearchPageComponent>;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [SearchPageComponent]
|
||||||
|
});
|
||||||
|
fixture = TestBed.createComponent(SearchPageComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
+4
-4
@@ -5,11 +5,11 @@ import { FormControl } from '@angular/forms';
|
|||||||
import { debounceTime, distinctUntilChanged } from 'rxjs';
|
import { debounceTime, distinctUntilChanged } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-search',
|
selector: 'app-search-page',
|
||||||
templateUrl: './search.component.html',
|
templateUrl: './search-page.component.html',
|
||||||
styleUrls: ['./search.component.css'],
|
styleUrls: ['./search-page.component.css'],
|
||||||
})
|
})
|
||||||
export class SearchComponent implements OnInit {
|
export class SearchPageComponent implements OnInit {
|
||||||
entryType: boolean = true;
|
entryType: boolean = true;
|
||||||
entries: Entry[] = [];
|
entries: Entry[] = [];
|
||||||
isSearchLocked: boolean = false;
|
isSearchLocked: boolean = false;
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { SearchComponent } from './search.component';
|
|
||||||
|
|
||||||
describe('SearchComponent', () => {
|
|
||||||
let component: SearchComponent;
|
|
||||||
let fixture: ComponentFixture<SearchComponent>;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
declarations: [SearchComponent]
|
|
||||||
});
|
|
||||||
fixture = TestBed.createComponent(SearchComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.background-wrapper::after {
|
.background-wrapper::after {
|
||||||
content: '';
|
content: "";
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
@@ -25,13 +25,17 @@
|
|||||||
z-index: 2;
|
z-index: 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
[data-bs-theme=dark] .background-wrapper::after {
|
[data-bs-theme="dark"] .background-wrapper::after {
|
||||||
background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 60%, #181c1f 100%);
|
background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 60%, #181c1f 100%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.content-wrapper {
|
.content-wrapper {
|
||||||
color: #212529;
|
color: #212529;
|
||||||
background: linear-gradient(to bottom, rgba(255, 255, 255, 0.461) 10%, #eff1f3 100%);
|
background: linear-gradient(
|
||||||
|
to bottom,
|
||||||
|
rgba(255, 255, 255, 0.461) 10%,
|
||||||
|
#eff1f3 100%
|
||||||
|
);
|
||||||
|
|
||||||
backdrop-filter: blur(10px);
|
backdrop-filter: blur(10px);
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
@@ -40,17 +44,15 @@
|
|||||||
/* box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); */
|
/* box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); */
|
||||||
}
|
}
|
||||||
|
|
||||||
[data-bs-theme=dark] .content-wrapper {
|
[data-bs-theme="dark"] .content-wrapper {
|
||||||
color: #a7acb1;
|
color: #a7acb1;
|
||||||
background: linear-gradient(to bottom, rgba(33,
|
background: linear-gradient(
|
||||||
37,
|
to bottom,
|
||||||
41,
|
rgba(33, 37, 41, 0.7) 50%,
|
||||||
0.7) 50%, #181c1f 100%);
|
#181c1f 100%
|
||||||
|
);
|
||||||
|
|
||||||
background-color: rgba(33,
|
background-color: rgba(33, 37, 41, 0.7);
|
||||||
37,
|
|
||||||
41,
|
|
||||||
0.7);
|
|
||||||
border: 1px solid #181c1f;
|
border: 1px solid #181c1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,7 +81,6 @@
|
|||||||
margin: 10px 0;
|
margin: 10px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.side-info .list-group-item {
|
.side-info .list-group-item {
|
||||||
background-color: rgba(255, 255, 255, 0.461) !important;
|
background-color: rgba(255, 255, 255, 0.461) !important;
|
||||||
background-color: transparent !important;
|
background-color: transparent !important;
|
||||||
@@ -96,7 +97,7 @@
|
|||||||
font-size: 2.9rem !important;
|
font-size: 2.9rem !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
[data-bs-theme=dark] .title {
|
[data-bs-theme="dark"] .title {
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,7 +106,7 @@
|
|||||||
font-size: 2rem;
|
font-size: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
[data-bs-theme=dark] .right-col .entry-actions span {
|
[data-bs-theme="dark"] .right-col .entry-actions span {
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,9 +159,25 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.faved {
|
.faved {
|
||||||
font-variation-settings:
|
font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24;
|
||||||
'FILL' 1,
|
}
|
||||||
'wght' 400,
|
|
||||||
'GRAD' 0,
|
.info-item {
|
||||||
'opsz' 24
|
color: var(--shz-blue-default);
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-card {
|
||||||
|
background-color: transparent;
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-card hr {
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-card .accordion .accordion-item,
|
||||||
|
.info-card .accordion .accordion-header,
|
||||||
|
.info-card .accordion .accordion-header .accordion-button {
|
||||||
|
background-color: transparent;
|
||||||
|
border-radius: 0;
|
||||||
}
|
}
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
</rating>
|
</rating>
|
||||||
</div>
|
</div>
|
||||||
<!-- Movie Side Info -->
|
<!-- Movie Side Info -->
|
||||||
<ul class="list-group side-info">
|
<!-- <ul class="list-group side-info">
|
||||||
<li class="list-group-item" *ngIf="entry.entryRating.tmdb_rating"><strong>TMDB Rating:</strong>
|
<li class="list-group-item" *ngIf="entry.entryRating.tmdb_rating"><strong>TMDB Rating:</strong>
|
||||||
{{entry.entryRating.tmdb_rating | floatFormat:1}}/10</li>
|
{{entry.entryRating.tmdb_rating | floatFormat:1}}/10</li>
|
||||||
<li class="list-group-item" *ngIf="entry.entryRating.imdb_rating"><strong>IMDB Rating:</strong>
|
<li class="list-group-item" *ngIf="entry.entryRating.imdb_rating"><strong>IMDB Rating:</strong>
|
||||||
@@ -32,14 +32,61 @@
|
|||||||
<li class="list-group-item" *ngIf="entry.date_last_seen"><strong>Last Seen:</strong> {{entry.date_last_seen |
|
<li class="list-group-item" *ngIf="entry.date_last_seen"><strong>Last Seen:</strong> {{entry.date_last_seen |
|
||||||
dateFormat:'MMM dd, yyyy'}}
|
dateFormat:'MMM dd, yyyy'}}
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul> -->
|
||||||
<!-- End Movie Side Info -->
|
<div class="card info-card">
|
||||||
<br>
|
|
||||||
<!-- watch history -->
|
|
||||||
<div class="card" *ngIf="entry.entrySeen.length > 0">
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h5 class="card-title">Watch History</h5>
|
<h6 class="card-title">Info</h6>
|
||||||
<hr>
|
<hr>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong class="info-item">Premiere:</strong>
|
||||||
|
{{this.entry.release_date | dateFormat:'MMM dd, yyyy'}}
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item" *ngIf="entry.is_tvseries">
|
||||||
|
<strong class="info-item">Next Episode:</strong>
|
||||||
|
{{nextEpisode}}
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong class="info-item">Status:</strong>
|
||||||
|
{{status}}
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<li class="list-group-item" *ngIf="entry.date_first_seen">
|
||||||
|
<strong class="info-item">First Seen:</strong>
|
||||||
|
{{entry.date_first_seen | dateFormat:'MMM dd, yyyy'}}
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item" *ngIf="entry.date_last_seen">
|
||||||
|
<strong class="info-item">Last Seen:</strong>
|
||||||
|
{{entry.date_last_seen | dateFormat:'MMM dd, yyyy'}}
|
||||||
|
</li>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card info-card">
|
||||||
|
<div class="card-body">
|
||||||
|
<h6 class="card-title">Rating</h6>
|
||||||
|
<hr>
|
||||||
|
<li class="list-group-item" *ngIf="entry.entryRating.tmdb_rating">
|
||||||
|
<strong class="info-item">TMDB Rating:</strong>
|
||||||
|
{{entry.entryRating.tmdb_rating | floatFormat:1}}/10
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item" *ngIf="entry.entryRating.imdb_rating">
|
||||||
|
<strong class="info-item">IMDB Rating:</strong>
|
||||||
|
{{entry.entryRating.imdb_rating | floatFormat:1}}/10
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item" *ngIf="entry.entryRating.rotten_tomatoes_rating">
|
||||||
|
<strong class="info-item">Rotten Romatoes:</strong>
|
||||||
|
{{entry.entryRating.rotten_tomatoes_rating | floatFormat:1}}/10
|
||||||
|
</li>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- watch history -->
|
||||||
|
<div class="card info-card" *ngIf="entry.entrySeen.length > 0">
|
||||||
|
<div class="card-body">
|
||||||
|
<h6 class="card-title">Watch History</h6>
|
||||||
|
<!-- <hr> -->
|
||||||
<div class="accordion" id="accordionWatchHistory">
|
<div class="accordion" id="accordionWatchHistory">
|
||||||
<!-- start watch history - item -->
|
<!-- start watch history - item -->
|
||||||
<div class="accordion-item" *ngFor="let seen of entry.entrySeen">
|
<div class="accordion-item" *ngFor="let seen of entry.entrySeen">
|
||||||
@@ -61,7 +108,11 @@
|
|||||||
<span class="material-symbols-outlined" (click)="removeEntrySeen(seen.id)">
|
<span class="material-symbols-outlined" (click)="removeEntrySeen(seen.id)">
|
||||||
delete_forever
|
delete_forever
|
||||||
</span>
|
</span>
|
||||||
<!-- TODO add edit button -->
|
</button>
|
||||||
|
<button type="button" class="btn btn-icon-only">
|
||||||
|
<span class="material-symbols-outlined" (click)="editEntrySeen(seen)">
|
||||||
|
edit
|
||||||
|
</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -72,7 +123,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- end watch history -->
|
<!-- end watch history -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-8 right-col">
|
<div class="col-md-8 right-col">
|
||||||
@@ -113,14 +163,18 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- End Interraction buttons -->
|
<!-- End Interraction buttons -->
|
||||||
</div>
|
</div>
|
||||||
<!-- Movie Release Date -->
|
|
||||||
<p>{{this.entry.release_date | dateFormat:'yyyy'}} • {{genres}}</p>
|
|
||||||
|
|
||||||
<!-- Movie Overview -->
|
|
||||||
<p *ngIf="this.entry.title != this.entry.original_title">{{this.entry.original_title}}</p>
|
|
||||||
<p><strong>{{this.entry.tagline}}</strong></p>
|
|
||||||
<p>{{this.entry.storyline}}</p>
|
|
||||||
|
|
||||||
|
<div class="row p-3 pt-0">
|
||||||
|
<!-- Movie Release Date -->
|
||||||
|
<p class="p-0 m-0">
|
||||||
|
<span *ngIf="this.entry.title != this.entry.original_title">{{this.entry.original_title}} • </span>
|
||||||
|
{{this.entry.release_date | dateFormat:'yyyy'}} • {{genres}}
|
||||||
|
</p>
|
||||||
|
<!-- Movie Overview -->
|
||||||
|
<p class="p-0"><strong>{{this.entry.tagline}}</strong></p>
|
||||||
|
<p class="p-0">{{this.entry.storyline}}</p>
|
||||||
|
</div>
|
||||||
<!-- Series Seasons -->
|
<!-- Series Seasons -->
|
||||||
<div class="row" *ngIf="entry.is_tvseries">
|
<div class="row" *ngIf="entry.is_tvseries">
|
||||||
<h3>Seasons</h3>
|
<h3>Seasons</h3>
|
||||||
@@ -149,57 +203,71 @@
|
|||||||
<!-- <div class="row">
|
<!-- <div class="row">
|
||||||
<h3>Collections</h3>
|
<h3>Collections</h3>
|
||||||
</div> -->
|
</div> -->
|
||||||
|
|
||||||
<div class="row" *ngIf="this.entry.is_tvseries && this.seenHistory.length != 0">
|
<div class="row" *ngIf="this.entry.is_tvseries && this.seenHistory.length != 0">
|
||||||
<h3>Watch History</h3>
|
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||||
<table class="table table-striped">
|
<h3>Watch History</h3>
|
||||||
<thead>
|
<div class="dropdown">
|
||||||
<tr>
|
<button class="btn btn-sm btn-filter dropdown-toggle dropdown-toggle-nocaret bg-transparent" type="button"
|
||||||
<th>Season</th>
|
data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
<th>Episode</th>
|
<i class="bi bi-three-dots"></i>
|
||||||
<th>Date Seen</th>
|
</button>
|
||||||
<th>Seen With</th>
|
<ul class="dropdown-menu" style="cursor: pointer;">
|
||||||
<th>Action</th>
|
<li (click)="addEpisodeSeen()"><a class="dropdown-item">Add a watch date</a></li>
|
||||||
</tr>
|
</ul>
|
||||||
</thead>
|
</div>
|
||||||
<tbody>
|
</div>
|
||||||
<tr *ngFor="let item of seenHistoryToShow; let i = index">
|
|
||||||
<td>{{ item.season_number == 0 ? 'Special' : 'Season '+ item.season_number }}</td>
|
|
||||||
<td>{{ item.episode_number }}</td>
|
|
||||||
<td>{{ item.date_seen | dateFormat:'MMM dd, yyyy' }}</td>
|
|
||||||
<td>{{ item.seen_with }}</td>
|
|
||||||
<td>
|
|
||||||
<div class="dropdown">
|
|
||||||
<button class="btn btn-sm btn-filter dropdown-toggle dropdown-toggle-nocaret" type="button"
|
|
||||||
data-bs-toggle="dropdown" aria-expanded="false">
|
|
||||||
<i class="bi bi-three-dots"></i>
|
|
||||||
</button>
|
|
||||||
<ul class="dropdown-menu" style="cursor: pointer;">
|
|
||||||
<li (click)="editEpisodeSeen(item)"><a class="dropdown-item">Edit</a></li>
|
|
||||||
<li (click)="deleteEpisodeSeen(item)"><a class="dropdown-item">Delete</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
</tr>
|
<div class="card-body p-3">
|
||||||
</tbody>
|
<table class="table table-striped">
|
||||||
</table>
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Season</th>
|
||||||
|
<th>Episode</th>
|
||||||
|
<th>Date Seen</th>
|
||||||
|
<th>Seen With</th>
|
||||||
|
<th>Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr *ngFor="let item of seenHistoryToShow; let i = index">
|
||||||
|
<td>{{ item.season_number == 0 ? 'Special' : 'Season '+ item.season_number }}</td>
|
||||||
|
<td>{{ item.episode_number }}</td>
|
||||||
|
<td>{{ item.date_seen | dateFormat:'MMM dd, yyyy' }}</td>
|
||||||
|
<td>{{ item.seen_with }}</td>
|
||||||
|
<td>
|
||||||
|
<div class="dropdown">
|
||||||
|
<button class="btn btn-sm btn-filter dropdown-toggle dropdown-toggle-nocaret" type="button"
|
||||||
|
data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
|
<i class="bi bi-three-dots"></i>
|
||||||
|
</button>
|
||||||
|
<ul class="dropdown-menu" style="cursor: pointer;">
|
||||||
|
<li (click)="editEpisodeSeen(item)"><a class="dropdown-item">Edit</a></li>
|
||||||
|
<li (click)="deleteEpisodeSeen(item)"><a class="dropdown-item">Delete</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
|
||||||
<div class="pagination-container d-flex justify-content-end" *ngIf="maxPage > 1">
|
</tr>
|
||||||
<ul class="pagination pagination-sm">
|
</tbody>
|
||||||
<li class="page-item" [class.disabled]="currentPage === 1">
|
</table>
|
||||||
<a class="page-link" href="javascript:;" (click)="goToPage(currentPage - 1)">Previous</a>
|
|
||||||
</li>
|
<div class="pagination-container d-flex justify-content-end" *ngIf="maxPage > 1">
|
||||||
<!-- Dynamically generate page numbers -->
|
<ul class="pagination pagination-sm">
|
||||||
<li class="page-item" *ngFor="let page of pageNumbers" [class.active]="currentPage === page">
|
<li class="page-item" [class.disabled]="currentPage === 1">
|
||||||
<a class="page-link" href="javascript:;" (click)="goToPage(page)">{{ page }}</a>
|
<a class="page-link" href="javascript:;" (click)="goToPage(currentPage - 1)">Previous</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="page-item" [class.disabled]="currentPage == maxPage">
|
<!-- Dynamically generate page numbers -->
|
||||||
<a class="page-link" href="javascript:;" (click)="goToPage(currentPage + 1)">Next</a>
|
<li class="page-item" *ngFor="let page of pageNumbers" [class.active]="currentPage === page">
|
||||||
</li>
|
<a class="page-link" href="javascript:;" (click)="goToPage(page)">{{ page }}</a>
|
||||||
</ul>
|
</li>
|
||||||
|
<li class="page-item" [class.disabled]="currentPage == maxPage">
|
||||||
|
<a class="page-link" href="javascript:;" (click)="goToPage(currentPage + 1)">Next</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ import { EpisodeSeenService } from '../../../core/services/episode-seen.service'
|
|||||||
import { SeasonService } from '../../../core/services/season.service';
|
import { SeasonService } from '../../../core/services/season.service';
|
||||||
import { LibraryService } from '../../../core/services/library.service';
|
import { LibraryService } from '../../../core/services/library.service';
|
||||||
import { ToastrService } from 'ngx-toastr';
|
import { ToastrService } from 'ngx-toastr';
|
||||||
|
import { EntrySeen } from '../../../shared/models/entrySeen.model';
|
||||||
|
import { EpisodeSeenModalComponent } from '../../../shared/components/modals/episode-seen-modal/episode-seen-modal.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-entry-page',
|
selector: 'app-entry-page',
|
||||||
@@ -125,51 +127,6 @@ export class EntryPageComponent implements OnInit {
|
|||||||
this.getEpisodesSeenHistory();
|
this.getEpisodesSeenHistory();
|
||||||
}
|
}
|
||||||
|
|
||||||
openEntrySeenModal() {
|
|
||||||
if (!this.entry) return;
|
|
||||||
|
|
||||||
const dialogRef = this.dialog.open(SeenModalComponent, {
|
|
||||||
width: '360px',
|
|
||||||
});
|
|
||||||
|
|
||||||
dialogRef.afterClosed().subscribe((result) => {
|
|
||||||
if (result) {
|
|
||||||
// console.log('Seen dialog closed with:', result);
|
|
||||||
|
|
||||||
if (result.watchDate == '') {
|
|
||||||
// TODO show no was passed date notification
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let watchDate = result.watchDate;
|
|
||||||
let watchedWith = result.watchedWith.split('\n').join(', ');
|
|
||||||
|
|
||||||
this.entrySeenService
|
|
||||||
.createEntrySeen(this.entry.id.toString(), watchDate, watchedWith)
|
|
||||||
.subscribe({
|
|
||||||
next: (entrySeen) => {
|
|
||||||
if (entrySeen) {
|
|
||||||
// TODO show confirm notification
|
|
||||||
// console.log(`EntrySeen Added`, entrySeen);
|
|
||||||
this.entry.entrySeen.push(entrySeen);
|
|
||||||
|
|
||||||
if (this.entry.watchlist) {
|
|
||||||
this.libraryService.refrechEntries().subscribe();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: (error) => {
|
|
||||||
console.error('Error adding entrySeen:', error);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
// TODO show notification
|
|
||||||
} else {
|
|
||||||
// console.log('Seen dialog was cancelled');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
onRatingChange(event: Event) {
|
onRatingChange(event: Event) {
|
||||||
this.entryRatingsService
|
this.entryRatingsService
|
||||||
.updateEntryRatings(this.entry.entryRating)
|
.updateEntryRatings(this.entry.entryRating)
|
||||||
@@ -187,6 +144,88 @@ export class EntryPageComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ! ENTRY SEEN
|
||||||
|
openEntrySeenModal(entrySeen: EntrySeen = {} as EntrySeen) {
|
||||||
|
if (!this.entry) return;
|
||||||
|
|
||||||
|
let oldData = {} as { watchDate: Date; watchedWith: string };
|
||||||
|
if (entrySeen.id) {
|
||||||
|
oldData.watchDate = entrySeen.date_seen;
|
||||||
|
oldData.watchedWith = entrySeen.seen_with;
|
||||||
|
}
|
||||||
|
const dialogRef = this.dialog.open(SeenModalComponent, {
|
||||||
|
width: '360px',
|
||||||
|
data: oldData.watchDate ? oldData : {},
|
||||||
|
});
|
||||||
|
|
||||||
|
dialogRef.afterClosed().subscribe((result) => {
|
||||||
|
if (result) {
|
||||||
|
if (result.watchDate == '') {
|
||||||
|
// TODO show no was passed date notification
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let watchDate = result.watchDate;
|
||||||
|
let watchedWith = result.watchedWith.split('\n').join(', ');
|
||||||
|
|
||||||
|
if (entrySeen.id) {
|
||||||
|
const es = {
|
||||||
|
id: entrySeen.id,
|
||||||
|
date_seen: watchDate,
|
||||||
|
seen_with: watchedWith,
|
||||||
|
} as EntrySeen;
|
||||||
|
|
||||||
|
// * Update
|
||||||
|
this.entrySeenService.updateEntrySeen(es).subscribe({
|
||||||
|
next: (updatedEntrySeen) => {
|
||||||
|
if (updatedEntrySeen) {
|
||||||
|
// TODO show confirm notification
|
||||||
|
// ? replace the entry-seen object with the updated one
|
||||||
|
for (let i = 0; i < this.entry.entrySeen.length; i++) {
|
||||||
|
if (this.entry.entrySeen[i].id == updatedEntrySeen.id)
|
||||||
|
this.entry.entrySeen[i] = updatedEntrySeen;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: (error) => {
|
||||||
|
console.error('Error adding entrySeen:', error);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// * Create
|
||||||
|
this.entrySeenService
|
||||||
|
.createEntrySeen(this.entry.id.toString(), watchDate, watchedWith)
|
||||||
|
.subscribe({
|
||||||
|
next: (entrySeen) => {
|
||||||
|
if (entrySeen) {
|
||||||
|
// TODO show confirm notification
|
||||||
|
this.entry.entrySeen.push(entrySeen);
|
||||||
|
|
||||||
|
// ? if the entry was in watch list creating and entry-seen would have removed it
|
||||||
|
// ? from the watchlist, so now we need to refrech libraryService in order to
|
||||||
|
// ? update the watchlist page
|
||||||
|
if (this.entry.watchlist) {
|
||||||
|
this.libraryService.refrechEntries().subscribe();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: (error) => {
|
||||||
|
console.error('Error adding entrySeen:', error);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO show notification
|
||||||
|
} else {
|
||||||
|
// console.log('Seen dialog was cancelled');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
editEntrySeen(entrySeen: EntrySeen) {
|
||||||
|
this.openEntrySeenModal(entrySeen);
|
||||||
|
}
|
||||||
|
|
||||||
removeEntrySeen(id: number) {
|
removeEntrySeen(id: number) {
|
||||||
const dialogRef = this.dialog.open(ConfirmModalComponent, {
|
const dialogRef = this.dialog.open(ConfirmModalComponent, {
|
||||||
width: '400px',
|
width: '400px',
|
||||||
@@ -359,6 +398,45 @@ export class EntryPageComponent implements OnInit {
|
|||||||
this.seenHistoryToShow = temp.slice(startIndex, endIndex);
|
this.seenHistoryToShow = temp.slice(startIndex, endIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addEpisodeSeen() {
|
||||||
|
if (!this.entry) return;
|
||||||
|
|
||||||
|
const dialogRef = this.dialog.open(EpisodeSeenModalComponent, {
|
||||||
|
width: '360px',
|
||||||
|
data: {
|
||||||
|
entryId: this.entry.id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
dialogRef.afterClosed().subscribe((result) => {
|
||||||
|
// ? if an episode-seen was created then refresh the watch history table
|
||||||
|
if (result && result.created) {
|
||||||
|
// ? call this function to fetch the new episode-seen history
|
||||||
|
this.getEpisodesSeenHistory();
|
||||||
|
|
||||||
|
// ? Updating the episodes seen progress bar in the season card
|
||||||
|
// ? by fetching a new updated episodes list
|
||||||
|
this.entry.seasons.forEach(async (season) => {
|
||||||
|
if (season.season_number == result.season_number) {
|
||||||
|
this.seasonService.getSeasonEpisodes(season.id).subscribe({
|
||||||
|
next: (episodes) => {
|
||||||
|
// console.log(
|
||||||
|
// `Loaded Season ${season.season_number} Episodes (${episodes.length})`
|
||||||
|
// );
|
||||||
|
season.episodes = episodes;
|
||||||
|
},
|
||||||
|
error: (error) => {
|
||||||
|
console.log(`Couldn't fetch season episodes data:`, error);
|
||||||
|
// TODO show notification
|
||||||
|
season.episodes = [];
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
editEpisodeSeen(episodeSeen: EpisodeSeenDto) {
|
editEpisodeSeen(episodeSeen: EpisodeSeenDto) {
|
||||||
if (episodeSeen == null) return;
|
if (episodeSeen == null) return;
|
||||||
|
|
||||||
@@ -418,11 +496,11 @@ export class EntryPageComponent implements OnInit {
|
|||||||
this.episodeSeenService.removeEpisodeSeen(episodeSeen.id).subscribe({
|
this.episodeSeenService.removeEpisodeSeen(episodeSeen.id).subscribe({
|
||||||
next: () => {
|
next: () => {
|
||||||
// console.log(`Episode seen deleted.`);
|
// console.log(`Episode seen deleted.`);
|
||||||
// call this function to fetch the new episode-seen history
|
// ? call this function to fetch the new episode-seen history
|
||||||
this.getEpisodesSeenHistory();
|
this.getEpisodesSeenHistory();
|
||||||
|
|
||||||
// trying to update the episodes seen progress bar in the season card
|
// ? Updating the episodes seen progress bar in the season card
|
||||||
// by fetching a new updated episodes list
|
// ? by fetching a new updated episodes list
|
||||||
this.entry.seasons.forEach(async (season) => {
|
this.entry.seasons.forEach(async (season) => {
|
||||||
if (season.season_number == episodeSeen.season_number) {
|
if (season.season_number == episodeSeen.season_number) {
|
||||||
this.seasonService.getSeasonEpisodes(season.id).subscribe({
|
this.seasonService.getSeasonEpisodes(season.id).subscribe({
|
||||||
|
|||||||
@@ -297,7 +297,7 @@
|
|||||||
<div class="">
|
<div class="">
|
||||||
<p class="mb-1 fs-6 fw-bold">Movies</p>
|
<p class="mb-1 fs-6 fw-bold">Movies</p>
|
||||||
<h2 class="mb-0">{{this.watchCount.moviesTotal}}</h2>
|
<h2 class="mb-0">{{this.watchCount.moviesTotal}}</h2>
|
||||||
<p class="mb-0"><span class="text-success me-2 fw-medium">16.5%</span><span>55.21 USD</span></p>
|
<!-- <p class="mb-0"><span class="text-success me-2 fw-medium">16.5%</span><span>55.21 USD</span></p> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="vr"></div>
|
<div class="vr"></div>
|
||||||
@@ -319,7 +319,7 @@
|
|||||||
<div class="">
|
<div class="">
|
||||||
<p class="mb-1 fs-6 fw-bold">Tv-Series</p>
|
<p class="mb-1 fs-6 fw-bold">Tv-Series</p>
|
||||||
<h2 class="mb-0">{{this.watchCount.seriesTotal}}</h2>
|
<h2 class="mb-0">{{this.watchCount.seriesTotal}}</h2>
|
||||||
<p class="mb-0"><span class="text-success me-2 fw-medium">24.9%</span><span>267.35 USD</span></p>
|
<!-- <p class="mb-0"><span class="text-success me-2 fw-medium">24.9%</span><span>267.35 USD</span></p> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import ApexCharts from 'apexcharts';
|
|||||||
import { EntrySeenService } from '../../core/services/entry-seen.service';
|
import { EntrySeenService } from '../../core/services/entry-seen.service';
|
||||||
import { LibraryService } from '../../core/services/library.service';
|
import { LibraryService } from '../../core/services/library.service';
|
||||||
import { EpisodeSeenService } from '../../core/services/episode-seen.service';
|
import { EpisodeSeenService } from '../../core/services/episode-seen.service';
|
||||||
import { Observable, forkJoin } from 'rxjs';
|
import { forkJoin } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-home-page',
|
selector: 'app-home-page',
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
<!-- Match All Criteria -->
|
<!-- Match All Criteria -->
|
||||||
<div class="form-check form-switch">
|
<div class="form-check form-switch">
|
||||||
<input class="form-check-input" type="checkbox" role="switch" id="matchAllSwitch"
|
<input class="form-check-input" type="checkbox" role="switch" id="matchAllSwitch"
|
||||||
[(ngModel)]="filterCriteria.matchAll" (ngModelChange)="onFilterChange()">
|
[(ngModel)]="filterCriteria.matchAll" (click)="onFilterChange()" >
|
||||||
<label class="form-check-label" for="matchAllSwitch">Match All Criteria</label>
|
<label class="form-check-label" for="matchAllSwitch">Match All Criteria</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -102,7 +102,7 @@
|
|||||||
<div class="dataTables_info" role="status" aria-live="polite">
|
<div class="dataTables_info" role="status" aria-live="polite">
|
||||||
Total entries {{entriesCount}}
|
Total entries {{entriesCount}}
|
||||||
</div>
|
</div>
|
||||||
<div class="pagination-container d-flex justify-content-end" *ngIf="maxPage != 1 && entries.length != 0">
|
<div class="pagination-container d-flex justify-content-end" *ngIf="maxPage > 1 && entries.length != 0">
|
||||||
<ul class="pagination pagination-sm">
|
<ul class="pagination pagination-sm">
|
||||||
<li class="page-item" [class.disabled]="currentPage === 1">
|
<li class="page-item" [class.disabled]="currentPage === 1">
|
||||||
<a class="page-link" href="javascript:;" (click)="goToPage(currentPage - 1)">Previous</a>
|
<a class="page-link" href="javascript:;" (click)="goToPage(currentPage - 1)">Previous</a>
|
||||||
@@ -125,7 +125,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<!-- Pagination -->
|
<!-- Pagination -->
|
||||||
<div class="pagination-container d-flex justify-content-end" *ngIf="maxPage != 1 && entries.length != 0">
|
<div class="pagination-container d-flex justify-content-end" *ngIf="maxPage > 1 && entries.length != 0">
|
||||||
<ul class="pagination pagination-sm">
|
<ul class="pagination pagination-sm">
|
||||||
<li class="page-item" [class.disabled]="currentPage === 1">
|
<li class="page-item" [class.disabled]="currentPage === 1">
|
||||||
<a class="page-link" href="javascript:;" (click)="goToPage(currentPage - 1)">Previous</a>
|
<a class="page-link" href="javascript:;" (click)="goToPage(currentPage - 1)">Previous</a>
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ export class LibraryComponent implements OnInit, AfterViewInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ! FILTER
|
||||||
getQueryParameters() {
|
getQueryParameters() {
|
||||||
this.route.queryParams.subscribe((params) => {
|
this.route.queryParams.subscribe((params) => {
|
||||||
this.currentPage = params['page'] ? parseInt(params['page'], 10) : 1;
|
this.currentPage = params['page'] ? parseInt(params['page'], 10) : 1;
|
||||||
@@ -133,46 +134,38 @@ export class LibraryComponent implements OnInit, AfterViewInit {
|
|||||||
setQueryParameters() {
|
setQueryParameters() {
|
||||||
let params = { page: this.currentPage } as LibraryQueryParams;
|
let params = { page: this.currentPage } as LibraryQueryParams;
|
||||||
|
|
||||||
|
// ? title
|
||||||
if (this.filterCriteria.title?.trim() != '') {
|
if (this.filterCriteria.title?.trim() != '') {
|
||||||
params.title = this.filterCriteria.title?.trim();
|
params.title = this.filterCriteria.title?.trim();
|
||||||
} else {
|
|
||||||
delete params.title;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ? years
|
||||||
if (this.filterCriteria.years?.length) {
|
if (this.filterCriteria.years?.length) {
|
||||||
params.years = this.filterCriteria.years.join(',');
|
params.years = this.filterCriteria.years.join(',');
|
||||||
} else {
|
|
||||||
delete params.years;
|
|
||||||
}
|
}
|
||||||
|
// ? genres
|
||||||
if (this.filterCriteria.genres?.length) {
|
if (this.filterCriteria.genres?.length) {
|
||||||
params.genres = this.filterCriteria.genres.join(',');
|
params.genres = this.filterCriteria.genres.join(',');
|
||||||
} else {
|
|
||||||
delete params.genres;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ? type
|
||||||
if (this.filterCriteria.type != 0) {
|
if (this.filterCriteria.type != 0) {
|
||||||
params.type = this.filterCriteria.type;
|
params.type = this.filterCriteria.type;
|
||||||
} else {
|
|
||||||
delete params.type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ? favorit
|
||||||
if (this.filterCriteria.favorit != false) {
|
if (this.filterCriteria.favorit != false) {
|
||||||
params.favorit = this.filterCriteria.favorit;
|
params.favorit = this.filterCriteria.favorit;
|
||||||
} else {
|
|
||||||
delete params.favorit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ? hidden
|
||||||
if (this.filterCriteria.hidden != false) {
|
if (this.filterCriteria.hidden != false) {
|
||||||
params.hidden = this.filterCriteria.hidden;
|
params.hidden = this.filterCriteria.hidden;
|
||||||
} else {
|
|
||||||
delete params.hidden;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ? matchAll
|
||||||
if (this.filterCriteria.matchAll != true) {
|
if (this.filterCriteria.matchAll != true) {
|
||||||
params.matchAll = this.filterCriteria.matchAll;
|
params.matchAll = this.filterCriteria.matchAll;
|
||||||
} else {
|
|
||||||
delete params.matchAll;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.router.navigate([], {
|
this.router.navigate([], {
|
||||||
@@ -182,7 +175,6 @@ export class LibraryComponent implements OnInit, AfterViewInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// ! FILTER
|
|
||||||
ngAfterViewInit() {
|
ngAfterViewInit() {
|
||||||
$('#year-select')
|
$('#year-select')
|
||||||
.select2({
|
.select2({
|
||||||
@@ -244,14 +236,14 @@ export class LibraryComponent implements OnInit, AfterViewInit {
|
|||||||
const formattedTitle =
|
const formattedTitle =
|
||||||
this.filterCriteria.title?.toLowerCase().trim() || '';
|
this.filterCriteria.title?.toLowerCase().trim() || '';
|
||||||
temp = await this.entries.filter((entry) => {
|
temp = await this.entries.filter((entry) => {
|
||||||
// Type check
|
// * Type check
|
||||||
let filterType = this.filterCriteria.type - 1 == 0 ? false : true;
|
let filterType = this.filterCriteria.type - 1 == 0 ? false : true;
|
||||||
if (this.filterCriteria.type != 0 && filterType != entry.is_tvseries) {
|
if (this.filterCriteria.type != 0 && filterType != entry.is_tvseries) {
|
||||||
return false; // Skip entry if the type does not match, unless type is 'all' (0)
|
return false; // Skip entry if the type does not match, unless type is 'all' (0)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hidden check
|
// * Hidden check
|
||||||
// skip hidden if show hidden is not check
|
// ? skip hidden if show hidden is not checked
|
||||||
if (!this.filterCriteria.hidden && entry.hidden) {
|
if (!this.filterCriteria.hidden && entry.hidden) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
File renamed without changes.
@@ -0,0 +1 @@
|
|||||||
|
<p>settings-api-keys works!</p>
|
||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { SettingsApiKeysComponent } from './settings-api-keys.component';
|
||||||
|
|
||||||
|
describe('SettingsApiKeysComponent', () => {
|
||||||
|
let component: SettingsApiKeysComponent;
|
||||||
|
let fixture: ComponentFixture<SettingsApiKeysComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
imports: [SettingsApiKeysComponent]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(SettingsApiKeysComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-settings-api-keys',
|
||||||
|
templateUrl: './settings-api-keys.component.html',
|
||||||
|
styleUrl: './settings-api-keys.component.css'
|
||||||
|
})
|
||||||
|
export class SettingsApiKeysComponent {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
.form-group {
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.is-invalid {
|
||||||
|
border-color: #dc3545;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invalid-feedback {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
<form [formGroup]="settingsForm" (ngSubmit)="onSubmit()">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="userDataPath">User Data Path</label>
|
||||||
|
<input id="userDataPath" formControlName="userDataPath" type="text" class="form-control"
|
||||||
|
[ngClass]="{'is-invalid': f['userDataPath'].touched && f['userDataPath'].invalid}">
|
||||||
|
<div *ngIf="f['userDataPath'].touched && f['userDataPath'].invalid" class="invalid-feedback">
|
||||||
|
User Data Path is required.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="tmdbApiUrl">TMDB API URL</label>
|
||||||
|
<input id="tmdbApiUrl" formControlName="tmdbApiUrl" type="text" class="form-control"
|
||||||
|
[ngClass]="{'is-invalid': f['tmdbApiUrl'].touched && f['tmdbApiUrl'].invalid}">
|
||||||
|
<div *ngIf="f['tmdbApiUrl'].touched && f['tmdbApiUrl'].invalid" class="invalid-feedback">
|
||||||
|
TMDB API URL is required.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="tmdbApiKey">TMDB API Key</label>
|
||||||
|
<input id="tmdbApiKey" formControlName="tmdbApiKey" type="text" class="form-control"
|
||||||
|
[ngClass]="{'is-invalid': f['tmdbApiKey'].touched && f['tmdbApiKey'].invalid}">
|
||||||
|
<div *ngIf="f['tmdbApiKey'].touched && f['tmdbApiKey'].invalid" class="invalid-feedback">
|
||||||
|
TMDB API Key is required.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="frontPort">Front Port</label>
|
||||||
|
<input id="frontPort" formControlName="frontPort" type="text" class="form-control"
|
||||||
|
[ngClass]="{'is-invalid': f['frontPort'].touched && f['frontPort'].invalid}">
|
||||||
|
<div *ngIf="f['frontPort'].touched && f['frontPort'].invalid" class="invalid-feedback">
|
||||||
|
Front Port is required and must be a number.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="backPort">Back Port</label>
|
||||||
|
<input id="backPort" formControlName="backPort" type="text" class="form-control"
|
||||||
|
[ngClass]="{'is-invalid': f['backPort'].touched && f['backPort'].invalid}">
|
||||||
|
<div *ngIf="f['backPort'].touched && f['backPort'].invalid" class="invalid-feedback">
|
||||||
|
Back Port is required and must be a number.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="portableMode">Portable Mode</label>
|
||||||
|
<input id="portableMode" formControlName="portableMode" type="text" class="form-control"
|
||||||
|
[ngClass]="{'is-invalid': f['portableMode'].touched && f['portableMode'].invalid}">
|
||||||
|
<div *ngIf="f['portableMode'].touched && f['portableMode'].invalid" class="invalid-feedback">
|
||||||
|
Portable Mode is required.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="submit" class="btn btn-primary" [disabled]="settingsForm.invalid">Submit</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.getElementById('userDataPath').addEventListener('click', () => {
|
||||||
|
window.postMessage({
|
||||||
|
type: 'select-dirs'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
||||||
+6
-6
@@ -1,18 +1,18 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
import { SettingsComponent } from './settings.component';
|
import { SettingsGeneralComponent } from './settings-general.component';
|
||||||
|
|
||||||
describe('SettingsComponent', () => {
|
describe('SettingsGeneralComponent', () => {
|
||||||
let component: SettingsComponent;
|
let component: SettingsGeneralComponent;
|
||||||
let fixture: ComponentFixture<SettingsComponent>;
|
let fixture: ComponentFixture<SettingsGeneralComponent>;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
imports: [SettingsComponent]
|
imports: [SettingsGeneralComponent]
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
|
|
||||||
fixture = TestBed.createComponent(SettingsComponent);
|
fixture = TestBed.createComponent(SettingsGeneralComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { Settings } from '../../../shared/models/settings.model';
|
||||||
|
import { SettingsService } from '../../../core/services/settings.service';
|
||||||
|
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-settings-general',
|
||||||
|
templateUrl: './settings-general.component.html',
|
||||||
|
styleUrl: './settings-general.component.css',
|
||||||
|
})
|
||||||
|
export class SettingsGeneralComponent implements OnInit {
|
||||||
|
settings: Settings = {} as Settings;
|
||||||
|
settingsForm!: FormGroup;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private settingsService: SettingsService,
|
||||||
|
private fb: FormBuilder
|
||||||
|
) {}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.settingsForm = this.fb.group({
|
||||||
|
userDataPath: [this.settings.userDataPath],
|
||||||
|
tmdbApiUrl: [this.settings.tmdbApiUrl],
|
||||||
|
tmdbApiKey: [this.settings.tmdbApiKey, Validators.required],
|
||||||
|
frontPort: [this.settings.frontPort, Validators.pattern('^[0-9]{4,5}$')],
|
||||||
|
backPort: [
|
||||||
|
this.settings.backPort,
|
||||||
|
[Validators.required, Validators.pattern('^[0-9]{4,5}$')],
|
||||||
|
],
|
||||||
|
portableMode: [this.settings.portableMode],
|
||||||
|
});
|
||||||
|
|
||||||
|
this.settingsService.getSettings().subscribe({
|
||||||
|
next: (s) => {
|
||||||
|
this.settings = s;
|
||||||
|
|
||||||
|
// Update the form with fetched settings
|
||||||
|
this.settingsForm.patchValue({
|
||||||
|
userDataPath: this.settings.userDataPath,
|
||||||
|
tmdbApiUrl: this.settings.tmdbApiUrl,
|
||||||
|
tmdbApiKey: this.settings.tmdbApiKey,
|
||||||
|
frontPort: this.settings.frontPort,
|
||||||
|
backPort: this.settings.backPort,
|
||||||
|
portableMode: this.settings.portableMode,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error: (error) => {
|
||||||
|
console.log(`Error getting settings...`);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
get f() {
|
||||||
|
return this.settingsForm.controls;
|
||||||
|
}
|
||||||
|
|
||||||
|
onSubmit(): void {
|
||||||
|
if (this.settingsForm.valid) {
|
||||||
|
const settings: Settings = this.settingsForm.value;
|
||||||
|
this.settingsService.updateSettings(settings).subscribe({
|
||||||
|
next: (s) => {
|
||||||
|
// TODO: SHOW SUCCESS TOAST
|
||||||
|
console.log(`Settings updated: `);
|
||||||
|
},
|
||||||
|
error: (error) => {
|
||||||
|
// TODO: SHOW ERROR TOAST
|
||||||
|
console.log(`Error updating settings: `, error);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Whitespace-only changes.
@@ -0,0 +1,51 @@
|
|||||||
|
<div class="card mb-0" style="height: 82vh;">
|
||||||
|
<div class="card-body">
|
||||||
|
<div id="settingsStepper" class="bs-stepper gap-4 vertical">
|
||||||
|
<!-- ! STEPPER HEADERS -->
|
||||||
|
<div class="bs-stepper-header" role="tablist" style="height: 78vh;">
|
||||||
|
<!-- ? step 1 -->
|
||||||
|
<div class="step" data-target="#test-vl-1" (click)="setStep(1)" [ngClass]="{ 'active': step == 1 }">
|
||||||
|
<div class="step-trigger" role="tab" aria-controls="test-vl-3" aria-selected="true">
|
||||||
|
<div class="bs-stepper-circle"><i class="material-icons-outlined">settings</i></div>
|
||||||
|
<div class="">
|
||||||
|
<h5 class="mb-0 steper-title">Application Settings</h5>
|
||||||
|
<p class="mb-0 steper-sub-title">General application settings</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ? step 1 -->
|
||||||
|
<div class="step" data-target="#test-vl-1" (click)="setStep(2)" [ngClass]="{ 'active': step == 2 }">
|
||||||
|
<div class="step-trigger" role="tab" aria-controls="test-vl-3" aria-selected="true">
|
||||||
|
<div class="bs-stepper-circle"><i class="material-icons-outlined">key</i></div>
|
||||||
|
<div class="">
|
||||||
|
<h5 class="mb-0 steper-title">API keys</h5>
|
||||||
|
<p class="mb-0 steper-sub-title">Setup your API keys</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ! STEPPER CONTENT -->
|
||||||
|
<div class="bs-stepper-content w-100">
|
||||||
|
<!-- ? step 1 -->
|
||||||
|
<div id="test-vl-3" class="bs-stepper-pane content fade dstepper-block" [ngClass]="{ 'active': step == 1 }"
|
||||||
|
*ngIf="step == 1">
|
||||||
|
<h5 class="mb-1">Application Settings</h5>
|
||||||
|
<p class="mb-4">General application settings</p>
|
||||||
|
<app-settings-general></app-settings-general>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ? step 2 -->
|
||||||
|
<div id="test-vl-3" class="bs-stepper-pane content fade dstepper-block" [ngClass]="{ 'active': step == 2 }"
|
||||||
|
*ngIf="step == 2">
|
||||||
|
<h5 class="mb-1">API keys</h5>
|
||||||
|
<p class="mb-4">Setup your API keys</p>
|
||||||
|
<app-settings-api-keys></app-settings-api-keys>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
import { AfterViewInit, ChangeDetectorRef, Component } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-settings-page',
|
||||||
|
templateUrl: './settings-page.component.html',
|
||||||
|
styleUrl: './settings-page.component.css',
|
||||||
|
})
|
||||||
|
export class SettingsPageComponent implements AfterViewInit {
|
||||||
|
// stepper!: Stepper;
|
||||||
|
step: number = 1;
|
||||||
|
|
||||||
|
constructor(private cdRef: ChangeDetectorRef) {}
|
||||||
|
|
||||||
|
ngAfterViewInit() {
|
||||||
|
// const stepperElement = document.querySelector('#settingsStepper');
|
||||||
|
// if (stepperElement) {
|
||||||
|
// this.stepper = new Stepper(stepperElement, {
|
||||||
|
// linear: false,
|
||||||
|
// animation: true,
|
||||||
|
// });
|
||||||
|
// this.cdRef.detectChanges();
|
||||||
|
// } else {
|
||||||
|
// console.error('Stepper element not found!');
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
setStep(step: number) {
|
||||||
|
this.step = step;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { Routes, RouterModule } from '@angular/router';
|
||||||
|
import { SettingsPageComponent } from './settings-page/settings-page.component';
|
||||||
|
|
||||||
|
// ! /user-collections
|
||||||
|
const routes: Routes = [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
component: SettingsPageComponent,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [RouterModule.forChild(routes)],
|
||||||
|
exports: [RouterModule],
|
||||||
|
})
|
||||||
|
export class SettingsRoutingModule {}
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
<!--breadcrumb-->
|
|
||||||
<div class="page-breadcrumb d-none d-sm-flex align-items-center mb-3">
|
|
||||||
<div class="breadcrumb-title pe-3">Settings</div>
|
|
||||||
</div>
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
import { Component } from '@angular/core';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-settings',
|
|
||||||
templateUrl: './settings.component.html',
|
|
||||||
styleUrl: './settings.component.css',
|
|
||||||
})
|
|
||||||
export class SettingsComponent {
|
|
||||||
constructor() {}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { SharedModule } from '../../shared/shared.module';
|
||||||
|
|
||||||
|
import { DragDropModule } from '@angular/cdk/drag-drop';
|
||||||
|
|
||||||
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||||
|
import { SettingsRoutingModule } from './settings-routing.module';
|
||||||
|
import { SettingsPageComponent } from './settings-page/settings-page.component';
|
||||||
|
import { SettingsGeneralComponent } from './settings-general/settings-general.component';
|
||||||
|
import { SettingsApiKeysComponent } from './settings-api-keys/settings-api-keys.component';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
SharedModule,
|
||||||
|
|
||||||
|
FormsModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
|
||||||
|
SettingsRoutingModule,
|
||||||
|
|
||||||
|
DragDropModule,
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
SettingsPageComponent,
|
||||||
|
|
||||||
|
SettingsGeneralComponent,
|
||||||
|
SettingsApiKeysComponent,
|
||||||
|
],
|
||||||
|
exports: [],
|
||||||
|
})
|
||||||
|
export class SettingsModule {}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<div class="movie-card" [@fadeInOut]="animationDirection">
|
<div class="movie-card" [@fadeInOut]="animationDirection">
|
||||||
<div class="card-head">
|
<div class="card-head">
|
||||||
<img class="card-img" [src]="posterPath" alt="Movie Poster">
|
<img class="card-img" [src]="posterPath" alt="Movie Poster" onerror="this.src='assets/images/default/default-poster.png'">
|
||||||
|
|
||||||
<div class="loading-overlay" *ngIf="lockActions" @animateDestroy>
|
<div class="loading-overlay" *ngIf="lockActions" @animateDestroy>
|
||||||
<div class="d-flex justify-content-center align-items-center" style="height: 100%;">
|
<div class="d-flex justify-content-center align-items-center" style="height: 100%;">
|
||||||
@@ -37,8 +37,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- card body : title, -->
|
<!-- card body : title, -->
|
||||||
<div class="card-body">
|
<div class="card-body" (click)="cardClick()">
|
||||||
<a (click)="cardClick()" rel="noopener noreferrer">
|
<a rel="noopener noreferrer">
|
||||||
<h3 class="card-title">{{ entry.title }}</h3>
|
<h3 class="card-title">{{ entry.title }}</h3>
|
||||||
</a>
|
</a>
|
||||||
<div class="card-info">
|
<div class="card-info">
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { ChangeDetectorRef, Component, Inject, OnInit } from '@angular/core';
|
import { Component, Inject, OnInit } from '@angular/core';
|
||||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||||
import { FormBuilder } from '@angular/forms';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-confirm-modal',
|
selector: 'app-confirm-modal',
|
||||||
|
|||||||
Whitespace-only changes.
+43
@@ -0,0 +1,43 @@
|
|||||||
|
<div class="card border-top border-3 border-primary rounded-0" style="margin-bottom: 0 !important;">
|
||||||
|
<div class="modal-header card-header py-3 px-4">
|
||||||
|
<h5 class="mb-0 text-primary">Watch Details</h5>
|
||||||
|
<button type="button" class="btn-close" (click)="onClose()" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="card-body p-4">
|
||||||
|
<form class="row g-3">
|
||||||
|
<div class="col-md-6 mb-3">
|
||||||
|
<label class="form-label">Seasons</label>
|
||||||
|
<select name="seasons" class="form-select" [(ngModel)]="selectedSeason" (change)="onSeasonChange($event)" aria-placeholder="Select a season">
|
||||||
|
<option value="" disabled selected>Select a season</option>
|
||||||
|
<option [ngValue]="season" *ngFor="let season of seasons">Season {{ season.season_number }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-6 mb-3">
|
||||||
|
<label class="form-label">Episodes</label>
|
||||||
|
<select name="episodes" class="form-select" [(ngModel)]="selectedEpisode">
|
||||||
|
<option value="" disabled selected>Select an episode</option>
|
||||||
|
<option [ngValue]="episode" *ngFor="let episode of selectedSeason?.episodes">Episode {{ episode.episode_number }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-12">
|
||||||
|
<label class="form-label">Seen With</label>
|
||||||
|
<textarea class="form-control rounded-0" [(ngModel)]="watchedWith" [ngModelOptions]="{ standalone: true }"
|
||||||
|
placeholder="Enter names" rows="3"></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-12">
|
||||||
|
<label class="form-label">Date Watched</label>
|
||||||
|
<input type="text" class="form-control rounded-0" name="watch-date" [(ngModel)]="watchDate" id="myDatepicker">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="d-md-flex d-grid align-items-center gap-3">
|
||||||
|
<button type="button" class="btn btn-primary px-4 rounded-0" (click)="onConfirm()">OK</button>
|
||||||
|
<button type="button" class="btn btn-secondary px-4 rounded-0" (click)="onClose()">Cancel</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { EpisodeSeenModalComponent } from './episode-seen-modal.component';
|
||||||
|
|
||||||
|
describe('EpisodeSeenModalComponent', () => {
|
||||||
|
let component: EpisodeSeenModalComponent;
|
||||||
|
let fixture: ComponentFixture<EpisodeSeenModalComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
imports: [EpisodeSeenModalComponent]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(EpisodeSeenModalComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
+133
@@ -0,0 +1,133 @@
|
|||||||
|
import { Component, Inject } from '@angular/core';
|
||||||
|
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||||
|
|
||||||
|
import {
|
||||||
|
trigger,
|
||||||
|
state,
|
||||||
|
style,
|
||||||
|
transition,
|
||||||
|
animate,
|
||||||
|
} from '@angular/animations';
|
||||||
|
import { formatDate } from '@angular/common';
|
||||||
|
import flatpickr from 'flatpickr';
|
||||||
|
import { Season } from '../../../models/season.model';
|
||||||
|
import { SeasonService } from '../../../../core/services/season.service';
|
||||||
|
import { Episode } from '../../../models/episode.models';
|
||||||
|
import { EpisodeSeenService } from '../../../../core/services/episode-seen.service';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-episode-seen-modal',
|
||||||
|
templateUrl: './episode-seen-modal.component.html',
|
||||||
|
styleUrl: './episode-seen-modal.component.css',
|
||||||
|
animations: [
|
||||||
|
trigger('fadeInOut', [
|
||||||
|
state('in', style({ opacity: 1 })),
|
||||||
|
transition(':enter', [style({ opacity: 0 }), animate(600)]),
|
||||||
|
transition(':leave', [animate(600, style({ opacity: 0 }))]),
|
||||||
|
]),
|
||||||
|
trigger('scaleInOut', [
|
||||||
|
transition(':enter', [
|
||||||
|
state('in', style({ opacity: 1 })),
|
||||||
|
style({ transform: 'scale(0)' }),
|
||||||
|
animate('200ms ease-in-out', style({ transform: 'scale(1)' })),
|
||||||
|
]),
|
||||||
|
transition(':leave', [
|
||||||
|
animate('200ms ease-in-out', style({ transform: 'scale(0)' })),
|
||||||
|
]),
|
||||||
|
]),
|
||||||
|
],
|
||||||
|
})
|
||||||
|
export class EpisodeSeenModalComponent {
|
||||||
|
public entryId: number = 0;
|
||||||
|
public watchDate: string = '';
|
||||||
|
public watchedWith: string = '';
|
||||||
|
public seasons: Season[] = [];
|
||||||
|
|
||||||
|
public selectedSeason: Season | null = {} as Season;
|
||||||
|
public selectedEpisode: Episode | null = {} as Episode;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
public dialogRef: MatDialogRef<EpisodeSeenModalComponent>,
|
||||||
|
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||||
|
private seasonsService: SeasonService,
|
||||||
|
private episodeSeenService: EpisodeSeenService
|
||||||
|
) {}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
if (!this.data.entryId) return;
|
||||||
|
this.entryId = this.data.entryId;
|
||||||
|
|
||||||
|
this.seasonsService
|
||||||
|
.getSeasonsWithEpisodesByEntryId(this.data.entryId)
|
||||||
|
.subscribe({
|
||||||
|
next: (seasons) => {
|
||||||
|
this.seasons = seasons;
|
||||||
|
},
|
||||||
|
error: (error) => {
|
||||||
|
console.log(`Error gettings seasons: `, error);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
flatpickr('#myDatepicker', {
|
||||||
|
inline: true,
|
||||||
|
defaultDate: this.watchDate,
|
||||||
|
altInput: true,
|
||||||
|
allowInput: false,
|
||||||
|
altFormat: 'F j, Y',
|
||||||
|
dateFormat: 'Y-m-d',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onSeasonChange(event: any): void {
|
||||||
|
this.selectedEpisode = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
onConfirm(): void {
|
||||||
|
if (!this.selectedSeason) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.selectedEpisode) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.watchDate) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const date_seen = new Date(this.watchDate);
|
||||||
|
const seen_with = this.watchedWith.split('\n').join(', ');
|
||||||
|
|
||||||
|
this.episodeSeenService
|
||||||
|
.createEpisodeSeen(
|
||||||
|
this.entryId,
|
||||||
|
this.selectedEpisode?.id,
|
||||||
|
date_seen,
|
||||||
|
seen_with
|
||||||
|
)
|
||||||
|
.subscribe({
|
||||||
|
next: (episodeSeen) => {
|
||||||
|
if (episodeSeen) {
|
||||||
|
return this.dialogRef.close({
|
||||||
|
created: true,
|
||||||
|
// ? returning the season number so it can be used to refrech the-
|
||||||
|
// ? season card progress bar in the entry page
|
||||||
|
season_number: this.selectedSeason?.season_number,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: (error) => {
|
||||||
|
console.log(`Episode seen create error: `, error);
|
||||||
|
// TODO show notification
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
this.dialogRef.close({
|
||||||
|
created: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onClose(): void {
|
||||||
|
this.dialogRef.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
<div class="modal-header card-header py-3 px-4" >
|
<div class="modal-header card-header py-3 px-4" >
|
||||||
<h5 class="mb-0 text-primary">Watch Details</h5>
|
<h5 class="mb-0 text-primary">Watch Details</h5>
|
||||||
<button type="button" class="btn-close" (click)="onClose()" aria-label="Close"></button>
|
<button type="button" class="btn-close" (click)="onClose()" aria-label="Close"></button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body p-4">
|
<div class="card-body p-4">
|
||||||
<form class="row g-3">
|
<form class="row g-3">
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export class SeenModalComponent implements OnInit {
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
if (this.data == null) {
|
if (!this.data || !this.data.watchDate) {
|
||||||
// ? no initial data was passed: populate date field with current date
|
// ? no initial data was passed: populate date field with current date
|
||||||
this.watchDate = formatDate(new Date(), 'yyyy-MM-dd', 'en-US');
|
this.watchDate = formatDate(new Date(), 'yyyy-MM-dd', 'en-US');
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
export interface Settings {
|
||||||
|
userDataPath: string;
|
||||||
|
tmdbApiUrl: string;
|
||||||
|
tmdbApiKey: string;
|
||||||
|
frontPort: number;
|
||||||
|
backPort: number;
|
||||||
|
portableMode: string;
|
||||||
|
}
|
||||||
@@ -5,14 +5,6 @@ import { format } from 'date-fns';
|
|||||||
name: 'dateFormat',
|
name: 'dateFormat',
|
||||||
})
|
})
|
||||||
export class DateFormatPipe implements PipeTransform {
|
export class DateFormatPipe implements PipeTransform {
|
||||||
// transform(value: string): string {
|
|
||||||
// if (!value) return '';
|
|
||||||
|
|
||||||
// const date = new Date(value);
|
|
||||||
// const formatter = new Intl.DateTimeFormat('en-US', { month: 'long', day: '2-digit', year: 'numeric' });
|
|
||||||
// return formatter.format(date);
|
|
||||||
// }
|
|
||||||
|
|
||||||
transform(
|
transform(
|
||||||
value: Date | string | number,
|
value: Date | string | number,
|
||||||
formatString: string = 'yyyy-MM-dd'
|
formatString: string = 'yyyy-MM-dd'
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
|
|
||||||
|
|
||||||
// * modals
|
// * modals
|
||||||
import { SeenModalComponent } from './components/modals/seen-modal/seen-modal.component';
|
import { SeenModalComponent } from './components/modals/seen-modal/seen-modal.component';
|
||||||
import { ConfirmModalComponent } from './components/modals/confirm-modal/confirm-modal.component';
|
import { ConfirmModalComponent } from './components/modals/confirm-modal/confirm-modal.component';
|
||||||
@@ -14,6 +13,7 @@ import { RatingModule } from 'ngx-bootstrap/rating';
|
|||||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||||
import { CollectionEditModalComponent } from '../features/collections/user-collection-info/collection-edit-modal/collection-edit-modal.component';
|
import { CollectionEditModalComponent } from '../features/collections/user-collection-info/collection-edit-modal/collection-edit-modal.component';
|
||||||
import { FloatFormatPipe } from './pipes/float-format/float-format.pipe';
|
import { FloatFormatPipe } from './pipes/float-format/float-format.pipe';
|
||||||
|
import { EpisodeSeenModalComponent } from './components/modals/episode-seen-modal/episode-seen-modal.component';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
@@ -33,7 +33,7 @@ import { FloatFormatPipe } from './pipes/float-format/float-format.pipe';
|
|||||||
SeenModalComponent,
|
SeenModalComponent,
|
||||||
CollectionEditModalComponent,
|
CollectionEditModalComponent,
|
||||||
ConfirmModalComponent,
|
ConfirmModalComponent,
|
||||||
|
EpisodeSeenModalComponent,
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
// * pipes
|
// * pipes
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 7.3 KiB |
@@ -62,7 +62,7 @@ input::placeholder {
|
|||||||
/*header*/
|
/*header*/
|
||||||
.top-header .navbar {
|
.top-header .navbar {
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
height: 70px;
|
height: 50px;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
left: 70px;
|
left: 70px;
|
||||||
right: 0;
|
right: 0;
|
||||||
@@ -165,7 +165,7 @@ input::placeholder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.top-header .navbar .nav-item {
|
.top-header .navbar .nav-item {
|
||||||
height: 70px;
|
height: 50px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
@@ -528,10 +528,10 @@ footer {
|
|||||||
|
|
||||||
.main-wrapper {
|
.main-wrapper {
|
||||||
position: relative;
|
position: relative;
|
||||||
height: calc(100vh - 70px);
|
height: calc(100vh - 50px);
|
||||||
/* overflow: hidden; */
|
/* overflow: hidden; */
|
||||||
|
|
||||||
margin-top: 70px;
|
margin-top: 50px;
|
||||||
margin-left: 70px;
|
margin-left: 70px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ $dropdownAnimation: 0.6s cubic-bezier(0.25, 0.8, 0.25, 1) 0s normal forwards 1
|
|||||||
.top-header {
|
.top-header {
|
||||||
.navbar {
|
.navbar {
|
||||||
background-color: $headerbg;
|
background-color: $headerbg;
|
||||||
height: 70px;
|
height: 50px;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
// border-bottom: 1px solid var(--bs-border-color);
|
// border-bottom: 1px solid var(--bs-border-color);
|
||||||
left: 260px;
|
left: 260px;
|
||||||
@@ -220,7 +220,7 @@ $dropdownAnimation: 0.6s cubic-bezier(0.25, 0.8, 0.25, 1) 0s normal forwards 1
|
|||||||
}
|
}
|
||||||
|
|
||||||
.nav-item {
|
.nav-item {
|
||||||
height: 70px;
|
height: 50px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
@@ -437,7 +437,7 @@ $dropdownAnimation: 0.6s cubic-bezier(0.25, 0.8, 0.25, 1) 0s normal forwards 1
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: start;
|
justify-content: start;
|
||||||
width: 260px;
|
width: 260px;
|
||||||
height: 70px;
|
height: 50px;
|
||||||
padding: 0 1rem;
|
padding: 0 1rem;
|
||||||
gap: 0.5rem;
|
gap: 0.5rem;
|
||||||
// border-bottom: 1px solid var(--bs-border-color);
|
// border-bottom: 1px solid var(--bs-border-color);
|
||||||
@@ -475,10 +475,10 @@ $dropdownAnimation: 0.6s cubic-bezier(0.25, 0.8, 0.25, 1) 0s normal forwards 1
|
|||||||
$border-color_1: initial;
|
$border-color_1: initial;
|
||||||
|
|
||||||
.sidebar-nav {
|
.sidebar-nav {
|
||||||
margin-top: 70px;
|
margin-top: 50px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
height: calc(100% - 140px);
|
height: calc(100% - 70px);
|
||||||
|
|
||||||
ul {
|
ul {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
@@ -647,7 +647,7 @@ $dropdownAnimation: 0.6s cubic-bezier(0.25, 0.8, 0.25, 1) 0s normal forwards 1
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (min-width: 1199px) {
|
@media screen and (min-width: 199px) {
|
||||||
body.toggled {
|
body.toggled {
|
||||||
.sidebar-wrapper {
|
.sidebar-wrapper {
|
||||||
&:hover {
|
&:hover {
|
||||||
@@ -751,7 +751,7 @@ $dropdownAnimation: 0.6s cubic-bezier(0.25, 0.8, 0.25, 1) 0s normal forwards 1
|
|||||||
/* main content */
|
/* main content */
|
||||||
|
|
||||||
.main-wrapper {
|
.main-wrapper {
|
||||||
margin-top: 70px;
|
margin-top: 50px;
|
||||||
padding-bottom: 20px;
|
padding-bottom: 20px;
|
||||||
margin-left: 260px;
|
margin-left: 260px;
|
||||||
transition: ease-out 0.3s;
|
transition: ease-out 0.3s;
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
export const environment = {
|
||||||
|
production: true,
|
||||||
|
API_URL: 'http://localhost:4000/api/v1',
|
||||||
|
TMDB_API_URL: 'https://api.themoviedb.org/3',
|
||||||
|
TMDB_API_KEY: '5323ef3dc430df54dcb9e58c37fd22bb',
|
||||||
|
};
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
export const environment = {
|
||||||
|
production: false,
|
||||||
|
API_URL: 'http://localhost:4000/api/v1',
|
||||||
|
TMDB_API_URL: 'https://api.themoviedb.org/3',
|
||||||
|
TMDB_API_KEY: '5323ef3dc430df54dcb9e58c37fd22bb',
|
||||||
|
};
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>ShowZ</title>
|
<title>Showy</title>
|
||||||
<base href="/">
|
<base href="/">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||||
|
|||||||
@@ -3,42 +3,17 @@ const { app, BrowserWindow } = require('electron');
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
const url = require('url');
|
const url = require('url');
|
||||||
|
|
||||||
|
let expressProcess;
|
||||||
let win;
|
let win;
|
||||||
|
|
||||||
function createWindow() {
|
|
||||||
win = new BrowserWindow({
|
|
||||||
width: 1200,
|
|
||||||
height: 720,
|
|
||||||
webPreferences: {
|
|
||||||
nodeIntegration: true
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
win.loadURL(
|
|
||||||
url.format({
|
|
||||||
pathname: path.join(__dirname, 'dist\\show-z\\browser\\index.html'),
|
|
||||||
protocol: 'file:',
|
|
||||||
slashes: true
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
win.on('closed', () => {
|
|
||||||
win = null;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// app.on('ready', createWindow);
|
// app.on('ready', createWindow);
|
||||||
|
|
||||||
app.on('ready', () => {
|
app.on('ready', () => {
|
||||||
// Start the Express server
|
// ! Start the Express server loop
|
||||||
const expressProcess = spawn('node', ['backend/server.js']);
|
startExpressServer();
|
||||||
expressProcess.stdout.on('data', (data) => {
|
createMediaFolders();
|
||||||
console.log(`Express stdout: ${data}`);
|
|
||||||
});
|
|
||||||
expressProcess.stderr.on('data', (data) => {
|
|
||||||
console.error(`Express stderr: ${data}`);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Start the Electron app
|
// Start the Electron app
|
||||||
createWindow();
|
createWindow();
|
||||||
@@ -55,3 +30,60 @@ app.on('activate', () => {
|
|||||||
createWindow();
|
createWindow();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const { dialog, ipcMain } = require('electron');
|
||||||
|
const { createMediaFolders } = require('./backend/services/mediaService');
|
||||||
|
|
||||||
|
ipcMain.on('select-dirs', async (event, arg) => {
|
||||||
|
const result = await dialog.showOpenDialog(mainWindow, {
|
||||||
|
properties: ['openDirectory']
|
||||||
|
})
|
||||||
|
console.log('directories selected', result.filePaths)
|
||||||
|
})
|
||||||
|
|
||||||
|
function startExpressServer() {
|
||||||
|
let parrentProcess = {
|
||||||
|
"electron_path": app.getPath('userData')
|
||||||
|
}
|
||||||
|
// Start the Express server
|
||||||
|
expressProcess = spawn('node', ['backend/server.js'], { env: { PARENT_PROCESS: JSON.stringify(parrentProcess) } });
|
||||||
|
expressProcess.stdout.on('data', (data) => {
|
||||||
|
console.log(`Express stdout: ${data}`);
|
||||||
|
});
|
||||||
|
expressProcess.stderr.on('data', (data) => {
|
||||||
|
console.error(`Express stderr: ${data}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Restart the server if it crashes
|
||||||
|
expressProcess.on('exit', (code, signal) => {
|
||||||
|
console.log(`Express process exited with code ${code} and signal ${signal}. Restarting...`);
|
||||||
|
startExpressServer();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function createWindow() {
|
||||||
|
win = new BrowserWindow({
|
||||||
|
width: 1200,
|
||||||
|
height: 720,
|
||||||
|
webPreferences: {
|
||||||
|
preload: path.join(__dirname, 'preload.js'),
|
||||||
|
nodeIntegration: true,
|
||||||
|
enableRemoteModule: false,
|
||||||
|
contextIsolation: true,
|
||||||
|
sandbox: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
win.loadURL(
|
||||||
|
url.format({
|
||||||
|
pathname: path.join(__dirname, 'dist', 'showy', 'browser', 'index.html'),
|
||||||
|
protocol: 'file:',
|
||||||
|
slashes: true
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
win.on('closed', () => {
|
||||||
|
win = null;
|
||||||
|
});
|
||||||
|
}
|
||||||
Generated
+2
-2
@@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "show-z",
|
"name": "showy",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "show-z",
|
"name": "showy",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/animations": "^17.0.0",
|
"@angular/animations": "^17.0.0",
|
||||||
|
|||||||
+21
-21
@@ -1,23 +1,34 @@
|
|||||||
{
|
{
|
||||||
"name": "show-z",
|
"name": "showy",
|
||||||
"author": "X4Lo",
|
"author": "X4Lo",
|
||||||
"description": "Movies & Tv-Series Tracking library",
|
"description": "Movies & Tv-Series Tracking library",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"ng": "ng",
|
"Backend": "nodemon backend/server.js",
|
||||||
"start:backend": "nodemon backend/server.js",
|
"Frontend": "ng serve",
|
||||||
"start:frontend": "ng serve",
|
"build-and-copy": "ng build --configuration production --base-href ./ && copyfiles backend/**/* dist/showy",
|
||||||
"electron build": "ng build --configuration=production --base-href ./ && copyfiles backend/**/* dist/show-z && electron .",
|
|
||||||
"build": "ng build",
|
|
||||||
"watch": "ng build --watch --configuration development",
|
"watch": "ng build --watch --configuration development",
|
||||||
"test": "ng test",
|
"electron-build:all": "ng build --configuration=production --base-href ./ && copyfiles backend/**/* dist/showy && electron . && electron-builder",
|
||||||
"electron-build": "npm-run-all -s electron-build:*",
|
|
||||||
"electron-build:ng": "ng build --configuration=production --base-href ./",
|
"electron-build:ng": "ng build --configuration=production --base-href ./",
|
||||||
"electron-build:copy": "copyfiles backend/**/* dist/show-z",
|
"electron-build:copy": "copyfiles backend/**/* dist/showy",
|
||||||
"electron-build:electron": "electron .",
|
"electron-build:electron": "electron .",
|
||||||
"electron-build:exe": "electron-builder"
|
"electron-build:exe": "electron-builder",
|
||||||
|
"electron-copy-be": "copyfiles backend/**/* dist_electron/win-unpacked"
|
||||||
},
|
},
|
||||||
|
"build": {
|
||||||
|
"appId": "xalo.showy",
|
||||||
|
"productName": "Showy",
|
||||||
|
"win": {
|
||||||
|
"target": "nsis",
|
||||||
|
"icon": "frontend/to/icon.ico"
|
||||||
|
},
|
||||||
|
"directories": {
|
||||||
|
"output": "dist_electron"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"portable": true,
|
||||||
|
"singleInstance": false,
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/animations": "^17.0.0",
|
"@angular/animations": "^17.0.0",
|
||||||
@@ -64,16 +75,5 @@
|
|||||||
"karma-jasmine-html-reporter": "~2.1.0",
|
"karma-jasmine-html-reporter": "~2.1.0",
|
||||||
"nodemon": "^3.1.0",
|
"nodemon": "^3.1.0",
|
||||||
"typescript": "~5.2.2"
|
"typescript": "~5.2.2"
|
||||||
},
|
|
||||||
"build": {
|
|
||||||
"appId": "xalo.showy",
|
|
||||||
"productName": "Showy",
|
|
||||||
"win": {
|
|
||||||
"target": "nsis",
|
|
||||||
"icon": "frontend/to/icon.ico"
|
|
||||||
},
|
|
||||||
"directories": {
|
|
||||||
"output": "dist_exe"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
const { ipcRenderer } = require('electron')
|
||||||
|
|
||||||
|
process.once('loaded', () => {
|
||||||
|
window.addEventListener('message', evt => {
|
||||||
|
if (evt.data.type === 'select-dirs') {
|
||||||
|
ipcRenderer.send('select-dirs')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
Reference in new issue
Block a user