Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/shotit/shotit-worker/docker-image.yml?branch=main&style=flat-square)](https://github.com/shotit/shotit-worker/actions)
[![GitHub release](https://img.shields.io/github/release/shotit/shotit-worker.svg)](https://github.com/shotit/shotit-worker/releases/latest)
[![Watcher Docker](https://img.shields.io/docker/pulls/shotit/shotit-worker-watcher?style=flat-square)](https://hub.docker.com/r/shotit/shotit-worker-watcher)
[![Watcher Docker Image Size](https://img.shields.io/docker/image-size/shotit/shotit-worker-watcher/v0.9.26?style=flat-square)](https://hub.docker.com/r/shotit/shotit-worker-watcher)
[![Watcher Docker Image Size](https://img.shields.io/docker/image-size/shotit/shotit-worker-watcher/v0.9.27?style=flat-square)](https://hub.docker.com/r/shotit/shotit-worker-watcher)
[![Hasher Docker](https://img.shields.io/docker/pulls/shotit/shotit-worker-hasher?style=flat-square)](https://hub.docker.com/r/shotit/shotit-worker-hasher)
[![Hasher Docker Image Size](https://img.shields.io/docker/image-size/shotit/shotit-worker-hasher/v0.9.26?style=flat-square)](https://hub.docker.com/r/shotit/shotit-worker-hasher)
[![Hasher Docker Image Size](https://img.shields.io/docker/image-size/shotit/shotit-worker-hasher/v0.9.27?style=flat-square)](https://hub.docker.com/r/shotit/shotit-worker-hasher)
[![Loader Docker](https://img.shields.io/docker/pulls/shotit/shotit-worker-loader?style=flat-square)](https://hub.docker.com/r/shotit/shotit-worker-loader)
[![Loader Docker Image Size](https://img.shields.io/docker/image-size/shotit/shotit-worker-loader/v0.9.26?style=flat-square)](https://hub.docker.com/r/shotit/shotit-worker-loader)
[![Loader Docker Image Size](https://img.shields.io/docker/image-size/shotit/shotit-worker-loader/v0.9.27?style=flat-square)](https://hub.docker.com/r/shotit/shotit-worker-loader)
[![Searcher Docker](https://img.shields.io/docker/pulls/shotit/shotit-worker-searcher?style=flat-square)](https://hub.docker.com/r/shotit/shotit-worker-searcher)
[![Searcher Docker Image Size](https://img.shields.io/docker/image-size/shotit/shotit-worker-searcher/v0.9.26?style=flat-square)](https://hub.docker.com/r/shotit/shotit-worker-searcher)
[![Searcher Docker Image Size](https://img.shields.io/docker/image-size/shotit/shotit-worker-searcher/v0.9.27?style=flat-square)](https://hub.docker.com/r/shotit/shotit-worker-searcher)

Backend workers for [shotit](https://github.com/shotit/shotit). Four core workers of shotit: watcher, hasher, loader and searcher.

Expand Down
8 changes: 6 additions & 2 deletions hasher.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import os from "os";
import fs from "fs-extra";
import child_process from "child_process";
// import lzma from "lzma-native";
import { compress } from "@napi-rs/lzma/xz";
// import { compress } from "@napi-rs/lzma/xz"; // original motivation: extend linux/arm64 support
import { Compressor } from "@napi-rs/lzma/xz";
import fetch from "node-fetch";

const { TRACE_API_URL, TRACE_API_SECRET, TRACE_MEDIA_URL } = process.env;
Expand Down Expand Up @@ -166,7 +167,10 @@ const messageHandle = async (data) => {

console.log("Compressing XML");
// const compressedXML = await lzma.compress(parsedXML, { preset: 6 });
const compressedXML = await compress(parsedXML);
// const compressedXML = await compress(parsedXML);
const compressor = new Compressor({ preset: 6 });
const parts = [compressor.update(parsedXML), await compressor.finish()];
const compressedXML = Buffer.concat(parts);

console.log(`Uploading ${file}`);
await fetch(`${TRACE_API_URL}/hash/${imdbID}/${encodeURIComponent(fileName)}`, {
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": "shotit-worker",
"version": "0.9.26",
"version": "0.9.27",
"description": "Four core workers of shotit: watcher, hasher, loader and searcher",
"main": "",
"type": "module",
Expand Down
Loading