Skip to content

Commit b6b0748

Browse files
committed
Fix dash downloading
1 parent a2be340 commit b6b0748

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

js/api.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1644,7 +1644,11 @@ export class LosslessAPI {
16441644
candidate?.album?.numberOfTracks == null;
16451645

16461646
let track = typeof input === 'object' ? this.prepareTrack(input) : await this.getTrack(id, downloadQuality);
1647-
if (typeof input === 'object' && !track?.type?.toLowerCase?.().includes('video') && hasMissingDownloadMetadata(track)) {
1647+
if (
1648+
typeof input === 'object' &&
1649+
!track?.type?.toLowerCase?.().includes('video') &&
1650+
hasMissingDownloadMetadata(track)
1651+
) {
16481652
try {
16491653
const fullTrack = await this.getTrackMetadata(id);
16501654
track = this.prepareTrack({
@@ -1823,7 +1827,7 @@ export class LosslessAPI {
18231827
if (streamUrl.startsWith('blob:')) {
18241828
try {
18251829
const downloader = new DashDownloader();
1826-
blob = await downloader.downloadDashStream(getProxyUrl(streamUrl), {
1830+
blob = await downloader.downloadDashStream(streamUrl, {
18271831
signal: options.signal,
18281832
onProgress,
18291833
calculateDashBytes: calculateDashBytes ?? true,

js/dash-downloader.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { AbortError } from './errorTypes';
22
import { SegmentedDownloadProgress } from './progressEvents';
3+
import { getProxyUrl } from './proxy-utils';
34

45
export interface DashDownloadOptions {
56
onProgress?: MonochromeProgressListener<SegmentedDownloadProgress>;

js/downloads.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,11 @@ async function bulkDownload({
376376
updateBulkDownloadProgress(notification, i, tracks.length, trackTitle);
377377

378378
try {
379-
const { blob, extension, track: enrichedTrack } = await downloadTrackBlob(track, quality, api, signal, (p) => {
379+
const {
380+
blob,
381+
extension,
382+
track: enrichedTrack,
383+
} = await downloadTrackBlob(track, quality, api, signal, (p) => {
380384
if (p instanceof DownloadProgress && p.totalBytes && p.receivedBytes) {
381385
fileFraction = p.receivedBytes / p.totalBytes;
382386
} else if (p instanceof SegmentedDownloadProgress && p.currentSegment && p.totalSegments) {

0 commit comments

Comments
 (0)