Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

videory

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

videory - npm Package Compare versions

Comparing version 0.4.0-pre.2 to 0.4.0-pre.3

32

db.js

@@ -1,2 +0,2 @@

import {JSONFile, Low} from "lowdb"
import {JSONFile, Memory, Low} from "lowdb"
import log from 'log';

@@ -11,7 +11,4 @@ import assert from "assert"

const __dirname = dirname(fileURLToPath(import.meta.url));
const file = join(__dirname, 'videory.db.json')
const adapter = new JSONFile(file)
const db = new Low(adapter);
let db;

@@ -22,3 +19,24 @@ /**

*/
export const init = async () => {
export const initializeDb = async (inMemory) => {
let adapter;
if (inMemory) {
// use memory db
adapter = new Memory()
debug.notice(`Using memory database`)
} else {
// use json database on fs
const __dirname = dirname(fileURLToPath(import.meta.url));
const file = join(__dirname, 'videory.db.json')
adapter = new JSONFile(file)
debug.notice(`Using database on filesystem path ${file}`)
}
// initialize db
db = new Low(adapter);
// init movies table

@@ -69,3 +87,3 @@ await db.read()

const i = db.data.videos.findIndex(v => v.hash === video.hash && v.path === video.path)
const i = db.data.videos.findIndex(v => v.hash === video.hash && v.path === video.path)
db.data.videos[i] = video

@@ -72,0 +90,0 @@

@@ -6,3 +6,3 @@ import dotenv from "dotenv"

import {schedule} from "./transcode.js"
import {removeStalledTranscodings, init} from "./db.js"
import {removeStalledTranscodings, initializeDb} from "./db.js"
import logNode from"log-node";

@@ -22,2 +22,3 @@ logNode();

.option("allow-versions", "creates a file version if output file does already exist")
.option("memory", "Uses in-memory database instead of a filesystem file")
;

@@ -28,2 +29,3 @@

const d_out = flags.o || d_in;
const inMemoryDb = flags.m

@@ -42,3 +44,3 @@ if (!d_in) {

//init sqlite
await init()
await initializeDb(inMemoryDb)
.catch(logAndExit(1));

@@ -45,0 +47,0 @@

{
"name": "videory",
"version": "0.4.0-pre.2",
"version": "0.4.0-pre.3",
"description": "CLI for transcoding videos",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -11,3 +11,4 @@ # Videory

- `-i`, `--in` - directory to transcode videos from
- `-o`, `--out` - director< to transcode videos to
- `-o`, `--out` - directory to transcode videos to
- `-m`, `--memory` - use in-memory database (defaults to videory.db.json on filesystem)

@@ -17,3 +18,3 @@ #Errors

|---|---|
|1|Coldn't initilaize database|
|1|Coldn't initialize database|
|2|Failed while initial files query|

@@ -20,0 +21,0 @@ |3|Error while watching directory|

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc