Skip to content

Commit

Permalink
fix download bug
Browse files Browse the repository at this point in the history
  • Loading branch information
aza547 committed Aug 21, 2024
1 parent 2126a70 commit 894b6b3
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 22 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
### Fixed
- [Issue 512](https://github.com/aza547/wow-recorder/issues/512) - Fix a bug where the manager would repeatedly retry configuration if the user got the password wrong.
- Fixed an issue where you could not download a video if the cloud upload setting was disabled.

## [5.7.2] - 2024-08-04
### Fixed
Expand Down
8 changes: 1 addition & 7 deletions src/main/Manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,6 @@ export default class Manager {

const {
cloudStorage,
cloudUpload,
cloudAccountName,
cloudAccountPassword,
cloudGuildName,
Expand All @@ -530,12 +529,7 @@ export default class Manager {

this.cloudClient.pollInit();
this.cloudClient.pollForUpdates(10);

if (cloudUpload) {
// The video process queue only needs the cloud client for uploads, so
// we only need to set this if we're configured to upload.
this.videoProcessQueue.setCloudClient(this.cloudClient);
}
this.videoProcessQueue.setCloudClient(this.cloudClient);
}

this.refreshCloudStatus();
Expand Down
21 changes: 8 additions & 13 deletions src/main/VideoProcessQueue.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { BrowserWindow } from 'electron';
import path from 'path';
import assert from 'assert';
import { allowUploadCategory } from '../utils/configUtils';
import { shouldUpload } from '../utils/configUtils';
import DiskSizeMonitor from '../storage/DiskSizeMonitor';
import ConfigService from './ConfigService';
import {
Expand Down Expand Up @@ -157,7 +157,6 @@ export default class VideoProcessQueue {
*/
public unsetCloudClient() {
this.cloudClient = undefined;
this.cfg.get<string>('storagePath');
}

/**
Expand Down Expand Up @@ -221,16 +220,12 @@ export default class VideoProcessQueue {
await tryUnlink(data.source);
}

if (this.cloudClient !== undefined) {
const allowUpload = allowUploadCategory(this.cfg, data.metadata);
if (this.cloudClient && shouldUpload(this.cfg, data.metadata)) {
const item: UploadQueueItem = {
path: videoPath,
};

if (allowUpload) {
const item: UploadQueueItem = {
path: videoPath,
};

this.queueUpload(item);
}
this.queueUpload(item);
}
} catch (error) {
console.error(
Expand Down Expand Up @@ -290,7 +285,7 @@ export default class VideoProcessQueue {
};

if (cloudMetadata.level) {
// The string "level" isn't a valid column name, in new videos we
// The string "level" isn't a valid SQL column name, in new videos we
// use the keystoneLevel entry in the metadata, but if we're uploading
// an old video correct it here at the point of upload.
cloudMetadata.keystoneLevel = cloudMetadata.level;
Expand Down Expand Up @@ -475,7 +470,7 @@ export default class VideoProcessQueue {
private async uploadQueueEmpty() {
console.info('[VideoProcessQueue] Upload processing queue empty');

if (this.cloudClient === undefined) {
if (!this.cloudClient) {
return;
}

Expand Down
11 changes: 9 additions & 2 deletions src/utils/configUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,16 @@ const allowRecordCategory = (cfg: ConfigService, category: VideoCategory) => {
return true;
};

const allowUploadCategory = (cfg: ConfigService, metadata: Metadata) => {
const shouldUpload = (cfg: ConfigService, metadata: Metadata) => {
const { category } = metadata;

const upload = cfg.get<boolean>('cloudUpload');

if (!upload) {
console.info('[configUtils] Cloud upload is disabled');
return false;
}

if (category === VideoCategory.Clips) {
console.info('[configUtils] Clips are always uploaded');
return true;
Expand Down Expand Up @@ -195,7 +202,7 @@ const getOverlayConfig = (cfg: ConfigService): ObsOverlayConfig => {
// eslint-disable-next-line import/prefer-default-export
export {
allowRecordCategory,
allowUploadCategory,
shouldUpload,
getObsBaseConfig,
getObsVideoConfig,
getObsAudioConfig,
Expand Down

0 comments on commit 894b6b3

Please sign in to comment.