7-create-playlist #37

Merged
phlaym merged 6 commits from 7-create-playlist into main 2025-07-04 09:46:12 +00:00
14 changed files with 670 additions and 268 deletions
Showing only changes of commit a8b6a309f0 - Show all commits

View File

@ -12,7 +12,7 @@ export const log = {
console.debug(new Date().toISOString(), ...params); console.debug(new Date().toISOString(), ...params);
}, },
debug: (...params: any[]) => { debug: (...params: any[]) => {
if (!DEV) { if (!log.isDebugEnabled()) {
return; return;
} }
console.debug(new Date().toISOString(), ...params); console.debug(new Date().toISOString(), ...params);
@ -28,5 +28,8 @@ export const log = {
}, },
error: (...params: any[]) => { error: (...params: any[]) => {
console.error(new Date().toISOString(), ...params); console.error(new Date().toISOString(), ...params);
},
isDebugEnabled: (): boolean => {
return DEV;
} }
}; };

View File

@ -141,7 +141,7 @@ export class YoutubePlaylistAdder {
return; return;
} }
if (!song.youtubeUrl) { if (!song.youtubeUrl) {
log.debug('Skip adding song to YT playlist, no youtube Url', song); log.info('Skip adding song to YT playlist, no youtube Url', song);
return; return;
} }
@ -186,7 +186,11 @@ export class YoutubePlaylistAdder {
const youtubeApiUrl = new URL(`${this.apiBase}/playlistItems?${searchParams}`); const youtubeApiUrl = new URL(`${this.apiBase}/playlistItems?${searchParams}`);
const resp = await fetch(youtubeApiUrl, options); const resp = await fetch(youtubeApiUrl, options);
const respObj = await resp.json(); const respObj = await resp.json();
log.debug('Added to playlist', options, respObj); if (log.isDebugEnabled()) {
log.info('Added to playlist', options, respObj);
} else {
log.info('Added to playlist', youtubeId, song.title);
}
if (respObj.error) { if (respObj.error) {
log.debug('Add to playlist failed', respObj.error.errors); log.debug('Add to playlist failed', respObj.error.errors);
} }