Skip to content

Commit

Permalink
Add env var to specify yt-dlp code branch.
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianAllred committed Aug 25, 2023
1 parent 45f9271 commit 5aa2d20
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ WORKDIR /app
COPY --from=build /app .
RUN apt-get update -y
RUN apt-get install -y python3-pip git aspnetcore-runtime-6.0
RUN python3 -m pip install --upgrade git+https://github.com/yt-dlp/yt-dlp.git@release
RUN python3 -m pip install --force-reinstall git+https://github.com/yt-dlp/yt-dlp.git@release
ENTRYPOINT [ "dotnet", "TelegramVideoBot.dll" ]
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Uses YT-DLP and FFMpeg under the hood. Supports hardware acceleration, but it wi
- `TG_BOT_TOKEN`: Bot token obtained from Botfather. Required.
- `TG_BOT_NAME`: Name used in `/help` and `/start` command text. Optional, defaults to `Frozen's Video Bot`.
- `UPDATE_YTDLP_ON_START`: Update the local installation of YT-DLP on start. Optional, defaults to false. Highly recommended in container deployments.
- `YTDLP_UPDATE_BRANCH`: The code branch to use when YT-DLP updates on start (if `UPDATE_YTDLP_ON_START` is true). Optional, defaults to `release`.
- `DOWNLOAD_QUEUE_LIMIT`: Number of videos allowed in each user's download queue. Optional, defaults to 5.
- `TZ`: Timezone. Optional, defaults to UTC.

Expand Down
1 change: 1 addition & 0 deletions Utilities/EnvironmentConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ public class EnvironmentConfig
public string TelegramBotName => Environment.GetEnvironmentVariable("TG_BOT_NAME") ?? string.Empty;
public bool UpdateYtDlpOnStart => bool.Parse(Environment.GetEnvironmentVariable("UPDATE_YTDLP_ON_START") ?? "false");
public int DownloadQueueLimit => int.Parse(Environment.GetEnvironmentVariable("DOWNLOAD_QUEUE_LIMIT") ?? "5");
public string YtDlpUpdateBranch => Environment.GetEnvironmentVariable("YTDLP_UPDATE_BRANCH") ?? "release";
}
2 changes: 1 addition & 1 deletion Workers/YtDlp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public YtDlp(EnvironmentConfig config, ILogger<YtDlp> logger)
{
var updateStartInfo = new ProcessStartInfo("python3")
{
Arguments = "-m pip install --upgrade git+https://github.com/yt-dlp/yt-dlp.git@release",
Arguments = $"-m pip install --force-reinstall git+https://github.com/yt-dlp/yt-dlp.git@{config.YtDlpUpdateBranch}",
RedirectStandardError = true,
RedirectStandardOutput = true
};
Expand Down

0 comments on commit 5aa2d20

Please sign in to comment.