Actualiser js/admin.js
This commit is contained in:
+14
-10
@@ -420,29 +420,30 @@ async function handleCritiqueUpload(input) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function normalizeVideothequeRow(row) {
|
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 !== '') {
|
if (ean !== '') {
|
||||||
ean = String(ean).replace(/[^0-9]/g, '');
|
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) {
|
if (length !== '' && length !== null) {
|
||||||
const l = parseFloat(length);
|
const l = parseFloat(length);
|
||||||
length = isNaN(l) ? '' : String(Math.round(l));
|
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))) {
|
if (discs === '' || discs === null || isNaN(parseFloat(discs))) {
|
||||||
discs = 1;
|
discs = 1;
|
||||||
} else {
|
} else {
|
||||||
discs = Math.round(parseFloat(discs));
|
discs = Math.round(parseFloat(discs));
|
||||||
}
|
}
|
||||||
|
|
||||||
let aspect = row['aspect_ratio'] || row['Aspect_ratio'] || row['AspectRatio'] || '';
|
let aspect = row['aspect_ratio'] || row['Aspect_ratio'] || row['AspectRatio'] || row['Aspect Ratio'] || '';
|
||||||
let actors = row['creators'] || row['Actors'] || row['actors'] || '';
|
let actors = row['creators'] || row['Actors'] || row['actors'] || row['Cast'] || row['cast'] || '';
|
||||||
let publisher = row['publisher'] || row['Publisher'] || '';
|
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() : '';
|
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, {
|
return Object.assign({}, row, {
|
||||||
ean: ean,
|
ean: ean,
|
||||||
@@ -451,7 +452,8 @@ function normalizeVideothequeRow(row) {
|
|||||||
aspect_ratio: aspect,
|
aspect_ratio: aspect,
|
||||||
actors: actors,
|
actors: actors,
|
||||||
publisher: publisher,
|
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 actors = normalizedRow['actors'] || '';
|
||||||
const publisher = normalizedRow['publisher'] || '';
|
const publisher = normalizedRow['publisher'] || '';
|
||||||
const director = normalizedRow['director'] || '';
|
const director = normalizedRow['director'] || '';
|
||||||
|
const format = normalizedRow['format'] || ''; // 👈 LIGNE À AJOUTER
|
||||||
|
|
||||||
return {
|
return {
|
||||||
title: title.trim(),
|
title: title.trim(),
|
||||||
@@ -497,7 +500,8 @@ function handleVideothequeUpload(input) {
|
|||||||
aspect_ratio: aspect,
|
aspect_ratio: aspect,
|
||||||
actors: actors,
|
actors: actors,
|
||||||
publisher: publisher,
|
publisher: publisher,
|
||||||
director: director
|
director: director,
|
||||||
|
format: format // 👈 LIGNE À AJOUTER
|
||||||
};
|
};
|
||||||
}).filter(item => item !== null);
|
}).filter(item => item !== null);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user