Skip to content

Commit

Permalink
Fix quickstart and mpb initalizing on headless
Browse files Browse the repository at this point in the history
  • Loading branch information
Inrixia committed Apr 5, 2024
1 parent 0783880 commit 341fe8e
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ COPY --from=build ${HOME}/package.json package.json

# Environment variables
ENV headless=true
ENV runQuickstartPrompts=false

# Define volumes to be mountable
VOLUME /fp/db
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "floatplane-plex-downloader",
"version": "5.12.1",
"version": "5.12.2",
"private": true,
"type": "module",
"scripts": {
Expand Down
7 changes: 5 additions & 2 deletions src/float.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,12 @@ process.on("SIGTERM", process.exit);
process.exit();
}

await fetchFFMPEG();
// Earlybird functions, these are run before script start and not run again if script repeating is enabled.
if (settings.runQuickstartPrompts) await quickStart();
await fetchFFMPEG();
if (settings.runQuickstartPrompts) {
if (args.headless) console.log("headless is set to true! Skipping quickstart prompts.");
else await quickStart();
}
settings.runQuickstartPrompts = false;

// Get Plex details if not saved
Expand Down
2 changes: 1 addition & 1 deletion src/lib/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import "dotenv/config";
import json5 from "json5";
const { parse } = json5;

export const DownloaderVersion = "5.12.1";
export const DownloaderVersion = "5.12.2";

import type { PartialArgs, Settings } from "../types.js";

Expand Down
6 changes: 5 additions & 1 deletion src/lib/logging/ProgressBars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ import { MultiProgressBars } from "multi-progress-bars";
import { ProgressLogger, type IProgressLogger } from "./ProgressLogger.js";
import type { Progress } from "got";
import chalk from "chalk-template";
import { args } from "../helpers/index.js";

export class ProgressBars extends ProgressLogger implements IProgressLogger {
private static readonly _Bars: MultiProgressBars = new MultiProgressBars({ initMessage: "", anchor: "bottom" });
// Ensure that MultiProgressBars is never instantiated if headless
private static readonly _Bars: MultiProgressBars = args.headless
? <MultiProgressBars>(<unknown>null)
: new MultiProgressBars({ initMessage: "", anchor: "bottom" });

public static TotalBytes = 0;
public static DownloadedBytes = 0;
Expand Down

0 comments on commit 341fe8e

Please sign in to comment.