6 Commits
1.0.0 ... 1.0.3

Author SHA1 Message Date
René Preuß
df803afe2b Some ffmpeg fail to return progress
https://stackoverflow.com/a/70899710
2023-03-03 18:36:17 +01:00
René Preuß
2644c30bf2 Add @ffmpeg-installer/ffmpeg 2023-03-03 15:06:41 +01:00
René Preuß
036f20ac63 Add missing field 2023-03-02 17:10:25 +01:00
René Preuß
3ac8430a0f Change premium field 2023-03-02 17:07:22 +01:00
René Preuß
961be44480 Fix if credentials is empty 2023-03-02 17:03:36 +01:00
René Preuß
9b3961f5f0 Updater test 2023-03-01 19:28:23 +01:00
6 changed files with 20 additions and 8 deletions

View File

@@ -3,8 +3,6 @@ import {EncoderListeners, EncoderOptions, Settings, User, Video} from "../../sha
import * as fs from "fs"; import * as fs from "fs";
import axios, {AxiosInstance} from "axios"; import axios, {AxiosInstance} from "axios";
const ffmpeg = require('fluent-ffmpeg')
export class Encoder { export class Encoder {
private readonly id: string; private readonly id: string;
private readonly input: string; private readonly input: string;
@@ -42,15 +40,25 @@ export class Encoder {
async encode(): Promise<void> { async encode(): Promise<void> {
this.listeners.onStart(this.id) this.listeners.onStart(this.id)
const ffmpegPath = require('@ffmpeg-installer/ffmpeg').path
console.log('ffmpegPath', ffmpegPath)
const ffmpeg = require('fluent-ffmpeg')
ffmpeg.setFfmpegPath(ffmpegPath)
let totalTime = 0;
ffmpeg(this.input) ffmpeg(this.input)
.outputOptions(this.getOutputOptions()) .outputOptions(this.getOutputOptions())
.output(this.output) .output(this.output)
.on('start', () => { .on('start', () => {
console.log('start') console.log('start')
}) })
.on('progress', (progress) => { .on('codecData', data => {
console.log('progress', progress) totalTime = parseInt(data.duration.replace(/:/g, ''))
this.listeners.onProgress(this.id, progress.percent) })
.on('progress', progress => {
const time = parseInt(progress.timemark.replace(/:/g, ''))
const percent = (time / totalTime) * 100
console.log('progress', percent)
this.listeners.onProgress(this.id, percent)
}) })
.on('end', async () => { .on('end', async () => {
console.log('end') console.log('end')

View File

@@ -89,6 +89,7 @@ export class InternalServer {
name: response.data.name, name: response.data.name,
config: response.data.config, config: response.data.config,
avatar_url: response.data.avatar_url, avatar_url: response.data.avatar_url,
premium: response.data.premium,
} }
} }

View File

@@ -4,7 +4,7 @@ import * as fs from 'fs'
import {Credentials, Settings} from "../../shared/schema"; import {Credentials, Settings} from "../../shared/schema";
const defaults: Settings = { const defaults: Settings = {
version: '1.0.0', version: '1.0.1',
credentials: null, credentials: null,
endpoint: 'https://api.rerunmanager.com/v1/', endpoint: 'https://api.rerunmanager.com/v1/',
} }

View File

@@ -2,7 +2,7 @@
"name": "rerun-encoder", "name": "rerun-encoder",
"private": true, "private": true,
"productName": "Rerun Encoder", "productName": "Rerun Encoder",
"version": "1.0.0", "version": "1.0.3",
"description": "Official Rerun Encoder App for Rerun Manager", "description": "Official Rerun Encoder App for Rerun Manager",
"main": "dist-electron/main/index.js", "main": "dist-electron/main/index.js",
"scripts": { "scripts": {
@@ -57,6 +57,7 @@
"vue-tsc": "^1.1.7" "vue-tsc": "^1.1.7"
}, },
"dependencies": { "dependencies": {
"@ffmpeg-installer/ffmpeg": "^1.1.0",
"@koa/cors": "^4.0.0", "@koa/cors": "^4.0.0",
"axios": "^1.3.4", "axios": "^1.3.4",
"cors": "^2.8.5", "cors": "^2.8.5",

1
shared/schema.d.ts vendored
View File

@@ -5,6 +5,7 @@ export interface User {
id: string id: string
name: string name: string
avatar_url: string avatar_url: string
premium: boolean
config: { config: {
storage_limit: number storage_limit: number
videos_limit: number videos_limit: number

View File

@@ -109,8 +109,9 @@ const logout = () => {
const storageUpgradeRequired = computed(() => { const storageUpgradeRequired = computed(() => {
if (!settings.value) return false if (!settings.value) return false
if (!settings.value.credentials) return false
// @ts-ignore // @ts-ignore
return !settings.value.credentials.user.config.premium return !settings.value.credentials.user.premium
}) })
onMounted(() => { onMounted(() => {