artist
This commit is contained in:
Binary file not shown.
27
.serena/memories/filename_display_fix_complete.md
Normal file
27
.serena/memories/filename_display_fix_complete.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# Audio File Display Name Fix - Complete
|
||||
|
||||
## Problem Solved
|
||||
User wanted audio files to show proper "Artist - Title.mp3" names when sent to Telegram, but without changing the saved filename on disk.
|
||||
|
||||
## Solution Implemented
|
||||
1. **Reverted file storage**: Files are saved with original format `${videoId}_${title}.mp3`
|
||||
2. **Custom display filename**: Added logic to generate custom filename only for Telegram display
|
||||
3. **Modified sendAudioFileInternal()**: Now accepts both URLs and file paths, generates custom filename for display
|
||||
|
||||
## Key Changes in src/bot.ts
|
||||
- Function now detects if input is URL or file path
|
||||
- Extracts local file path from URL when needed
|
||||
- Generates custom display filename: `${performer} - ${title}.mp3`
|
||||
- Uses file options parameter to set custom filename in Telegram
|
||||
- Maintains backward compatibility with both URL and file path inputs
|
||||
|
||||
## Technical Details
|
||||
- Uses node-telegram-bot-api file options: `{ filename: customFilename, contentType: 'audio/mpeg' }`
|
||||
- Sanitizes performer and title for safe filename (removes special chars, limits length)
|
||||
- Fallback: sends as document if audio fails
|
||||
- Error handling: sends text message with link if all methods fail
|
||||
|
||||
## Result
|
||||
- Files stored on disk: `123456_song_title.mp3` (unchanged)
|
||||
- Files displayed in Telegram: `Artist Name - Song Title.mp3`
|
||||
- No more "🎵 ..." caption text
|
||||
Reference in New Issue
Block a user