mirror of
https://github.com/leinelissen/jellyfin-audio-player.git
synced 2026-09-02 21:03:11 +03:00
Address code review feedback - fix imports and error handling
Co-authored-by: leinelissen <10154841+leinelissen@users.noreply.github.com>
This commit is contained in:
co-authored by
leinelissen
parent
7c10aceb44
commit
a087469725
@@ -1,5 +1,5 @@
|
||||
import { sqliteTable, text, integer, index } from 'drizzle-orm/sqlite-core';
|
||||
import { sources } from './sources';
|
||||
import { sources } from '../db/schema/sources';
|
||||
|
||||
/**
|
||||
* Albums table
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { sqliteTable, text, integer, index } from 'drizzle-orm/sqlite-core';
|
||||
import { sources } from './sources';
|
||||
import { sources } from '../db/schema/sources';
|
||||
|
||||
/**
|
||||
* Artists table
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { sqliteTable, text, integer, index, primaryKey } from 'drizzle-orm/sqlite-core';
|
||||
import { sources } from './sources';
|
||||
import { sources } from '../db/schema/sources';
|
||||
|
||||
/**
|
||||
* Album-Artists relation table (many-to-many)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { sqliteTable, text, primaryKey } from 'drizzle-orm/sqlite-core';
|
||||
import { sources } from './sources';
|
||||
import { sources } from '../db/schema/sources';
|
||||
|
||||
/**
|
||||
* Album-Similar relation table (for similar albums)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { sqliteTable, text, integer, index } from 'drizzle-orm/sqlite-core';
|
||||
import { sources } from './sources';
|
||||
import { sources } from '../db/schema/sources';
|
||||
|
||||
/**
|
||||
* Albums table
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { sqliteTable, text, integer, index } from 'drizzle-orm/sqlite-core';
|
||||
import { sources } from './sources';
|
||||
import { sources } from '../db/schema/sources';
|
||||
|
||||
/**
|
||||
* Artists table
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { sqliteTable, text, integer } from 'drizzle-orm/sqlite-core';
|
||||
import { sources } from './sources';
|
||||
import { sources } from '../db/schema/sources';
|
||||
|
||||
/**
|
||||
* Downloads table
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { sqliteTable, text, integer, index, primaryKey } from 'drizzle-orm/sqlite-core';
|
||||
import { sources } from './sources';
|
||||
import { sources } from '../db/schema/sources';
|
||||
|
||||
/**
|
||||
* Playlist-Tracks relation table (many-to-many with position)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { sqliteTable, text, integer, index } from 'drizzle-orm/sqlite-core';
|
||||
import { sources } from './sources';
|
||||
import { sources } from '../db/schema/sources';
|
||||
|
||||
/**
|
||||
* Playlists table
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { sqliteTable, text, integer, index } from 'drizzle-orm/sqlite-core';
|
||||
import { sources } from './sources';
|
||||
import { sources } from '../db/schema/sources';
|
||||
|
||||
/**
|
||||
* Search queries table
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { sqliteTable, text, integer, primaryKey } from 'drizzle-orm/sqlite-core';
|
||||
import { sources } from './sources';
|
||||
import { sources } from '../db/schema/sources';
|
||||
|
||||
/**
|
||||
* Sync cursors table - tracks prefill progress
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { sqliteTable, text, integer, index, primaryKey } from 'drizzle-orm/sqlite-core';
|
||||
import { sources } from './sources';
|
||||
import { sources } from '../db/schema/sources';
|
||||
|
||||
/**
|
||||
* Track-Artists relation table (many-to-many)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { sqliteTable, text, integer, index } from 'drizzle-orm/sqlite-core';
|
||||
import { sources } from './sources';
|
||||
import { sources } from '../db/schema/sources';
|
||||
|
||||
/**
|
||||
* Tracks table
|
||||
|
||||
@@ -33,7 +33,7 @@ export async function initializeDownload(
|
||||
hash: hash || null,
|
||||
filename: filename || null,
|
||||
mimetype: mimetype || null,
|
||||
progress: 0,
|
||||
progress: null,
|
||||
isFailed: false,
|
||||
isComplete: false,
|
||||
metadataJson: null,
|
||||
@@ -45,7 +45,7 @@ export async function initializeDownload(
|
||||
hash: hash || null,
|
||||
filename: filename || null,
|
||||
mimetype: mimetype || null,
|
||||
progress: 0,
|
||||
progress: null,
|
||||
isFailed: false,
|
||||
isComplete: false,
|
||||
updatedAt: now,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { sqliteTable, text, integer } from 'drizzle-orm/sqlite-core';
|
||||
import { sources } from './sources';
|
||||
import { sources } from '../db/schema/sources';
|
||||
|
||||
/**
|
||||
* Downloads table
|
||||
|
||||
@@ -45,7 +45,13 @@ export async function downloadTrack(trackId: string): Promise<void> {
|
||||
}
|
||||
|
||||
// Parse metadata if needed for image URL
|
||||
const metadata = track.metadataJson ? JSON.parse(track.metadataJson as string) : {};
|
||||
let metadata: any = {};
|
||||
try {
|
||||
metadata = track.metadataJson ? JSON.parse(track.metadataJson as string) : {};
|
||||
} catch (error) {
|
||||
console.warn('Failed to parse track metadata:', error);
|
||||
}
|
||||
|
||||
const trackWithMetadata = { ...track, ...metadata };
|
||||
|
||||
const audioUrl = generateTrackUrl(trackId);
|
||||
|
||||
@@ -17,6 +17,9 @@ const persistConfig: PersistConfig<Omit<AppState, '_persist'>> = {
|
||||
migrate: createMigrate({
|
||||
// @ts-expect-error migrations are poorly typed
|
||||
6: (state: AppState & PersistState) => {
|
||||
// Migration v6: Remove music and downloads from Redux
|
||||
// These are now database-backed only. Intentionally discarding
|
||||
// old Redux state as data is persisted in SQLite database.
|
||||
return {
|
||||
settings: state.settings,
|
||||
sleepTimer: state.sleepTimer,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { sqliteTable, text, integer, index } from 'drizzle-orm/sqlite-core';
|
||||
import { sources } from './sources';
|
||||
import { sources } from '../db/schema/sources';
|
||||
|
||||
/**
|
||||
* Playlists table
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { sqliteTable, text, integer, index } from 'drizzle-orm/sqlite-core';
|
||||
import { sources } from './sources';
|
||||
import { sources } from '../db/schema/sources';
|
||||
|
||||
/**
|
||||
* Search queries table
|
||||
|
||||
@@ -4,7 +4,7 @@ import { sqliteTable, integer } from 'drizzle-orm/sqlite-core';
|
||||
* Sleep timer - global sleep timer settings (single row, id=1)
|
||||
*/
|
||||
export const sleepTimer = sqliteTable('sleep_timer', {
|
||||
id: integer('id').primaryKey().$default(() => 1),
|
||||
id: integer('id').primaryKey(),
|
||||
date: integer('date'), // nullable - epoch ms
|
||||
createdAt: integer('created_at').notNull(),
|
||||
updatedAt: integer('updated_at').notNull(),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { sqliteTable, text, integer, index } from 'drizzle-orm/sqlite-core';
|
||||
import { sources } from './sources';
|
||||
import { sources } from '../db/schema/sources';
|
||||
|
||||
/**
|
||||
* Tracks table
|
||||
|
||||
Reference in New Issue
Block a user