mirror of
https://github.com/janishutz/MusicPlayerV2.git
synced 2025-11-25 04:54:23 +00:00
Fix remotes
This commit is contained in:
@@ -424,21 +424,16 @@
|
|||||||
|
|
||||||
const fetchSongData = ( songDetails: ReadFile ): Promise<Song> => {
|
const fetchSongData = ( songDetails: ReadFile ): Promise<Song> => {
|
||||||
return new Promise( ( resolve, reject ) => {
|
return new Promise( ( resolve, reject ) => {
|
||||||
console.info( 'Loading song', songDetails.filename );
|
|
||||||
fetch( songDetails.url )
|
fetch( songDetails.url )
|
||||||
.then( res => {
|
.then( res => {
|
||||||
if ( res.status === 200 ) {
|
if ( res.status === 200 ) {
|
||||||
res.blob().then( blob => {
|
res.blob().then( blob => {
|
||||||
console.info( 'Song loaded for processing' );
|
|
||||||
parseBlob( blob )
|
parseBlob( blob )
|
||||||
.then( data => {
|
.then( data => {
|
||||||
console.info( 'Song metadata processing successful' );
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
player.findSongOnAppleMusic( data.common.title
|
player.findSongOnAppleMusic( data.common.title
|
||||||
?? songDetails.filename.split( '.' )[ 0 ] )
|
?? songDetails.filename.split( '.' )[ 0 ] )
|
||||||
.then( d => {
|
.then( d => {
|
||||||
console.info( 'Apple Music API lookup successful' );
|
|
||||||
let url = d.data.results.songs.data[ 0 ].attributes.artwork.url;
|
let url = d.data.results.songs.data[ 0 ].attributes.artwork.url;
|
||||||
|
|
||||||
url = url.replace( '{w}', String( d.data.results.songs.data[ 0 ].attributes.artwork.width ) );
|
url = url.replace( '{w}', String( d.data.results.songs.data[ 0 ].attributes.artwork.width ) );
|
||||||
@@ -455,7 +450,6 @@
|
|||||||
resolve( song );
|
resolve( song );
|
||||||
} )
|
} )
|
||||||
.catch( e => {
|
.catch( e => {
|
||||||
console.info( 'Apple Music API failed' );
|
|
||||||
console.error( e );
|
console.error( e );
|
||||||
const song: Song = {
|
const song: Song = {
|
||||||
'artist': data.common.artist ?? 'Unknown artist',
|
'artist': data.common.artist ?? 'Unknown artist',
|
||||||
|
|||||||
@@ -130,6 +130,7 @@ const useSSE = (
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
app.options( '/socket/update', cors( corsOpts ) );
|
||||||
app.post(
|
app.post(
|
||||||
'/socket/update',
|
'/socket/update',
|
||||||
cors( corsOpts ),
|
cors( corsOpts ),
|
||||||
@@ -209,6 +210,7 @@ const useSSE = (
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
app.options( '/socket/deleteRoom', cors( corsOpts ) );
|
||||||
app.post(
|
app.post(
|
||||||
'/socket/deleteRoom',
|
'/socket/deleteRoom',
|
||||||
cors( corsOpts ),
|
cors( corsOpts ),
|
||||||
|
|||||||
Reference in New Issue
Block a user