Skip to content

Commit

Permalink
Big refactor
Browse files Browse the repository at this point in the history
* Refactor record function into CaptureTask class to make breaking up functions and configuration easier #3
* Create individual functions for event listeners to make it easier to attach them to new readables
* await a custom event to finish recording rather than relying on initial stream
* Determine file extension based on url and response content-type
* Partially implement m3u8 handling (not working yet) #1
  • Loading branch information
FoxxMD committed Mar 4, 2021
1 parent e1d4970 commit 9a999bd
Show file tree
Hide file tree
Showing 6 changed files with 472 additions and 178 deletions.
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {Writable} from 'stream';
import winston from 'winston';
import 'winston-daily-rotate-file';

import record from './server/record.js';
import {labelledFormat} from "./server/util.js";
import CaptureTask from "./server/CaptureTask.js";

dayjs.extend(utc);
dayjs.extend(dduration);
Expand Down Expand Up @@ -96,6 +96,8 @@ const configDir = cDir || `${process.cwd()}/config`;
if (duration === undefined) {
throw new Error('duration (second arg) must be defined');
}
await record(url, duration, {metadataBehavior: meta, id, dir: outputDir, nameTemplate: name});
const task = new CaptureTask(url, duration, {metadataBehavior: meta, id, dir: outputDir, template: name})

await task.capture();
}
}());
133 changes: 133 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@
"argv": "0.0.2",
"dayjs": "^1.10.4",
"icy": "^2.1.0",
"m3u8stream": "^0.8.3",
"mime-types": "^2.1.29",
"minimist": "^1.2.5",
"mustache": "^4.1.0",
"node-id3": "^0.2.2",
"p-event": "^4.2.0",
"safe-stable-stringify": "^1.1.1",
"winston": "^3.3.3",
"winston-daily-rotate-file": "^4.5.0"
Expand Down
Loading

0 comments on commit 9a999bd

Please sign in to comment.