add new feature: Mixed local + apple music player

This commit is contained in:
2023-11-20 15:05:25 +01:00
parent dec311cb73
commit e3fbfdd9b7
6 changed files with 876 additions and 6 deletions

View File

@@ -11,6 +11,7 @@ const axios = require( 'axios' );
const ip = require( 'ip' );
const jwt = require( 'jsonwebtoken' );
const shell = require( 'electron' ).shell;
const beautify = require( 'json-beautify' );
app.use( bodyParser.urlencoded( { extended: false } ) );
@@ -232,6 +233,26 @@ app.get( '/indexDirs', ( req, res ) => {
}
} );
app.get( '/loadPlaylist', ( req, res ) => {
res.send( JSON.parse( fs.readFileSync( dialog.showOpenDialogSync( { properties: [ 'openFile' ], title: 'Open file with playlist' } )[ 0 ] ) ) );
} );
app.post( '/savePlaylist', ( req, res ) => {
fs.writeFileSync( dialog.showSaveDialogSync( {
properties: [ 'createDirectory' ],
title: 'Save the playlist as a json file',
filters: [
{
extensions: [ 'json' ],
name: 'JSON files',
}
],
defaultPath: 'songs.json'
} ), beautify( req.body, null, 2, 50 ) );
console.log( req.body );
res.send( 'ok' );
} );
app.get( '/getSongCover', ( req, res ) => {
if ( req.query.filename ) {
if ( indexer.getImages( req.query.filename ) ) {