1
0

Compare commits

..

No commits in common. "b82a71b9e70cc6a79c7bd8a2307bfb50b42b3e13" and "914a81adedb8bb3ba7450bf7b59049c266dd0438" have entirely different histories.

2 changed files with 8 additions and 11 deletions

View File

@ -126,7 +126,7 @@ const LP_TIMEOUT_MS = 25000;
function lpNotify(source, filePath) {
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) {
clearTimeout(waiter.timer);
try { waiter.res.json({ version: lpVersion }); } catch (_) {}
@ -159,13 +159,12 @@ autopostRouter.get('/updates', (req, res) => {
});
// Watcher fichiers (JSON / BDINFO) + fallback scan
const infoDir = path.resolve(config.logdirectory);
const infoDir = path.resolve(config.infodirectory);
const watchPatterns = [
path.join(infoDir, '*.json'),
path.join(infoDir, '*.JSON'),
path.join(infoDir, '*.bdinfo.txt'),
path.join(infoDir, '*.BDINFO.TXT'),
path.join(infoDir, '*.log')
path.join(infoDir, '*.BDINFO.TXT')
];
const lpWatcher = chokidar.watch(watchPatterns, {
@ -180,7 +179,7 @@ const lpWatcher = chokidar.watch(watchPatterns, {
lpWatcher.on('add', (filePath) => lpNotify('add', 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));
// Fallback scan (toutes les 2s) : signature (nb fichiers + dernier mtime)
@ -190,7 +189,7 @@ let lastSig = null;
async function computeSignature() {
try {
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;
await Promise.all(files.map(async (n) => {
try {
@ -424,7 +423,7 @@ autopostRouter.get('/', async (req, res) => {
default:
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>'
: '';
let mediainfoLink = (parseInt(row.status) === 0 || parseInt(row.status) === 1 || parseInt(row.status) === 2)

View File

@ -120,11 +120,9 @@ do_add() {
do_check() {
release_path="$2"
release_name=$(basename "$release_path")
if [[ "${release_name}" =~ \.(mkv|mp4|iso)$ ]]; then
release_name="${release_name%.*}"
fi
release_without_ext="${release_name%.*}"
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')
explain=$(echo "$response" | jq -r '.Explain')