Skip to content

Commit

Permalink
Better logging
Browse files Browse the repository at this point in the history
  • Loading branch information
hyoretsu committed Jan 28, 2024
1 parent 00f8dea commit 7992976
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/jackett/utils/jackettSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@ export default async function jackettSearch(
const isSeries = type === "series";
const torrentAddon = addonType === "torrent";

console.log("Searching on Jackett...");
console.log(`Will return ${!torrentAddon ? "Debrid link" : "Torrents"}.`);
console.log(`Searching on Jackett, will return ${!torrentAddon ? "debrid links" : "torrents"}...`);

let searchUrl = `${jackettHost}/api/v2.0/indexers/all/results/torznab/api?apikey=${jackettApiKey}&cat=${
isSeries ? 5000 : 2000
}&q=${encodeURIComponent(name)}${isSeries ? `+S${season}E${episode}` : ""}`;

console.log(searchUrl.replace(/apikey=.*&/g, "apikey=<private>&"));

const results = [];

let items = await getItemsFromUrl(searchUrl);
Expand All @@ -46,7 +47,6 @@ export default async function jackettSearch(
break;
}

console.log("Getting torrent info...");
const torrentInfo = await getTorrentInfo(item.link);
console.log(`Torrent info: ${item.title}`);

Expand Down
4 changes: 2 additions & 2 deletions src/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ routes.get("/:params/stream/:type/:id", async (req, res) => {

const mediaName = await getName(id[0], type);
if (type === "movie") {
console.log(`Movie request. ID: ${id[0]} Name: ${mediaName}`);
console.log(`Movie request.\nID: ${id[0]}\nName: ${mediaName}`);
const torrentInfo = await fetchResults(debridApi, jackettUrl, jackettApi, service, maxResults, {
name: mediaName,
type: type,
Expand All @@ -63,7 +63,7 @@ routes.get("/:params/stream/:type/:id", async (req, res) => {
}
if (type === "series") {
console.log(
`Series request. ID: ${id[0]} Name: "${mediaName}" Season: ${getNum(id[1])} Episode: ${getNum(
`Series request. ID: ${id[0]}\nName: "${mediaName}"\nSeason: ${getNum(id[1])} Episode: ${getNum(
id[2],
)}`,
);
Expand Down

0 comments on commit 7992976

Please sign in to comment.