lossless1024 / StreaMonitor

Adult live stream downloader for advanced people. I could have chosen a better name.
GNU General Public License v3.0
208 stars 53 forks source link

[Docker] Permissions on created files #131

Open glottisfaun0000 opened 10 months ago

glottisfaun0000 commented 10 months ago

Running via docker, I have the following environmental variables: environment:

But created video files have the following permissions: -rw-r--r-- 1 root root

Anything I can change to open up the permissions/get the right user/group? All it really means now is having to do rm -f rather than just rm to get rid of unwanted recordings, but it's a little annoying.

DerBunteBall commented 10 months ago

This isn't supported by the Docker container actually.

The simplest thing you could try is building a personal container and use the USER directive.

At the user creation make sure the IDs match.

# syntax=docker/dockerfile:1

FROM python:3.10-slim-buster

RUN \
 # Install additional dependencies
  apt update && \
  apt install -y ffmpeg && \
  rm -rf /var/cache/apt/lists ;

WORKDIR /app

COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt

COPY *.py ./
COPY streamonitor ./streamonitor 

EXPOSE 6969
# Change -u parameter to host user id
RUN useradd -r -u 1000 -g appuser appuser
USER appuser
ENTRYPOINT [ "python3", "Downloader.py"]

This should/could work.

To change user/group dynamically more work would be needed. At least a Bash Script as an entrypoint which makes sure to start the app as the wanted user/group.

cprn1337 commented 3 months ago

Can someone advise or provide a tutorial on how to install this on unraid? I can't download anything from the repository, this is what happens when i run compose up on the yml file image

whimsical-c4lic0 commented 3 months ago

@cprn1337 Here is what my StreaMonitor service looks like in unraid. You'll need to click on "ADD CONTAINER" on the "Docker" tab in unraid. Then add paths, ports, and variables to look like the included screenshot. I'm using my own fork of StreaMonitor (the repository field). You can use it if you want, but it will differ slightly from this repository. I selectively merge PRs and make my own changes. Alternatively, you can clone and build an image to use locally (e.g. docker build -t streamonitor .) and use that image name for the repository field. There is no need to use docker compose.

Screenshot 2024-08-06 210838

cprn1337 commented 3 months ago

@whimsical-c4lic0 thank you for your instructions, I tried your settings but I am getting a permission error. image For the parameters and config path it creates two folder but I assume they were supposed to be files since they have an extension. image I gave full permissions to the folders and changed the owner between root and nobody but that didn't help.

whimsical-c4lic0 commented 3 months ago

@cprn1337 If you haven't yet, you'll need to create the config.json and parameters.py files before starting the container. For example, config.json could start with the following content:

[]

and parameters.py could be

DOWNLOADS_DIR = 'downloads'
MIN_FREE_DISK_PERCENT = 1.0  # in %
DEBUG = False

# You can enter a number to select a specific height.
# Use a huge number here and closest match to get the highest resolution variant
# Eg: 240, 360, 480, 720, 1080, 1440, 99999
WANTED_RESOLUTION = 1080

# Specify match type when specified height
# Possible values: exact, exact_or_least_higher, exact_or_highest_lower, closest
# Beware of the exact policy. Nothing gets downloaded if the wanted resolution is not available
WANTED_RESOLUTION_PREFERENCE = 'closest'

# Video files will be saved with the specified extension.
# For example, if '.mkv' is used, the file will be saved in the mkv format and you will be able to
# watch it while it's being downloaded.
# Also, if someting goes wrong, you will still be able to play the partially downloaded mkv file,·
# as opposed to a mp4 file.
VIDEO_FILE_EXTENSION = '.mkv'
cprn1337 commented 3 months ago

@whimsical-c4lic0 Thank you, I managed to start the container after manually creating the two files but the webui only shows status without any buttons to add streams and I am not sure how to run the commands from the readme file, since the console doesn't work.

image image

Do I have to add the streams in the config file before starting the container and if so could you give me some example of what's the correct format?

whimsical-c4lic0 commented 3 months ago

@cprn1337 The console works. The command should be python Controller.py status instead of status.

cprn1337 commented 3 months ago

@cprn1337 The console works. The command should be python Controller.py status instead of status.

It works!!! I figured out the rest and added a couple of streams, also increased the resolution to 4k. I appreciate your help.