Skip to content
This repository has been archived by the owner on Oct 12, 2024. It is now read-only.

Commit

Permalink
Merge pull request #5 from maksii/dev
Browse files Browse the repository at this point in the history
impro
  • Loading branch information
maksii authored Aug 30, 2024
2 parents ab8aaf5 + b28a783 commit bd21d1d
Show file tree
Hide file tree
Showing 28 changed files with 2,860 additions and 377 deletions.
32 changes: 29 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ name: Build and Release
on:
push:
branches:
- main # This triggers the workflow on pushes to the main branch
- main
- dev
paths-ignore:
- '.github/**'
- '.*'
Expand All @@ -30,6 +31,17 @@ jobs:
- name: Install PyInstaller
run: pip install pyinstaller

- name: Save build number
shell: pwsh
run: |
$BUILD_NUMBER = (Get-Date -Format 'yyyyMMddHHmmss')
echo "BUILD_NUMBER=$BUILD_NUMBER" >> $env:GITHUB_ENV
$versionFilePath = "src/utils/version.py"
if (-Not (Test-Path -Path (Split-Path -Parent $versionFilePath))) {
New-Item -ItemType Directory -Path (Split-Path -Parent $versionFilePath) -Force
}
echo "__version__ = '$BUILD_NUMBER'" > $versionFilePath
- name: Build executable
run: pyinstaller upload.spec

Expand All @@ -41,6 +53,13 @@ jobs:
Copy-Item -Path data/config.example.json -Destination zip_content/data/config.json
Copy-Item -Path data/naming.json -Destination zip_content/data/
Copy-Item -Path data/tags.json -Destination zip_content/data/
Copy-Item -Path data/audio_config.json -Destination zip_content/data/
Copy-Item -Path data/distribution.json -Destination zip_content/data/
Copy-Item -Path data/regions.json -Destination zip_content/data/
Copy-Item -Path data/services.json -Destination zip_content/data/
Copy-Item -Path data/editions.json -Destination zip_content/data/
Copy-Item -Path data/addons/description.txt -Destination zip_content/
Copy-Item -Path data/addons/run.bat -Destination zip_content/
- name: Create zip file
run: |
Expand All @@ -56,11 +75,18 @@ jobs:
id: create_tag
shell: pwsh
run: |
$TAG_NAME = "v$(Get-Date -Format 'yyyyMMddHHmmss')"
$TAG_NAME = "v${{ env.BUILD_NUMBER }}"
echo "TAG_NAME=$TAG_NAME" >> $env:GITHUB_ENV
git tag $TAG_NAME
git push origin $TAG_NAME
- name: Determine if Pre-release
id: prerelease_check
shell: pwsh
run: |
$isPreRelease = if ($env:GITHUB_REF -ne 'refs/heads/main') { 'true' } else { 'false' }
echo "IS_PRERELEASE=$isPreRelease" >> $env:GITHUB_ENV
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
Expand All @@ -70,7 +96,7 @@ jobs:
tag_name: ${{ env.TAG_NAME }}
release_name: Release ${{ env.TAG_NAME }}
draft: false
prerelease: false
prerelease: ${{ env.IS_PRERELEASE }}

- name: Upload Release Asset
uses: actions/upload-release-asset@v1
Expand Down
30 changes: 24 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,41 @@
FROM alpine:latest
FROM python:3.12.5-alpine3.20

# add mono repo and mono
RUN apk add --no-cache mono --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing

# install requirements
RUN apk add --no-cache --upgrade ffmpeg mediainfo python3 git py3-pip python3-dev python3-tkinter g++ cargo mktorrent rust
# Install dependencies
RUN apk add --no-cache --upgrade \
ffmpeg mediainfo python3 git py3-pip python3-dev python3-tkinter g++ cargo mktorrent rust \
&& apk add --no-cache mono --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing

RUN addgroup -S appgroup && adduser -S appuser -G appgroup

# Set the timezone
ENV TZ=Europe/Kiev
RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

# create virtual environment
RUN python3 -m venv /venv
ENV PATH="/venv/bin:$PATH"

# change workdir
WORKDIR UTOPIA-Upload-Assistant
WORKDIR /UTOPIA-Upload-Assistant

# install reqs
COPY requirements.txt .
RUN pip3 install -r requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

# copy everything
COPY . .

