Compare commits
No commits in common. "b82a71b9e70cc6a79c7bd8a2307bfb50b42b3e13" and "914a81adedb8bb3ba7450bf7b59049c266dd0438" have entirely different histories.
b82a71b9e7
...
914a81aded
@ -126,7 +126,7 @@ const LP_TIMEOUT_MS = 25000;
|
|||||||
|
|
||||||
function lpNotify(source, filePath) {
|
function lpNotify(source, filePath) {
|
||||||
lpVersion += 1;
|
lpVersion += 1;
|
||||||
//console.log('[LP] notify', { version: lpVersion, source, file: filePath });
|
console.log('[LP] notify', { version: lpVersion, source, file: filePath });
|
||||||
for (const waiter of lpWaiters) {
|
for (const waiter of lpWaiters) {
|
||||||
clearTimeout(waiter.timer);
|
clearTimeout(waiter.timer);
|
||||||
try { waiter.res.json({ version: lpVersion }); } catch (_) {}
|
try { waiter.res.json({ version: lpVersion }); } catch (_) {}
|
||||||
@ -159,13 +159,12 @@ autopostRouter.get('/updates', (req, res) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Watcher fichiers (JSON / BDINFO) + fallback scan
|
// Watcher fichiers (JSON / BDINFO) + fallback scan
|
||||||
const infoDir = path.resolve(config.logdirectory);
|
const infoDir = path.resolve(config.infodirectory);
|
||||||
const watchPatterns = [
|
const watchPatterns = [
|
||||||
path.join(infoDir, '*.json'),
|
path.join(infoDir, '*.json'),
|
||||||
path.join(infoDir, '*.JSON'),
|
path.join(infoDir, '*.JSON'),
|
||||||
path.join(infoDir, '*.bdinfo.txt'),
|
path.join(infoDir, '*.bdinfo.txt'),
|
||||||
path.join(infoDir, '*.BDINFO.TXT'),
|
path.join(infoDir, '*.BDINFO.TXT')
|
||||||
path.join(infoDir, '*.log')
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const lpWatcher = chokidar.watch(watchPatterns, {
|
const lpWatcher = chokidar.watch(watchPatterns, {
|
||||||
@ -180,7 +179,7 @@ const lpWatcher = chokidar.watch(watchPatterns, {
|
|||||||
|
|
||||||
lpWatcher.on('add', (filePath) => lpNotify('add', filePath));
|
lpWatcher.on('add', (filePath) => lpNotify('add', filePath));
|
||||||
lpWatcher.on('change', (filePath) => lpNotify('change', filePath));
|
lpWatcher.on('change', (filePath) => lpNotify('change', filePath));
|
||||||
//lpWatcher.on('ready', () => console.log('[LP] watcher ready on', watchPatterns));
|
lpWatcher.on('ready', () => console.log('[LP] watcher ready on', watchPatterns));
|
||||||
lpWatcher.on('error', (err) => console.error('[LP] watcher error:', err));
|
lpWatcher.on('error', (err) => console.error('[LP] watcher error:', err));
|
||||||
|
|
||||||
// Fallback scan (toutes les 2s) : signature (nb fichiers + dernier mtime)
|
// Fallback scan (toutes les 2s) : signature (nb fichiers + dernier mtime)
|
||||||
@ -190,7 +189,7 @@ let lastSig = null;
|
|||||||
async function computeSignature() {
|
async function computeSignature() {
|
||||||
try {
|
try {
|
||||||
const names = await fsp.readdir(infoDir);
|
const names = await fsp.readdir(infoDir);
|
||||||
const files = names.filter(n => /(?:\.json|\.log|\.bdinfo\.txt)$/i.test(n));
|
const files = names.filter(n => /\.json$/i.test(n) || /\.bdinfo\.txt$/i.test(n));
|
||||||
let latest = 0;
|
let latest = 0;
|
||||||
await Promise.all(files.map(async (n) => {
|
await Promise.all(files.map(async (n) => {
|
||||||
try {
|
try {
|
||||||
@ -424,7 +423,7 @@ autopostRouter.get('/', async (req, res) => {
|
|||||||
default:
|
default:
|
||||||
statusText = 'INCONNU';
|
statusText = 'INCONNU';
|
||||||
}
|
}
|
||||||
let logLink = (parseInt(row.status) === 1 || parseInt(row.status) === 2 || parseInt(row.status) === 4)
|
let logLink = (parseInt(row.status) === 1 || parseInt(row.status) === 2)
|
||||||
? ' | <a href="#" class="log-link text-blue-400 hover:underline" data-filename="' + row.nom + '">Log</a>'
|
? ' | <a href="#" class="log-link text-blue-400 hover:underline" data-filename="' + row.nom + '">Log</a>'
|
||||||
: '';
|
: '';
|
||||||
let mediainfoLink = (parseInt(row.status) === 0 || parseInt(row.status) === 1 || parseInt(row.status) === 2)
|
let mediainfoLink = (parseInt(row.status) === 0 || parseInt(row.status) === 1 || parseInt(row.status) === 2)
|
||||||
|
|||||||
@ -120,11 +120,9 @@ do_add() {
|
|||||||
do_check() {
|
do_check() {
|
||||||
release_path="$2"
|
release_path="$2"
|
||||||
release_name=$(basename "$release_path")
|
release_name=$(basename "$release_path")
|
||||||
if [[ "${release_name}" =~ \.(mkv|mp4|iso)$ ]]; then
|
release_without_ext="${release_name%.*}"
|
||||||
release_name="${release_name%.*}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
response=$(curl -s "${URL_API}${APIKEY}&check=${release_name}")
|
response=$(curl -s "${URL_API}${APIKEY}&check=${release_without_ext}")
|
||||||
code=$(echo "$response" | jq -r '.code')
|
code=$(echo "$response" | jq -r '.code')
|
||||||
explain=$(echo "$response" | jq -r '.Explain')
|
explain=$(echo "$response" | jq -r '.Explain')
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user