Skip to content

Commit fcd71a9

Browse files
committed
fix(web-media): missing clone() function for AudioInfo
1 parent 67cbba2 commit fcd71a9

File tree

5 files changed

+32
-9
lines changed

5 files changed

+32
-9
lines changed

apps/octra/project.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,12 @@
144144
"configurations": {
145145
"production": {
146146
"port": 5321,
147+
"host": "127.0.0.1",
147148
"buildTarget": "octra:build:production"
148149
},
149150
"development": {
150151
"port": 5321,
152+
"host": "127.0.0.1",
151153
"buildTarget": "octra:build:development"
152154
}
153155
},

apps/octra/src/app/app.component.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Component, inject, OnDestroy, OnInit, ViewChild } from '@angular/core';
22
import { ActivatedRoute, Router, RouterOutlet } from '@angular/router';
3+
import { TranslocoPipe } from '@jsverse/transloco';
34
import {
45
OctraComponentsModule,
56
VersionCheckerService,
@@ -11,11 +12,9 @@ import { DefaultComponent } from './core/component/default.component';
1112
import { OctraModalComponent } from './core/modals/octra-modal';
1213
import { MultiThreadingService } from './core/shared/multi-threading/multi-threading.service';
1314
import { AppStorageService } from './core/shared/service/appstorage.service';
15+
import { LoginMode } from './core/store';
1416
import { ApplicationStoreService } from './core/store/application/application-store.service';
1517
import { AnnotationStoreService } from './core/store/login-mode/annotation/annotation.store.service';
16-
import { TranslocoPipe } from '@jsverse/transloco';
17-
import { LoginMode } from './core/store';
18-
import { timer } from 'rxjs';
1918

2019
@Component({
2120
selector: 'octra-app',

libs/web-media/src/lib/audio/audio-info.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,26 @@ export class AudioInfo<F extends object = any> extends FileInfo<F> {
6565
this._bitrate = bitrate;
6666
this._audioBufferInfo = audioBufferInfo;
6767
}
68+
69+
override clone(): AudioInfo<F> {
70+
const result = new AudioInfo<F>(
71+
this.fullname,
72+
this._type,
73+
this._size,
74+
this._sampleRate,
75+
this._duration.samples,
76+
this._channels,
77+
this._bitrate,
78+
this._audioBufferInfo,
79+
);
80+
result._file = this._file;
81+
result._attributes = this._attributes ? { ...this._attributes } as F : undefined;
82+
result._hash = this._hash;
83+
result._url = this._url;
84+
result._online = this._online;
85+
86+
return result;
87+
}
6888
}
6989

7090
/**

libs/web-media/src/lib/data-info/directory-info.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export class DirectoryInfo<
66
A extends object = any,
77
FA extends object = any,
88
> extends DataInfo<A> {
9-
private readonly _path: string;
9+
protected readonly _path: string;
1010

1111
public constructor(path: string, size?: number) {
1212
super(DirectoryInfo.extractFolderName(path)!, 'folder', size);
@@ -17,7 +17,7 @@ export class DirectoryInfo<
1717
return this._path;
1818
}
1919

20-
private _entries: (DirectoryInfo<F, A, FA> | F)[] = [];
20+
protected _entries: (DirectoryInfo<F, A, FA> | F)[] = [];
2121

2222
get entries(): (F | DirectoryInfo<F, A, FA>)[] {
2323
return this._entries;

libs/web-media/src/lib/data-info/file-info.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class FileInfo<F extends object = any> extends DataInfo<F> {
3838
this._url = value;
3939
}
4040

41-
private _online = true;
41+
protected _online = true;
4242

4343
get online(): boolean {
4444
return this._online;
@@ -62,7 +62,7 @@ export class FileInfo<F extends object = any> extends DataInfo<F> {
6262
return this._createdAt;
6363
}
6464

65-
private readonly _createdAt: number = 0;
65+
protected readonly _createdAt: number = 0;
6666

6767
public constructor(
6868
fullname: string,
@@ -225,7 +225,9 @@ export class FileInfo<F extends object = any> extends DataInfo<F> {
225225
}
226226
}
227227

228-
public static fromAny<F extends object>(object: FileInfoSerialized): FileInfo<F> {
228+
public static fromAny<F extends object>(
229+
object: FileInfoSerialized,
230+
): FileInfo<F> {
229231
let file;
230232
if (object.content !== undefined && object.content !== '') {
231233
file = this.getFileFromContent(object.content, object.fullname);
@@ -341,7 +343,7 @@ export class FileInfo<F extends object = any> extends DataInfo<F> {
341343
this._createdAt,
342344
);
343345

344-
result._attributes = {...this._attributes} as F;
346+
result._attributes = this._attributes ? { ...this._attributes } as F : undefined;
345347
result._hash = this._hash;
346348
result._online = this._online;
347349
result._url = this._url;

0 commit comments

Comments
 (0)