Skip to content

Commit

Permalink
Logging + Fix unknown season title + Fix padding
Browse files Browse the repository at this point in the history
  • Loading branch information
izu-co committed Jan 11, 2022
1 parent 02bdbf1 commit af8ebbb
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 115 deletions.
6 changes: 2 additions & 4 deletions crunchy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ async function parseObject(item: ParseItem, pad?: number, getSeries?: boolean, g
if(argv.debug){
console.log(item);
}
pad = pad || 2;
pad = pad ?? 2;
getSeries = getSeries === undefined ? true : getSeries;
getMovieListing = getMovieListing === undefined ? true : getMovieListing;
item.isSelected = item.isSelected === undefined ? false : item.isSelected;
Expand Down Expand Up @@ -910,10 +910,8 @@ const downloadFromSeriesID = async () => {
}
for (const key of Object.keys(episodes)) {
const item = episodes[key];
//if (item.items[0].episode_number == null)
// continue;
console.log(`[S${item.items[0].season_number}E${item.items[0].episode}] ${
item.items.find(a => !a.season_title.includes('('))?.season_title as string
item.items.find(a => !a.season_title.match(/\(\w+ Dub\)/))?.season_title ?? item.items[0].season_title
} - ${item.items[0].title} [${
item.items.map((a, index) => {
return `${a.is_premium_only ? '☆ ' : ''}${item.langs[index].name}`;
Expand Down
14 changes: 9 additions & 5 deletions modules/module.updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export default (async (force = false) => {
});
});
if (changedFiles.length < 1) {
console.log('[INFO] No file changes found... updating package.json. If you thing this is an error please get the newst version yourself.');
console.log('[INFO] No file changes found... updating package.json. If you think this is an error please get the newst version yourself.');
return done(newest.name);
}
console.log(`Found file changes: \n${changedFiles.map(a => ` [${
Expand All @@ -95,26 +95,30 @@ export default (async (force = false) => {

const changesToApply = await Promise.all(changedFiles.map(async (a): Promise<ApplyItem> => {
if (a.filename.endsWith('.ts')) {
return {
const ret = {
path: a.filename.slice(0, -2) + 'js',
content: transpileModule((await got(a.raw_url)).body, {
compilerOptions: tsConfig.compilerOptions as unknown as CompilerOptions
}).outputText,
type: a.status === 'modified' ? ApplyType.UPDATE : a.status === 'added' ? ApplyType.ADD : ApplyType.DELETE
};
};
console.log('✓ transpiled %s', ret.path);
return ret;
} else {
return {
const ret = {
path: a.filename,
content: (await got(a.raw_url)).body,
type: a.status === 'modified' ? ApplyType.UPDATE : a.status === 'added' ? ApplyType.ADD : ApplyType.DELETE
};
console.log('✓ transpiled %s', ret.path);
return ret;
}
}));

changesToApply.forEach(a => {
fsextra.ensureDirSync(path.dirname(a.path));
fs.writeFileSync(path.join(__dirname, '..', a.path), a.content);
console.log('✓ %s', a.path);
console.log('✓ written %s', a.path);
});

console.log('[INFO] Done');
Expand Down
Loading

0 comments on commit af8ebbb

Please sign in to comment.