-
Notifications
You must be signed in to change notification settings - Fork 4
/
SetupAcestream.bat
128 lines (117 loc) · 4.01 KB
/
SetupAcestream.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
@echo off
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
:: -------------------------
:: Definition of constants for the script configuration.
:: -------------------------
set "IMAGE_NAME=smarquezp/docker-acestream-ubuntu-home:latest"
set "INTERNAL_IP=127.0.0.1"
set "PORT=6878"
set "SERVICE_NAME=acestream"
set "DOCKER_COMPOSE_FILE=docker-compose.yml"
set "PREFIX=acestream://"
:: -------------------------
:: Checking for Docker installation and operational status.
:: -------------------------
:dockerCheck
echo Checking Docker...
docker --version >nul 2>&1 || (
echo ERROR: Docker not found. Please install Docker to continue.
start https://www.docker.com/get-started/
pause
goto dockerCheck
)
docker info >nul 2>&1 || (
echo ERROR: Docker is not active. Please start Docker and try again.
pause
goto dockerCheck
)
echo Docker successfully verified and ready for use.
:: -------------------------
:: Obtaining a non-loopback internal IP address.
:: -------------------------
for /f "tokens=2 delims=:" %%a in ('ipconfig ^| findstr /C:"IPv4"') do (
set "IP_TEMP=%%a"
set "IP_TEMP=!IP_TEMP: =!"
if "!IP_TEMP!" NEQ "127.0.0.1" (
set "INTERNAL_IP=!IP_TEMP!"
goto installAcestream
)
)
:: -------------------------
:: Acestream and Docker configuration section.
:: -------------------------
:installAcestream
echo.
echo [Acestream Installation on Docker]
echo ----------------------------------------
echo Configuring the environment for Acestream...
:: Requesting the user to validate or modify the detected IP address.
echo.
echo Internal IP address verification...
echo Your current internal IP address is: %INTERNAL_IP%
echo If this is correct, press ENTER. Otherwise, enter the correct IP and press ENTER.
echo.
set /p USER_IP=Enter the IP or press ENTER if it is correct:
if not "%USER_IP%"=="" set "INTERNAL_IP=%USER_IP%"
echo Using IP: %INTERNAL_IP%
:: -------------------------
:: Creation or update of the docker-compose.yml file.
:: -------------------------
:startDocker
docker stop %SERVICE_NAME% >NUL 2>&1
docker rm %SERVICE_NAME% -f >NUL 2>&1
echo.
echo Creating or updating the docker-compose.yml file...
>%DOCKER_COMPOSE_FILE% (
echo version: '3.8'
echo services:
echo acestream:
echo image: %IMAGE_NAME%
echo container_name: acestream
echo restart: unless-stopped
echo ports:
echo - %PORT%:%PORT%
echo environment:
echo - INTERNAL_IP=%INTERNAL_IP%
echo networks:
echo default:
echo driver: bridge
)
echo.
echo docker-compose.yml file created or updated successfully.
:: Pull the latest image before starting the service
echo Pulling the latest Docker image...
docker-compose -f %DOCKER_COMPOSE_FILE% pull %SERVICE_NAME%
:: Attempt to start the service and handle errors in case of failure.
echo Starting the Acestream service...
docker-compose -f %DOCKER_COMPOSE_FILE% up -d %SERVICE_NAME% || (
echo ERROR: Could not start the Acestream service. Ensure the 'docker-compose.yml' file is correctly configured.
pause
goto startDocker
)
echo Acestream service started successfully.
echo Acestream container successfully launched on port: %PORT%
echo.
:: -------------------------
:: Starting the content playback in the browser.
:: -------------------------
echo [Content Playback of Acestream]
echo ----------------------------------------
echo The browser will open in 5 seconds to start playing the content.
timeout /t 5 /nobreak >nul
echo Preparing the Acestream stream playback...
start http://%INTERNAL_IP%:%PORT%/webui/player/
:: -------------------------
:: Farewell message and script termination.
:: -------------------------
echo.
echo [Farewell]
echo -------------------------------------------------------------
echo Thank you for using the Acestream x Docker setup assistant.
echo We hope you enjoy an excellent streaming experience!
echo @marquezpsergio
echo -------------------------------------------------------------
echo Finalizing the script and restoring the environment...
pause
ENDLOCAL
exit /b