File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ export class EngineDB_1_6 extends EngineDB {
9595 trackId : track . id ,
9696 trackIdInOriginDatabase : track . id ,
9797 trackNumber : i + 1 ,
98- databaseUuid : this . databaseUuid ,
98+ databaseUuid : this . uuid ,
9999 } ) ) ,
100100 ) ;
101101 }
@@ -107,7 +107,11 @@ export class EngineDB_1_6 extends EngineDB {
107107 async getTracks ( ) : Promise < publicSchema . Track [ ] > {
108108 const tracks = await this . getTracksInternal ( ) ;
109109
110- return tracks . map ( track => ( { ...track , ...track . meta } ) ) ;
110+ return tracks . map ( track => ( {
111+ ...track ,
112+ ...track . meta ,
113+ isBeatGridLocked : ! ! track . isBeatGridLocked ,
114+ } ) ) ;
111115 }
112116
113117 private async getTracksInternal ( ) : Promise < schema . TrackWithMeta [ ] > {
@@ -124,7 +128,8 @@ export class EngineDB_1_6 extends EngineDB {
124128 'trackType' ,
125129 'year' ,
126130 ] )
127- . whereNotNull ( 'path' ) ;
131+ . whereNotNull ( 'path' )
132+ . andWhere ( 'isExternalTrack' , 0 ) ;
128133 const textMetas = await this . table ( 'MetaData' ) . select ( '*' ) ;
129134 const textMetaMap = groupBy ( textMetas , x => x . id ) ;
130135 const intMetas = await this . table ( 'MetaDataInteger' ) . select ( '*' ) ;
Original file line number Diff line number Diff line change @@ -71,8 +71,8 @@ export interface Track {
7171 bitrate : number ;
7272 bpmAnalyzed : number ;
7373 filename : string ;
74- isBeatGridLocked : boolean ;
75- isExternalTrack : boolean ;
74+ isBeatGridLocked : IntBoolean ;
75+ isExternalTrack : IntBoolean ;
7676 length : number ;
7777 path : string ;
7878 trackType : TrackType ;
Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ export class EngineDB_2_0 extends EngineDB {
107107 ? 0
108108 : lastEntityId + 2 + i ,
109109 membershipReference : 0 ,
110- databaseUuid : this . databaseUuid ,
110+ databaseUuid : this . uuid ,
111111 } ) ) ,
112112 ) ;
113113 }
@@ -150,7 +150,8 @@ export class EngineDB_2_0 extends EngineDB {
150150 'title' ,
151151 'year' ,
152152 ] )
153- . whereNotNull ( 'path' ) ;
153+ . whereNotNull ( 'path' )
154+ . andWhere ( 'originDatabaseUuid' , this . uuid ) ;
154155 }
155156
156157 async updateTrackPaths ( tracks : publicSchema . Track [ ] ) {
Original file line number Diff line number Diff line change @@ -8,10 +8,14 @@ import { EngineVersion } from './version-detection';
88export abstract class EngineDB {
99 protected readonly knex : Knex ;
1010
11- protected databaseUuid ! : string ;
11+ protected schemaInfo ! : schema . Information ;
1212
1313 abstract get version ( ) : EngineVersion ;
1414
15+ get uuid ( ) : string {
16+ return this . schemaInfo . uuid ;
17+ }
18+
1519 protected constructor ( private readonly dbPath : string ) {
1620 this . knex = knex ( {
1721 client : 'sqlite3' ,
@@ -22,9 +26,7 @@ export abstract class EngineDB {
2226
2327 protected async init ( ) {
2428 await this . backup ( ) ;
25- const { uuid } = await this . getSchemaInfo ( ) ;
26-
27- this . databaseUuid = uuid ;
29+ this . schemaInfo = await this . getSchemaInfo ( ) ;
2830 }
2931
3032 async disconnect ( ) {
You can’t perform that action at this time.
0 commit comments