Giter Site home page Giter Site logo

Comments (4)

jenslys avatar jenslys commented on August 22, 2024

The dockerfile was created by @BrainyXS, as I currently don't have much knowledge on docker. So I will leave that up to him.

cc: @BrainyXS

from autovod.

totallyparity avatar totallyparity commented on August 22, 2024

Long comment coming up; Apologies in advance.

With some trial and error, by changing few lines from AutoVOD.sh and DockerFile I was able to get AutoVOD.sh check the channel properly inside the container. I have no clue if those few changes could break the script however.

# DockerFile
FROM alpine 
# Command above will pull 'alpine:latest' image
# Define an ARG variable & set an ENV variable for AutoVOD.sh later

ARG	TWITCH_USER # ARG is used only when building; No effect on container itself. (--build-arg)
ENV	NAME=${TWITCH_USER} # This Environment variable will be set for built container.

# Upgrade the system and install dependencies

RUN	apk add --no-cache --upgrade python3 tar wget bash jq rclone curl # Added curl for curl command in the shell script
RUN	python3 -m ensurepip

RUN	pip3 install --upgrade streamlink 
RUN	wget wget https://github.com/porjo/youtubeuploader/releases/download/23.02/youtubeuploader_23.02_Linux_arm64.tar.gz
RUN	tar -xvf youtubeuploader_23.02_Linux_arm64.tar.gz && rm youtubeuploader_23.02_Linux_arm64.tar.gz &&\
	mv youtubeuploader /usr/local/bin/youtubeuploader
# Maybe steps above could be written better with architecture check routine?


# Copy the required files

COPY	${TWITCH_USER}.config /autoVOD/${TWITCH_USER}.config # Changed to fit $NAME variable for later
COPY	AutoVOD.sh /autoVOD/AutoVOD.sh
COPY	client_secrets.json /autoVOD/client_secrets.json
COPY	request.token /autoVOD/request.token


# Start AutoVod

WORKDIR /autoVOD
CMD	["bash", "AutoVOD.sh"]

--build-arg for docker build wouldn't work for AutoVOD Docker container as --build-arg is only used when building an image for container. And then there's this problem:

CMD ["bash", "AutoVOD.sh", "-ndockeruser"]

Looking at this line, it seems the issue @Slopz mentioned is caused from this. Since script tries to fetch arguments from shell command you would enter manually, it will utilize '-ndockeruser' from command and it will try to check 'twitch.tv/dockeruser'. In order to fix this I added an environment variable NAME which is also used in AutoVOD.sh.

ARG	TWITCH_USER
ENV	NAME=${TWITCH_USER}

COPY ${TWITCH_USER}.config /autoVOD/dockeruser.config

This line was also changed in order to utilize NAME for AutoVOD.sh later:

COPY	${TWITCH_USER}.config /autoVOD/${TWITCH_USER}.config

With that, I will change the shell command from AutoVOD.sh like so:

CMD	["bash", "AutoVOD.sh"]

Since -n isn't necessary, we don't need to use fetchArgs function either:

autovod/AutoVOD.sh

Lines 7 to 19 in 3bbac74

# Function to get the value of the --name option
fetchArgs() {
while getopts ":n:" opt; do
case $opt in
*n)
name=$OPTARG
;;
esac
done
}
# Call the function to get the value of the --name option
fetchArgs "$@"

From AutoVOD.sh, we could just comment fetchArgs function execution part out so that NAME would remain unchanged since configured from DockerFile:

#fetchArgs "$@"

Maybe just clearing out the function for later would work, but then manual installation method would get little bit complicated since using Environment Variable means something like export NAME=targetchannel is necessary. (Maybe make a separate script only for Docker?)

json=$(curl -s --retry 5 --retry-delay 2 --connect-timeout 30 "$API_URL""$STREAMER_NAME")

RUN apk add --no-cache --upgrade python3 tar wget bash jq rclone

Since AutoVOD.sh utilizes curl, I also changed this line from DockerFile so that curl command works inside the container:

RUN	apk add --no-cache --upgrade python3 tar wget bash jq rclone curl

This was the result after change, checked from container logs: (Running on Docker installed on Raspberry Pi 3B; NAME was set to 'targetto' as an example)

17:04:23| Selected streamer: targetto
17:04:24| Found config file
17:04:24| Starting AutoVOD
17:04:24| Loading targetto.config
17:04:24| Trying to fetch stream metadata
17:04:26| Stream is online!
17:04:26| Current Title: null
17:04:26| Current Game: null
17:04:26| Checking twitch.tv/targetto for a stream
17:04:26| All required files found
error: No playable streams found on this URL: twitch.tv/targetto
17:04:34| Trying again in 1 minute

There could be a better way than what I did, but that's all from me.

from autovod.

jenslys avatar jenslys commented on August 22, 2024

Hi,
I appreciate the debugging, do you mind compiling this into a PR? so it's easier for me to see the suggested changes and test it out.

At a glance, I would highly prefer to only have 1 file for both docker and "manual" for ease of further development on the project.

i was trying to look back on previous commits to see where this broke.
Config file support and the current iteration of the dockerfile was introduced in #28

Thanks 😄

from autovod.

jenslys avatar jenslys commented on August 22, 2024

Update: I have made a hacky fix on #61
Feel free to review @totallyparity

from autovod.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.