Working on ytmusic parsers
This commit is contained in:
@@ -13,7 +13,8 @@ export const GET: RequestHandler = async ({ params }) => {
|
||||
connection.service = await Jellyfin.fetchSerivceInfo(connection.service.userId, connection.service.urlOrigin, connection.tokens.accessToken)
|
||||
break
|
||||
case 'youtube-music':
|
||||
connection.service = await YouTubeMusic.fetchServiceInfo(connection.service.userId, connection.tokens.accessToken)
|
||||
const youTubeMusic = new YouTubeMusic(connection)
|
||||
connection.service = await youTubeMusic.fetchServiceInfo()
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,8 @@ export const GET: RequestHandler = async ({ params, fetch }) => {
|
||||
for (const song of mostPlayedData.Items) recommendations.push(Jellyfin.songFactory(song, connection))
|
||||
break
|
||||
case 'youtube-music':
|
||||
YouTubeMusic.getHome(tokens.accessToken)
|
||||
const youtubeMusic = new YouTubeMusic(connection)
|
||||
youtubeMusic.getHome()
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,11 +43,7 @@ export const actions: Actions = {
|
||||
return fail(400, { message: 'Could not reach Jellyfin server' })
|
||||
}
|
||||
|
||||
const newConnectionId = Connections.addConnection('jellyfin', {
|
||||
userId: locals.user.id,
|
||||
service: { userId: authData.User.Id, urlOrigin: serverUrl.toString() },
|
||||
tokens: { accessToken: authData.AccessToken },
|
||||
})
|
||||
const newConnectionId = Connections.addConnection('jellyfin', locals.user.id, { userId: authData.User.Id, urlOrigin: serverUrl.toString() }, { accessToken: authData.AccessToken })
|
||||
|
||||
const response = await fetch(`/api/connections?ids=${newConnectionId}`, {
|
||||
method: 'GET',
|
||||
@@ -68,11 +64,12 @@ export const actions: Actions = {
|
||||
const userChannelResponse = await youtube.channels.list({ mine: true, part: ['id', 'snippet'], access_token: tokens.access_token! })
|
||||
const userChannel = userChannelResponse.data.items![0]
|
||||
|
||||
const newConnectionId = Connections.addConnection('youtube-music', {
|
||||
userId: locals.user.id,
|
||||
service: { userId: userChannel.id! },
|
||||
tokens: { accessToken: tokens.access_token!, refreshToken: tokens.refresh_token!, expiry: tokens.expiry_date! },
|
||||
})
|
||||
const newConnectionId = Connections.addConnection(
|
||||
'youtube-music',
|
||||
locals.user.id,
|
||||
{ userId: userChannel.id! },
|
||||
{ accessToken: tokens.access_token!, refreshToken: tokens.refresh_token!, expiry: tokens.expiry_date! },
|
||||
)
|
||||
|
||||
const response = await fetch(`/api/connections?ids=${newConnectionId}`, {
|
||||
method: 'GET',
|
||||
|
||||
Reference in New Issue
Block a user