mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-06-07 12:05:35 +00:00
Fix workflows
This commit is contained in:
parent
26ff364e19
commit
5a8ece17d6
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
130
.github/workflows/build.yml
vendored
130
.github/workflows/build.yml
vendored
@ -1,80 +1,130 @@
|
|||||||
name: Build with PyInstaller
|
name: Build or Publish
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
publish_pypi:
|
||||||
|
description: 'Pubblicare su PyPI (true) o compilare eseguibili? (false)'
|
||||||
|
required: true
|
||||||
|
default: 'false'
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- 'true'
|
||||||
|
- 'false'
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "*" # Il workflow si eseguirà quando viene fatto un push con qualsiasi tag
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
publish:
|
||||||
runs-on: windows-latest
|
if: github.event.inputs.publish_pypi == 'true' # Solo se publish_pypi è true
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0 # Recupera tutti i tag e la cronologia dei commit
|
||||||
|
|
||||||
|
- name: Get the latest tag
|
||||||
|
id: get_latest_tag
|
||||||
|
run: echo "latest_tag=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: '3.11'
|
python-version: '3.11'
|
||||||
|
|
||||||
- name: Cache Python dependencies
|
- name: Install packaging dependencies
|
||||||
uses: actions/cache@v4
|
run: |
|
||||||
|
echo "Installing packaging dependencies"
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
python -m pip install setuptools wheel twine
|
||||||
|
|
||||||
|
- name: Build package
|
||||||
|
run: |
|
||||||
|
echo "Building the package"
|
||||||
|
python setup.py sdist bdist_wheel
|
||||||
|
|
||||||
|
- name: Upload to PyPI
|
||||||
|
env:
|
||||||
|
TWINE_USERNAME: __token__ # Usa '__token__' per l'autenticazione con PyPI
|
||||||
|
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
||||||
|
run: |
|
||||||
|
echo "Uploading package to PyPI"
|
||||||
|
twine upload dist/*
|
||||||
|
|
||||||
|
build:
|
||||||
|
if: github.event.inputs.publish_pypi == 'false' # Solo se publish_pypi è false
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [windows-latest, ubuntu-latest] # Compila per Windows e Linux
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
path: C:\Users\runneradmin\AppData\Local\pip\Cache
|
fetch-depth: 0 # Recupera tutti i tag e la cronologia dei commit
|
||||||
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
|
|
||||||
restore-keys: |
|
- name: Get the latest tag
|
||||||
${{ runner.os }}-pip-
|
id: get_latest_tag
|
||||||
|
run: echo "latest_tag=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: '3.11'
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
|
echo "Installing dependencies"
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
python -m pip install -r requirements.txt
|
python -m pip install -r requirements.txt
|
||||||
python -m pip install fake-useragent==1.1.3 pyinstaller
|
python -m pip install pyinstaller
|
||||||
|
python -m pip install fake-useragent==1.1.3 # Aggiunta dipendenza fake-useragent
|
||||||
|
|
||||||
- name: Build executable with PyInstaller
|
- name: Build executable with PyInstaller (Windows)
|
||||||
|
if: matrix.os == 'windows-latest'
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
echo "Building Windows executable with PyInstaller"
|
||||||
|
pyinstaller --onefile --hidden-import=pycryptodomex --hidden-import=fake_useragent --hidden-import=qbittorrentapi --hidden-import=qbittorrent --hidden-import=googlesearch --hidden-import=bs4 --hidden-import=httpx --hidden-import=rich --hidden-import=tqdm --hidden-import=m3u8 --hidden-import=psutil --hidden-import=unidecode --hidden-import=jsbeautifier --hidden-import=pathvalidate --hidden-import=Cryptodome.Cipher --hidden-import=Cryptodome.Cipher.AES --hidden-import=Cryptodome.Util --hidden-import=Cryptodome.Util.Padding --hidden-import=Cryptodome.Random --hidden-import=Pillow --hidden-import=pyTelegramBotAPI --additional-hooks-dir=pyinstaller/hooks --add-data "StreamingCommunity;StreamingCommunity" --name=StreamingCommunity --icon=".github/media/logo.ico" test_run.py
|
||||||
|
|
||||||
|
- name: Build executable with PyInstaller (Linux)
|
||||||
|
if: matrix.os == 'ubuntu-latest'
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -e
|
echo "Building Linux executable with PyInstaller"
|
||||||
pyinstaller --onefile --hidden-import=pycryptodomex --hidden-import=fake_useragent --hidden-import=qbittorrentapi \
|
pyinstaller --onefile --hidden-import=pycryptodomex --hidden-import=fake_useragent --hidden-import=qbittorrentapi \
|
||||||
--hidden-import=qbittorrent --hidden-import=googlesearch --hidden-import=bs4 --hidden-import=httpx \
|
--hidden-import=qbittorrent --hidden-import=googlesearch --hidden-import=bs4 --hidden-import=httpx \
|
||||||
--hidden-import=rich --hidden-import=tqdm --hidden-import=m3u8 --hidden-import=psutil --hidden-import=unidecode \
|
--hidden-import=rich --hidden-import=tqdm --hidden-import=m3u8 --hidden-import=psutil --hidden-import=unidecode \
|
||||||
--hidden-import=jsbeautifier --hidden-import=pathvalidate --hidden-import=Cryptodome.Cipher \
|
--hidden-import=jsbeautifier --hidden-import=pathvalidate --hidden-import=Cryptodome.Cipher \
|
||||||
--hidden-import=Cryptodome.Cipher.AES --hidden-import=Cryptodome.Util --hidden-import=Cryptodome.Util.Padding \
|
--hidden-import=Cryptodome.Cipher.AES --hidden-import=Cryptodome.Util --hidden-import=Cryptodome.Util.Padding \
|
||||||
--hidden-import=Cryptodome.Random --hidden-import=Pillow --hidden-import=pyTelegramBotAPI \
|
--hidden-import=Cryptodome.Random --hidden-import=Pillow --hidden-import=pyTelegramBotAPI \
|
||||||
--additional-hooks-dir=pyinstaller/hooks --add-data "StreamingCommunity;StreamingCommunity" \
|
--additional-hooks-dir=pyinstaller/hooks --add-data "StreamingCommunity:StreamingCommunity" \
|
||||||
--name=StreamingCommunity --icon="Test/Media/62809003.ico" test_run.py
|
--name=StreamingCommunity test_run.py
|
||||||
|
|
||||||
- name: Verify build output
|
- name: Upload executable (Windows)
|
||||||
shell: bash
|
if: matrix.os == 'windows-latest'
|
||||||
run: |
|
|
||||||
if [ ! -f "dist/StreamingCommunity.exe" ]; then
|
|
||||||
echo "Errore: il file dist/StreamingCommunity.exe non esiste!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Upload executable as artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: StreamingCommunity
|
name: StreamingCommunity-Windows
|
||||||
path: dist/StreamingCommunity.exe
|
path: dist/StreamingCommunity.exe
|
||||||
|
|
||||||
- name: Get latest tag from GitHub
|
- name: Upload executable (Linux)
|
||||||
id: get_latest_tag
|
if: matrix.os == 'ubuntu-latest'
|
||||||
shell: bash
|
uses: actions/upload-artifact@v4
|
||||||
run: |
|
with:
|
||||||
TAG=$(curl -s https://api.github.com/repos/Arrowar/StreamingCommunity/releases/latest | jq -r '.tag_name')
|
name: StreamingCommunity-Linux
|
||||||
if [[ "$TAG" == "null" || -z "$TAG" ]]; then
|
path: dist/StreamingCommunity
|
||||||
echo "Nessun tag trovato, impostazione di default a v1.0.0"
|
|
||||||
TAG="v1.0.0"
|
|
||||||
fi
|
|
||||||
echo "Latest tag: $TAG"
|
|
||||||
echo "latest_tag=$TAG" >> $GITHUB_ENV
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Create or update GitHub release
|
- name: Create or update release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
with:
|
with:
|
||||||
tag_name: ${{ env.latest_tag }}
|
tag_name: ${{ env.latest_tag }} # Usa l'ultimo tag come nome del release
|
||||||
files: dist/StreamingCommunity.exe
|
files: |
|
||||||
|
dist/StreamingCommunity.exe
|
||||||
|
dist/StreamingCommunity
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
@ -1,4 +1,4 @@
|
|||||||
name: Update Lines of Code Badge
|
name: Update Lines of Code
|
||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
@ -18,12 +18,12 @@ jobs:
|
|||||||
- name: Count Lines of Code
|
- name: Count Lines of Code
|
||||||
run: |
|
run: |
|
||||||
LOC=$(cloc . --json | jq '.SUM.code')
|
LOC=$(cloc . --json | jq '.SUM.code')
|
||||||
echo "{\"schemaVersion\": 1, \"label\": \"Lines of Code\", \"message\": \"$LOC\", \"color\": \"green\"}" > Test/Media/loc-badge.json
|
echo "{\"schemaVersion\": 1, \"label\": \"Lines of Code\", \"message\": \"$LOC\", \"color\": \"green\"}" > .github/media/loc-badge.json
|
||||||
|
|
||||||
- name: Commit and Push LOC Badge
|
- name: Commit and Push LOC Badge
|
||||||
run: |
|
run: |
|
||||||
git config --local user.name "GitHub Actions"
|
git config --local user.name "GitHub Actions"
|
||||||
git config --local user.email "actions@github.com"
|
git config --local user.email "actions@github.com"
|
||||||
git add Test/Media/loc-badge.json
|
git add .github/media/loc-badge.json
|
||||||
git commit -m "Update lines of code badge" || echo "No changes to commit"
|
git commit -m "Update lines of code badge" || echo "No changes to commit"
|
||||||
git push
|
git push
|
@ -25,7 +25,7 @@
|
|||||||
<img src="https://img.shields.io/pypi/dm/streamingcommunity?style=for-the-badge" alt="PyPI Downloads"/>
|
<img src="https://img.shields.io/pypi/dm/streamingcommunity?style=for-the-badge" alt="PyPI Downloads"/>
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/Arrowar/StreamingCommunity">
|
<a href="https://github.com/Arrowar/StreamingCommunity">
|
||||||
<img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Arrowar/StreamingCommunity/main/Test/Media/loc-badge.json&style=for-the-badge" alt="Lines of Code"/>
|
<img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Arrowar/StreamingCommunity/main/.github/media/loc-badge.json&style=for-the-badge" alt="Lines of Code"/>
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
|
from typing import Tuple
|
||||||
|
|
||||||
|
|
||||||
# Internal utilities
|
# Internal utilities
|
||||||
@ -29,7 +30,7 @@ KILL_HANDLER = bool(False)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def download_episode(index_select: int, scrape_serie: ScrapeSerieAnime, video_source: VideoSourceAnime) -> tuple[str,bool]:
|
def download_episode(index_select: int, scrape_serie: ScrapeSerieAnime, video_source: VideoSourceAnime) -> Tuple[str,bool]:
|
||||||
"""
|
"""
|
||||||
Downloads the selected episode.
|
Downloads the selected episode.
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
from typing import Tuple
|
||||||
|
|
||||||
|
|
||||||
# Internal utilities
|
# Internal utilities
|
||||||
@ -28,7 +29,7 @@ from .costant import SERIES_FOLDER
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def download_video(index_episode_selected: int, scape_info_serie: GetSerieInfo, video_source: VideoSource) -> tuple[str,bool]:
|
def download_video(index_episode_selected: int, scape_info_serie: GetSerieInfo, video_source: VideoSource) -> Tuple[str,bool]:
|
||||||
"""
|
"""
|
||||||
Download a single episode video.
|
Download a single episode video.
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
from typing import Tuple
|
||||||
|
|
||||||
|
|
||||||
# Internal utilities
|
# Internal utilities
|
||||||
@ -26,7 +27,7 @@ from .costant import SERIES_FOLDER
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def download_video(index_season_selected: int, index_episode_selected: int, scape_info_serie: GetSerieInfo) -> str:
|
def download_video(index_season_selected: int, index_episode_selected: int, scape_info_serie: GetSerieInfo) -> Tuple[str,bool]:
|
||||||
"""
|
"""
|
||||||
Download a single episode video.
|
Download a single episode video.
|
||||||
|
|
||||||
@ -37,6 +38,7 @@ def download_video(index_season_selected: int, index_episode_selected: int, scap
|
|||||||
|
|
||||||
Return:
|
Return:
|
||||||
- str: output path
|
- str: output path
|
||||||
|
- bool: kill handler status
|
||||||
"""
|
"""
|
||||||
start_message()
|
start_message()
|
||||||
index_season_selected = dynamic_format_number(index_season_selected)
|
index_season_selected = dynamic_format_number(index_season_selected)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
from typing import Tuple
|
||||||
|
|
||||||
|
|
||||||
# Internal utilities
|
# Internal utilities
|
||||||
@ -27,7 +28,7 @@ from StreamingCommunity.Api.Player.vixcloud import VideoSource
|
|||||||
from .costant import SITE_NAME, SERIES_FOLDER, TELEGRAM_BOT
|
from .costant import SITE_NAME, SERIES_FOLDER, TELEGRAM_BOT
|
||||||
|
|
||||||
|
|
||||||
def download_video(index_season_selected: int, index_episode_selected: int, scrape_serie: ScrapeSerie, video_source: VideoSource) -> tuple[str,bool]:
|
def download_video(index_season_selected: int, index_episode_selected: int, scrape_serie: ScrapeSerie, video_source: VideoSource) -> Tuple[str,bool]:
|
||||||
"""
|
"""
|
||||||
Download a single episode video.
|
Download a single episode video.
|
||||||
|
|
||||||
|
@ -2,17 +2,17 @@
|
|||||||
"DEFAULT": {
|
"DEFAULT": {
|
||||||
"debug": false,
|
"debug": false,
|
||||||
"log_file": "app.log",
|
"log_file": "app.log",
|
||||||
"log_to_file": false,
|
"log_to_file": true,
|
||||||
"show_message": true,
|
"show_message": true,
|
||||||
"clean_console": true,
|
"clean_console": true,
|
||||||
"root_path": "Video",
|
"root_path": "Video",
|
||||||
"movie_folder_name": "Movie",
|
"movie_folder_name": "Movie",
|
||||||
"serie_folder_name": "Serie",
|
"serie_folder_name": "Serie",
|
||||||
"anime_folder_name": "Anime",
|
"anime_folder_name": "Anime",
|
||||||
"map_episode_name": "S%(season)E%(episode)_%(episode_name)",
|
"map_episode_name": "E%(episode)_%(episode_name)",
|
||||||
"config_qbit_tor": {
|
"config_qbit_tor": {
|
||||||
"host": "192.168.5.99",
|
"host": "192.168.1.99",
|
||||||
"port": "8080",
|
"port": "7060",
|
||||||
"user": "admin",
|
"user": "admin",
|
||||||
"pass": "adminadmin"
|
"pass": "adminadmin"
|
||||||
},
|
},
|
||||||
|
@ -9,7 +9,7 @@ jsbeautifier
|
|||||||
pathvalidate
|
pathvalidate
|
||||||
pycryptodomex
|
pycryptodomex
|
||||||
googlesearch-python
|
googlesearch-python
|
||||||
fake-useragent
|
fake-useragent<2.0.0
|
||||||
qbittorrent-api
|
qbittorrent-api
|
||||||
python-qbittorrent
|
python-qbittorrent
|
||||||
Pillow
|
Pillow
|
||||||
|
2
setup.py
2
setup.py
@ -10,7 +10,7 @@ with open("requirements.txt", "r", encoding="utf-8-sig") as f:
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="StreamingCommunity",
|
name="StreamingCommunity",
|
||||||
version="2.5.2",
|
version="2.5.6",
|
||||||
long_description=read_readme(),
|
long_description=read_readme(),
|
||||||
long_description_content_type="text/markdown",
|
long_description_content_type="text/markdown",
|
||||||
author="Lovi-0",
|
author="Lovi-0",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user