diff --git a/docker-compose.yml b/docker-compose.yml index ac3e4aa..8b3e03d 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,8 +11,10 @@ services: LETSENCRYPT_HOST: "${DOMAIN}" PUID: "${PUID}" PGID: "${PGID}" + volumes: + - "${MEDIA_DIR}:/app/media" networks: default: name: dockerweb - external: true + external: true \ No newline at end of file diff --git a/server/api/playlists.ts b/server/api/playlists.ts new file mode 100644 index 0000000..e3e5497 --- /dev/null +++ b/server/api/playlists.ts @@ -0,0 +1,21 @@ +import fs from 'fs' +import path from 'path' + +export default eventHandler(async (event) => { + const directoryPath = path.join(process.cwd(), '/app/media/files/music') // replace 'your-folder' with the folder you want to list + + try { + // Read the directory contents + const files = await fs.promises.readdir(directoryPath) + + return { + success: true, + files: files.filter(file => !file.startsWith('.')) // optional: exclude unwanted files + } + } catch (error) { + return { + success: false, + error: error.message + } + } +})