style: add prettier and format codebase
This commit is contained in:
parent
bf459740fe
commit
2f58ac7bf8
18 changed files with 151 additions and 70 deletions
|
|
@ -91,9 +91,7 @@ function formatResult(
|
|||
`Stream: ${r.streaming.flatrate.map((p) => p.name).join(", ")}`,
|
||||
);
|
||||
if (r.streaming.free.length > 0)
|
||||
providers.push(
|
||||
`Free: ${r.streaming.free.map((p) => p.name).join(", ")}`,
|
||||
);
|
||||
providers.push(`Free: ${r.streaming.free.map((p) => p.name).join(", ")}`);
|
||||
if (providers.length > 0) lines.push(` ${providers.join(" | ")}`);
|
||||
}
|
||||
|
||||
|
|
@ -130,7 +128,8 @@ export function formatPopularResults(data: PopularResponse): string {
|
|||
}
|
||||
|
||||
const header = `Popular content (${data.total} total, page ${data.page}):`;
|
||||
const hint = "(Use search_content with a title to get torrents and full details)";
|
||||
const hint =
|
||||
"(Use search_content with a title to get torrents and full details)";
|
||||
const items = data.items.map((item, i) => formatPopularItem(item, i + 1));
|
||||
return [header, hint, "", ...items].join("\n");
|
||||
}
|
||||
|
|
@ -152,7 +151,8 @@ export function formatRecentResults(data: RecentResponse): string {
|
|||
}
|
||||
|
||||
const header = `Recently added content (${data.total} total, page ${data.page}):`;
|
||||
const hint = "(Use search_content with a title to get torrents and full details)";
|
||||
const hint =
|
||||
"(Use search_content with a title to get torrents and full details)";
|
||||
const items = data.items.map((item, i) => formatRecentItem(item, i + 1));
|
||||
return [header, hint, "", ...items].join("\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,9 +27,7 @@ export function formatWatchProviders(data: WatchProvidersResponse): string {
|
|||
].filter(Boolean) as string[];
|
||||
|
||||
if (sections.length === 0) {
|
||||
lines.push(
|
||||
` No watch providers found in ${data.country}.`,
|
||||
);
|
||||
lines.push(` No watch providers found in ${data.country}.`);
|
||||
} else {
|
||||
lines.push(...sections);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,10 +28,7 @@ export function registerGetPopular(
|
|||
},
|
||||
async (params) => {
|
||||
try {
|
||||
const data = await client.getPopular(
|
||||
params.limit ?? 10,
|
||||
params.page,
|
||||
);
|
||||
const data = await client.getPopular(params.limit ?? 10, params.page);
|
||||
return {
|
||||
content: [{ type: "text", text: formatPopularResults(data) }],
|
||||
};
|
||||
|
|
|
|||
|
|
@ -28,10 +28,7 @@ export function registerGetRecent(
|
|||
},
|
||||
async (params) => {
|
||||
try {
|
||||
const data = await client.getRecent(
|
||||
params.limit ?? 10,
|
||||
params.page,
|
||||
);
|
||||
const data = await client.getRecent(params.limit ?? 10, params.page);
|
||||
return {
|
||||
content: [{ type: "text", text: formatRecentResults(data) }],
|
||||
};
|
||||
|
|
|
|||
|
|
@ -27,9 +27,7 @@ export function registerGetWatchProviders(
|
|||
"Must be uppercase 2-letter ISO 3166-1 country code",
|
||||
)
|
||||
.default("US")
|
||||
.describe(
|
||||
"ISO 3166-1 country code (e.g. US, ES, GB, DE). Default: US",
|
||||
),
|
||||
.describe("ISO 3166-1 country code (e.g. US, ES, GB, DE). Default: US"),
|
||||
},
|
||||
async (params) => {
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue