feat: v1.1.0 - Major UI/UX improvements and new features
- Remove confirmation dialogs for song deletion (faster workflow) - Add bulk playlist creation from YouTube playlist URLs - Display playlist tags on song cards in home page - Enable moving songs between playlists - Fix mobile UI: action buttons now appear above player bar - Add bulk song selection and deletion from home page - Improve loading states and user feedback - Update documentation and CI/CD workflow - Fix all toast messages to English
This commit is contained in:
1 parent
84ae14bfb5
commit
706d808b83
10 files changed
+1604
-245
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import { NextRequest, NextResponse } from 'next/server'
|
||||
import { db } from '@/lib/db'
|
||||
import { getYoutubePlaylistMetadata } from '@/lib/ytdlp'
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
@@ -26,7 +27,7 @@ export async function GET() {
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
try {
|
||||
const { name } = await request.json()
|
||||
const { name, youtubeUrl } = await request.json()
|
||||
|
||||
if (!name) {
|
||||
return NextResponse.json(
|
||||
@@ -36,9 +37,58 @@ export async function POST(request: NextRequest) {
|
||||
}
|
||||
|
||||
const playlist = db.createPlaylist(name)
|
||||
let addedSongs = 0
|
||||
|
||||
// If YouTube URL is provided, fetch and add songs from the playlist
|
||||
if (youtubeUrl) {
|
||||
try {
|
||||
console.log('[API] Fetching YouTube playlist:', youtubeUrl)
|
||||
const playlistSongs = await getYoutubePlaylistMetadata(youtubeUrl)
|
||||
|
||||
for (const songData of playlistSongs) {
|
||||
try {
|
||||
// Check if song already exists
|
||||
let song = db.getSongByYoutubeId(songData.id)
|
||||
|
||||
if (!song) {
|
||||
// Create new song
|
||||
song = db.createSong({
|
||||
youtubeId: songData.id,
|
||||
title: songData.title,
|
||||
channelName: songData.channel,
|
||||
thumbnail: songData.thumbnail,
|
||||
duration: songData.duration,
|
||||
})
|
||||
console.log('[API] Created song:', song.id)
|
||||
}
|
||||
|
||||
// Add song to playlist
|
||||
const playlistSong = db.addSongToPlaylist(playlist.id, song.id)
|
||||
if (playlistSong) {
|
||||
addedSongs++
|
||||
console.log('[API] Added song to playlist:', playlistSong.id)
|
||||
}
|
||||
} catch (songError) {
|
||||
console.error('[API] Error adding song to playlist:', songError)
|
||||
// Continue with other songs
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`[API] Added ${addedSongs} songs to playlist`)
|
||||
} catch (playlistError) {
|
||||
console.error('[API] Error fetching YouTube playlist:', playlistError)
|
||||
// Don't fail the entire request, just log the error
|
||||
}
|
||||
}
|
||||
|
||||
console.log('[API] Playlist created:', playlist.id)
|
||||
return NextResponse.json(playlist)
|
||||
return NextResponse.json({
|
||||
playlist: {
|
||||
...playlist,
|
||||
playlistSongs: addedSongs > 0 ? db.getPlaylistSongs(playlist.id) : []
|
||||
},
|
||||
addedSongs
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('[API] Error creating playlist:', error)
|
||||
return NextResponse.json(
|
||||
|
||||
Reference in new issue
Block a user