Actualiser js/admin.js

This commit is contained in:
2026-06-27 11:13:17 +02:00
parent b158d0fcdc
commit dd2d74f644
+14 -10
View File
@@ -420,29 +420,30 @@ async function handleCritiqueUpload(input) {
}
function normalizeVideothequeRow(row) {
let ean = row['ean_isbn13'] || row['EAN'] || row['ean'] || '';
// Ajout de 'Barcode' et 'UPC' / On ne retire plus les zéros de tête
let ean = row['ean_isbn13'] || row['EAN'] || row['ean'] || row['Barcode'] || row['UPC'] || '';
if (ean !== '') {
ean = String(ean).replace(/[^0-9]/g, '');
ean = ean.replace(/^0+/, '');
}
let length = row['length'] || row['Length'] || '';
let length = row['length'] || row['Length'] || row['Runtime'] || row['runtime'] || '';
if (length !== '' && length !== null) {
const l = parseFloat(length);
length = isNaN(l) ? '' : String(Math.round(l));
}
let discs = row['number_of_discs'] || row['Number_of_discs'] || row['Discs'] || '';
let discs = row['number_of_discs'] || row['Number_of_discs'] || row['Discs'] || row['discs'] || '';
if (discs === '' || discs === null || isNaN(parseFloat(discs))) {
discs = 1;
} else {
discs = Math.round(parseFloat(discs));
}
let aspect = row['aspect_ratio'] || row['Aspect_ratio'] || row['AspectRatio'] || '';
let actors = row['creators'] || row['Actors'] || row['actors'] || '';
let publisher = row['publisher'] || row['Publisher'] || '';
let director = row['first_name'] && row['last_name'] ? (row['first_name'] + ' ' + row['last_name']).trim() : '';
let aspect = row['aspect_ratio'] || row['Aspect_ratio'] || row['AspectRatio'] || row['Aspect Ratio'] || '';
let actors = row['creators'] || row['Actors'] || row['actors'] || row['Cast'] || row['cast'] || '';
let publisher = row['publisher'] || row['Publisher'] || row['Studio'] || row['studio'] || row['Label'] || row['label'] || '';
let director = row['first_name'] && row['last_name'] ? (row['first_name'] + ' ' + row['last_name']).trim() : (row['Director'] || row['director'] || '');
let format = row['format'] || row['Format'] || row['Media'] || row['media'] || '';
return Object.assign({}, row, {
ean: ean,
@@ -451,7 +452,8 @@ function normalizeVideothequeRow(row) {
aspect_ratio: aspect,
actors: actors,
publisher: publisher,
director: director
director: director,
format: format // Le format est maintenant géré
});
}
@@ -486,6 +488,7 @@ function handleVideothequeUpload(input) {
const actors = normalizedRow['actors'] || '';
const publisher = normalizedRow['publisher'] || '';
const director = normalizedRow['director'] || '';
const format = normalizedRow['format'] || ''; // 👈 LIGNE À AJOUTER
return {
title: title.trim(),
@@ -497,7 +500,8 @@ function handleVideothequeUpload(input) {
aspect_ratio: aspect,
actors: actors,
publisher: publisher,
director: director
director: director,
format: format // 👈 LIGNE À AJOUTER
};
}).filter(item => item !== null);