// IS THIS CHANNEL AN X TRENDING LIBRARY? (lane x-trending, review 2 N8b.) The // readers of a posts channel's archive in umtool -- the post search, the // channels offered, Add posts and the reels, the status resolver -- ask it of // every channel they enumerate or are handed, so a library is refused BY NAME // (its marker, common/lib/xTrending/marker.mjs isXTrendingChannel), not only // because its posts are kept one directory down. A library reaches a video // project through the Posts library page alone, once that exists. import { readFile } from "node:fs/promises"; import path from "node:path"; import { isXTrendingChannel } from "yt-dlp-transcript-common/lib/xTrending/marker.mjs"; /** * True when `channels//config.json` carries the library marker. A * channel with no readable config is not a library. * @param {string} channelsDir * @param {string} slug */ export async function isTrendingLibrary(channelsDir, slug) { const text = await readFile(path.join(/* turbopackIgnore: true */ channelsDir, slug, "config.json"), "utf8").catch(() => null); if (text === null) return false; try { return isXTrendingChannel(JSON.parse(text)); } catch { return false; } }