diff --git a/.serena/cache/typescript/document_symbols_cache_v23-06-25.pkl b/.serena/cache/typescript/document_symbols_cache_v23-06-25.pkl index 2dfd643..7abe452 100644 Binary files a/.serena/cache/typescript/document_symbols_cache_v23-06-25.pkl and b/.serena/cache/typescript/document_symbols_cache_v23-06-25.pkl differ diff --git a/.serena/memories/progress_note_instructions_read.md b/.serena/memories/progress_note_instructions_read.md new file mode 100644 index 0000000..ad3f524 --- /dev/null +++ b/.serena/memories/progress_note_instructions_read.md @@ -0,0 +1,14 @@ +# Instructions Read - Progress Note + +## Action Taken +Read and understood project instructions and key memory files for the Quixotic project. + +## Key Findings +- Project is a YouTube music search/MP3 conversion Telegram miniapp +- Tech stack: Node.js/Express, SQLite, FFmpeg, Telegram Bot API +- Development workflow: yarn dev for development, symbolic code editing preferred +- Must save progress notes automatically after major actions +- Currently viewing /Users/andrew/stuff/quixotic/src/bot.ts in IDE + +## Next Steps +Ready to assist with any development tasks for the Quixotic project. \ No newline at end of file diff --git a/public/script.ts b/public/script.ts index c152c62..245089e 100644 --- a/public/script.ts +++ b/public/script.ts @@ -46,6 +46,7 @@ class QuixoticApp { private noResults!: HTMLElement; private welcomePlaceholder!: HTMLElement; private searchTimeout?: NodeJS.Timeout; + private currentVideos: VideoResult[] = []; constructor() { this.tg = (window as WindowWithTelegram).Telegram?.WebApp; @@ -194,6 +195,9 @@ class QuixoticApp { return; } + // Store current videos for metadata access + this.currentVideos = videos; + // Hide welcome and no results this.welcomePlaceholder.classList.add('tg-hidden'); this.welcomePlaceholder.style.display = 'none'; @@ -255,6 +259,11 @@ class QuixoticApp { public async convertVideo(videoId: string, title: string, url: string): Promise { console.log('🎵 Converting:', title); + // Find video metadata from current search results + const video = this.currentVideos.find(v => v.id.toString() === videoId); + const performer = video?.channel || 'Unknown Artist'; + const thumbnail = video?.thumbnail || ''; + // Find the clicked element by looking for the one that contains this videoId const videoElement = document.querySelector(`[onclick*="${videoId}"]`) as HTMLElement; if (videoElement) { @@ -304,7 +313,9 @@ class QuixoticApp { body: JSON.stringify({ userId: userId, audioUrl: data.audioUrl, - title: title + title: title, + performer: performer, + thumbnail: thumbnail }) }); diff --git a/src/bot.ts b/src/bot.ts index 605bbb4..46a7b45 100644 --- a/src/bot.ts +++ b/src/bot.ts @@ -250,11 +250,11 @@ export class QuixoticBot { } // Public method for external API calls - public async sendAudioFile(chatId: number, audioUrl: string, title: string): Promise { - return this.sendAudioFileInternal(chatId, audioUrl, title); + public async sendAudioFile(chatId: number, audioUrl: string, title: string, performer?: string, thumbnail?: string): Promise { + return this.sendAudioFileInternal(chatId, audioUrl, title, performer, thumbnail); } - private async sendAudioFileInternal(chatId: number, audioUrl: string, title: string): Promise { + private async sendAudioFileInternal(chatId: number, audioUrl: string, title: string, performer?: string, thumbnail?: string): Promise { try { console.log(`📤 Sending: ${title} to chat ${chatId}`); @@ -262,8 +262,9 @@ export class QuixoticBot { try { await this.bot.sendAudio(chatId, audioUrl, { title: title, - performer: 'SoundCloud', + performer: performer || 'SoundCloud', caption: `🎵 ${title}`, + thumbnail: thumbnail, parse_mode: undefined }); console.log(`✅ Audio sent: ${title}`); diff --git a/src/server.ts b/src/server.ts index 38cc199..416f0a5 100644 --- a/src/server.ts +++ b/src/server.ts @@ -219,7 +219,7 @@ app.post('/api/telegram-send', async (req: Request, res: Response) => { console.log('🚀 Telegram send request received'); try { - const { userId, audioUrl, title }: { userId?: string; audioUrl?: string; title?: string } = req.body; + const { userId, audioUrl, title, performer, thumbnail }: { userId?: string; audioUrl?: string; title?: string; performer?: string; thumbnail?: string } = req.body; console.log(`📤 Sending to user ${userId}: ${title}`); if (!userId || !audioUrl || !title) { @@ -233,7 +233,7 @@ app.post('/api/telegram-send', async (req: Request, res: Response) => { } const chatId = parseInt(userId); - await botInstance.sendAudioFile(chatId, audioUrl, title); + await botInstance.sendAudioFile(chatId, audioUrl, title, performer, thumbnail); console.log('✅ Audio sent successfully'); res.json({ success: true, message: 'Audio sent successfully' }); diff --git a/src/soundcloud.ts b/src/soundcloud.ts index fee5f93..ab66d5c 100644 --- a/src/soundcloud.ts +++ b/src/soundcloud.ts @@ -31,6 +31,7 @@ interface TrackInfo { author: string; length: number; available: boolean; + thumbnail?: string; } export class SoundCloudService { @@ -131,7 +132,8 @@ export class SoundCloudService { title: track.title, author: track.user?.username || 'Unknown', length: Math.floor(track.duration / 1000), - available: track.streamable + available: track.streamable, + thumbnail: this.getHighQualityThumbnail(track.artwork_url || track.user?.avatar_url || '') }; } catch (error) { console.error('Error getting track info:', error);