forked from DebaucheryLibrarian/traxxx
Added series as channels with logos and photo album scraping to Little Caprice. Added various tag photos.
This commit is contained in:
@@ -39,6 +39,16 @@ function curateEntity(entity, includeParameters = false) {
|
||||
}, includeParameters));
|
||||
}
|
||||
|
||||
if (entity.siblings) {
|
||||
curatedEntity.parent = {
|
||||
...curatedEntity.parent,
|
||||
children: entity.siblings.map(sibling => curateEntity({
|
||||
...sibling,
|
||||
parent: curatedEntity.parent,
|
||||
}, includeParameters)),
|
||||
};
|
||||
}
|
||||
|
||||
if (entity.tags) {
|
||||
curatedEntity.tags = entity.tags.map(tag => ({
|
||||
id: tag.id,
|
||||
@@ -72,9 +82,10 @@ async function fetchIncludedEntities() {
|
||||
WITH RECURSIVE channels AS (
|
||||
/* select configured channels and networks */
|
||||
SELECT
|
||||
entities.*
|
||||
entities.*, json_agg(siblings) as siblings
|
||||
FROM
|
||||
entities
|
||||
LEFT JOIN entities AS siblings ON siblings.parent_id = entities.parent_id
|
||||
WHERE
|
||||
CASE WHEN :includeAll
|
||||
THEN
|
||||
@@ -91,12 +102,13 @@ async function fetchIncludedEntities() {
|
||||
AND entities.type = 'network')
|
||||
OR (entities.slug = ANY(:excludedChannels)
|
||||
AND entities.type = 'channel'))
|
||||
GROUP BY entities.id
|
||||
|
||||
UNION ALL
|
||||
|
||||
/* select recursive children of configured networks */
|
||||
SELECT
|
||||
entities.*
|
||||
entities.*, null as siblings
|
||||
FROM
|
||||
entities
|
||||
INNER JOIN
|
||||
@@ -117,7 +129,7 @@ async function fetchIncludedEntities() {
|
||||
WHERE
|
||||
channels.type = 'channel'
|
||||
GROUP BY
|
||||
entities.id
|
||||
entities.id;
|
||||
`, include);
|
||||
|
||||
const curatedNetworks = rawNetworks.rows.map(entity => curateEntity(entity, true));
|
||||
|
||||
Reference in New Issue
Block a user