add episodes/podcasts to spotify, fix soundcloud bugs

This commit is contained in:
aria
2024-07-17 04:12:16 -04:00
parent 25f7babb3e
commit 12a04b2a7b
8 changed files with 217 additions and 32 deletions

View File

@@ -1,4 +1,4 @@
import { ItemType, GetByUrlResponse, SearchResults, Streamer, StreamerWithLogin } from './types.js'
import { ItemType, GetByUrlResponse, SearchResults, Streamer, StreamerWithLogin, StreamerAccount } from './types.js'
interface LucidaOptions {
modules: { [key: string]: Streamer | StreamerWithLogin }
@@ -38,6 +38,16 @@ class Lucida {
const moduleNames = Object.keys(this.modules)
return Object.fromEntries(results.map((e, i) => [moduleNames[i], e]))
}
async checkAccounts(): Promise<{ [key: string]: StreamerAccount }> {
const results = await Promise.all(
Object.values(this.modules).map(async (e) => {
if (e.getAccountInfo) return (await e.getAccountInfo())
else return {valid: false}
})
)
const moduleNames = Object.keys(this.modules)
return Object.fromEntries(results.map((e, i) => [moduleNames[i], e]))
}
async getTypeFromUrl(url: string): Promise<ItemType> {
const urlObj = new URL(url)
for (const i in this.modules) {