Enabled pagination on network page.

This commit is contained in:
2020-05-26 04:11:29 +02:00
parent fe69ec4175
commit 86377fec5f
43 changed files with 164 additions and 81 deletions

View File

@@ -25,7 +25,7 @@ async function actorPosters(actorNames) {
const source = path.join(config.media.path, poster.path);
const directory = path.join(config.media.path, 'extracted', poster.actor_name);
const target = path.join(directory, `${poster.actor_name} - ${poster.network_name}: ${poster.site_name} - ${poster.title.replace(/[/.]/g, '_')} (${moment.utc(poster.date).format('YYYY-MM-DD')})-${poster.index}.jpeg`);
const target = path.join(directory, `${poster.actor_name} - ${poster.network_name}: ${poster.site_name} - ${poster.title.replace(/[/.]/g, '_') || poster.actor_name} (${moment.utc(poster.date).format('YYYY-MM-DD')})-${poster.index}.jpeg`);
await fs.mkdir(path.join(directory), { recursive: true });
const file = await fs.readFile(source);

View File

@@ -1,14 +1,45 @@
'use strict';
const substitutes = {
à: 'a',
á: 'a',
ä: 'a',
å: 'a',
æ: 'ae',
ç: 'c',
è: 'e',
é: 'e',
ë: 'e',
ì: 'i',
í: 'i',
ï: 'i',
ǹ: 'n',
ń: 'n',
ñ: 'n',
ò: 'o',
ó: 'o',
ö: 'o',
ø: 'o',
œ: 'oe',
ß: 'ss',
ù: 'u',
ú: 'u',
ü: 'u',
: 'y',
ý: 'y',
ÿ: 'y',
};
function slugify(string, delimiter = '-', {
encode = false,
removeAccents = true,
limit = 1000,
} = {}) {
if (!string || typeof string !== 'string') {
return string;
}
const slugComponents = string.trim().toLowerCase().match(/\w+/g);
const slugComponents = string.trim().toLowerCase().match(/[A-Za-zÀ-ÖØ-öø-ÿ]+/g);
if (!slugComponents) {
return '';
@@ -18,6 +49,12 @@ function slugify(string, delimiter = '-', {
const accSlug = `${acc}${index > 0 ? delimiter : ''}${component}`;
if (accSlug.length < limit) {
if (removeAccents) {
return accSlug.replace(/[à-ÿ]/g, (match) => {
return substitutes[match] || '';
});
}
return accSlug;
}