ENTRYPOINT ["python3", "/UTOPIA-Upload-Assistant/upload.py"]
# Define volumes
VOLUME /UTOPIA-Upload-Assistant/data
VOLUME /UTOPIA-Upload-Assistant/tmp

# Set file ownership
RUN chown -R appuser:appgroup /UTOPIA-Upload-Assistant

# Switch to the non-root user
USER appuser

CMD ["tail", "-f", "/dev/null"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This is a fork of L4G's Upload Assistant for the UTOPIA tracker. The main differ
* Removed configuration and code specific to other trackers, making this version focused on UTOPIA only.
* Migrated hardcoded Python configuration (.py file) to a JSON-based approach.
* Integration with PyInstaller for building a frozen executable
* Docker - not tested
* Docker update to latest image and libs with ondemand use
* Removed Discord-related code from the project.(not in roadmap right now. will be restored only after full project stabilization and testing)
* naming rules refactored and moved to json configuration

Expand Down
7 changes: 7 additions & 0 deletions data/addons/description.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[center][note][color=Dodgerblue][b]Source: [/b][/color][/note][/center]
[center][note]%SCREENS%[/note][/center]
[center][note][color=Dodgerblue][b]

Thanks and other information about the release

[/b][/color][/note][/center]
3 changes: 3 additions & 0 deletions data/addons/run.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
chcp 65001
upload.exe "C:\upload\movie.mkv" --screens 12 --personal --qbit-tag UTP --qbit-cat releases --descfile "H:\upload\description.txt"
pause
44 changes: 44 additions & 0 deletions data/audio_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"audio": {
"DTS": "DTS",
"AAC": "AAC",
"AAC LC": "AAC",
"AC-3": "DD",
"E-AC-3": "DD+",
"MLP FBA": "TrueHD",
"FLAC": "FLAC",
"Opus": "Opus",
"Vorbis": "Vorbis",
"PCM": "LPCM",
"LPCM Audio": "LPCM",
"Dolby Digital Audio": "DD",
"Dolby Digital Plus Audio": "DD+",
"Dolby TrueHD Audio": "TrueHD",
"DTS Audio": "DTS",
"DTS-HD Master Audio": "DTS-HD MA",
"DTS-HD High-Res Audio": "DTS-HD HRA",
"DTS:X Master Audio": "DTS:X"
},
"audio_extra": {
"XLL": "-HD MA",
"XLL X": ":X",
"ES": "-ES"
},
"format_extra": {
"JOC": " Atmos",
"16-ch": " Atmos",
"Atmos Audio": " Atmos"
},
"format_settings_extra": {
"Dolby Surround EX": "EX"
},
"commercial_names": {
"Dolby Digital": "DD",
"Dolby Digital Plus": "DD+",
"Dolby TrueHD": "TrueHD",
"DTS-ES": "DTS-ES",
"DTS-HD High": "DTS-HD HRA",
"Free Lossless Audio Codec": "FLAC",
"DTS-HD Master Audio": "DTS-HD MA"
}
}
18 changes: 11 additions & 7 deletions data/config.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
"lensdump_api": "lensdump api key",
"ptscreens_api" : "ptscreens_API_KEY",
"oeimg_api" : "oeimg_API_KEY",
"img_host_1": "utppm",
"img_host_1": "utppm",
"img_host_2": "imgbb",
"img_host_3": "ptpimg",
"img_host_4": "imgbox",
"img_host_3": "imgbox",
"img_host_4": "oeimg",
"img_host_5": "pixhost",
"img_host_6": "lensdump",
"img_host_7": "ptscreens",
"img_host_8": "oeimg",
"img_host_6": "ptscreens",
"img_host_7": "lensdump",
"img_host_8": "ptpimg",
"screens": "6",
"img_size" : "500",
"optimize_images": "True",
Expand All @@ -41,7 +41,11 @@
"qbit_url": "http://127.0.0.1",
"qbit_port": "8080",
"qbit_user": "username",
"qbit_pass": "password"
"qbit_pass": "password",
"qbit_tag" : "UTP",
"qbit_cat" : "release",
"local_path" : "c:\\Downloads\\upload",
"remote_path" : "/smb/Downloads/upload"
},
"rtorrent": {
"torrent_client": "rtorrent",
Expand Down
Loading

0 comments on commit bd21d1d

Please sign in to comment.