A container with a REST API that wraps comskip and comchap for handling commercial skipping.
8.4K
This is a basic container that wraps the Comskip and Comchap utilities. It utilizes a REST api endpoint to accept filenames for the commercial skipping process. I'm using it with the following workflow:
Doing it this way allows me to let an external container separate from Jellyfin handle the commerical skipping procedure. This can be run on a separate machine as long as there is a volume mount from this container to the NFS share.
The config file is a YAML file and looks something like this:
api:
apikey: "YOUR_GENERATED_API_KEY"
log_dir: "/data/logs"
log_level: "debug"
library_dir: "/library"
port: 8080
comskip:
comskip_cmd: "/usr/local/bin/comskip"
comskip_ini: "/data/config/comskip.ini"
cmd: "/usr/local/bin/comcut"
keep_edl: true
timeout: 300
size_percentage: 0.7
postprocess:
cmd: "/data/scripts/postcall.sh"
The configuration above should be fairly self explanatory. Some less obvious configurations are:
0.0.0.0./comskip.If you were to change host to localhost 127.0.0.1 , port to 9000 and uri to /comcutter then the server will listen on 127.0.0.1:9000/comcutter.
Here is a basic example of a docker-compose.yml file for using this image.
NOTE - this image is based on the LinuxServer.io base image. That's why you will see the standard LSIO logo on startup.
version: "2.1"
services:
comcutter:
image: bljohnsondev/comcutter
container_name: comcutter
environment:
- PUID=1000
- PGID=1000
- TZ=America/Chicago
ports:
- 8080:8080
volumes:
- /your/path/to/data:/data
- /your/path/to/media/library:/library
restart: unless-stopped
This example bash script uses curl to kick off a commercial skip operation. I am using a similar script for post processing with Jellyfin. Jellyfin calls this and passes the full file path to the recording as the command argument.
Note that the file path will be specific to the Jellyfin container. Since Jellyfin passes the full absolute file path as an argument I'm using the sed command to strip the volume mount from the file path so it only passes the relative path to the API. In this example it passes the full file path.
#!/bin/bash
filepath="$@"
curl -X POST \
http://localhost:8080/comskip \
-H 'Content-Type: application/json' \
-d "{\"api\": \"YOUR_GENERATED_API_KEY\", \"file\": \"${filepath}\"}"
/root/defaults directory in the same folder with the Python code and modify it to fit your needs. By default it looks in the current directory for the config file. Run the comlistener.py file to start up the API server.Content type
Image
Digest
Size
52.2 MB
Last updated
over 4 years ago
docker pull bljohnsondev/comcutter