|
@ -2,10 +2,10 @@ import { link, mkdir } from "fs/promises"; |
|
|
import { dirname, extname } from "path"; |
|
|
import { dirname, extname } from "path"; |
|
|
import Application from "../../Application"; |
|
|
import Application from "../../Application"; |
|
|
import { MovieTicket, MovieTorrent } from "@autoplex/database"; |
|
|
import { MovieTicket, MovieTorrent } from "@autoplex/database"; |
|
|
import Service from "../Service"; |
|
|
|
|
|
import { ISerializedTorrent } from "../TorrentManager/TorrentClientIpc"; |
|
|
import { ISerializedTorrent } from "../TorrentManager/TorrentClientIpc"; |
|
|
import { safeTitleFileName } from "../../utils"; |
|
|
import { safeTitleFileName } from "../../utils"; |
|
|
import Supervisor from "../Supervisor"; |
|
|
import Supervisor from "../Supervisor"; |
|
|
|
|
|
import { InternalService } from "@autoplex/microservice"; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Common video file extensions |
|
|
* Common video file extensions |
|
@ -23,39 +23,32 @@ interface IPendingMovieTorrent { |
|
|
ticket : MovieTicket |
|
|
ticket : MovieTicket |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
export default class PostProcessor extends Service |
|
|
|
|
|
|
|
|
export default class PostProcessor extends InternalService<Application> |
|
|
{ |
|
|
{ |
|
|
/** |
|
|
/** |
|
|
* The queue of movies to process |
|
|
* The queue of movies to process |
|
|
*/ |
|
|
*/ |
|
|
protected pendingMovies: IPendingMovieTorrent[]; |
|
|
|
|
|
|
|
|
protected pendingMovies: IPendingMovieTorrent[] = []; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Indicate if movies are currently being processed |
|
|
* Indicate if movies are currently being processed |
|
|
*/ |
|
|
*/ |
|
|
protected isProcessingMovies: boolean; |
|
|
|
|
|
|
|
|
protected isProcessingMovies: boolean = false; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Create a new instance of the post processor |
|
|
* Create a new instance of the post processor |
|
|
*/ |
|
|
*/ |
|
|
public constructor(app: Application) { |
|
|
public constructor(app: Application) { |
|
|
super("Post Processor", app); |
|
|
|
|
|
|
|
|
super(app); |
|
|
this.pendingMovies = []; |
|
|
this.pendingMovies = []; |
|
|
this.isProcessingMovies = false; |
|
|
this.isProcessingMovies = false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Boot the post-processor service |
|
|
|
|
|
|
|
|
* The service name |
|
|
*/ |
|
|
*/ |
|
|
public async boot() { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Shutdown the post-processor service |
|
|
|
|
|
*/ |
|
|
|
|
|
public async shutdown() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public get name() { |
|
|
|
|
|
return "Post Processor"; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Methods -------------------------------------------------------------------------------------
|
|
|
// Methods -------------------------------------------------------------------------------------
|
|
|