From 0174a1f5d0b8435a51d714da1a445b3ccdd14242 Mon Sep 17 00:00:00 2001 From: ArabCoders Date: Sat, 20 Jan 2024 23:21:33 +0300 Subject: [PATCH 1/4] fixes --- .github/workflows/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9b4e6142..f824cce5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -92,7 +92,6 @@ jobs: - name: Version tag uses: Jorricks/action-python-autotagging@1.0.1 - if: github.event_name != 'pull_request' with: token: ${{ secrets.GITHUB_TOKEN }} path: app/version.py From c7e0c542976d4fc192ca2c81c1bbb90a44c9e07c Mon Sep 17 00:00:00 2001 From: ArabCoders Date: Sat, 20 Jan 2024 23:46:13 +0300 Subject: [PATCH 2/4] attempt to fix version tagging --- .github/workflows/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f824cce5..db41bf7f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -91,9 +91,10 @@ jobs: cache-to: type=gha, scope=${{ github.workflow }} - name: Version tag - uses: Jorricks/action-python-autotagging@1.0.1 + uses: arabcoders/action-python-autotagger@master with: token: ${{ secrets.GITHUB_TOKEN }} + repo_name: arabcoders/ytptube path: app/version.py variable: APP_VERSION From f4ddfb552a5893f63c58eb4c9a3baad7dfae9456 Mon Sep 17 00:00:00 2001 From: ArabCoders Date: Sat, 20 Jan 2024 23:57:12 +0300 Subject: [PATCH 3/4] attempt #3 --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index db41bf7f..5e055c04 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -35,6 +35,7 @@ jobs: runs-on: ubuntu-latest permissions: packages: write + contents: write steps: - name: Checkout uses: actions/checkout@v4 From c8b6cc39ac4e921f852d2479208a8b9fdff7eab0 Mon Sep 17 00:00:00 2001 From: ArabCoders Date: Sun, 21 Jan 2024 00:12:53 +0300 Subject: [PATCH 4/4] initial work to add version checker. --- .github/workflows/main.yml | 1 + app/main.py | 26 +++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5e055c04..2107b203 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -92,6 +92,7 @@ jobs: cache-to: type=gha, scope=${{ github.workflow }} - name: Version tag + if: github.event_name != 'pull_request' uses: arabcoders/action-python-autotagger@master with: token: ${{ secrets.GITHUB_TOKEN }} diff --git a/app/main.py b/app/main.py index 2f8fdfe0..52be5d8a 100644 --- a/app/main.py +++ b/app/main.py @@ -8,7 +8,7 @@ import random from Config import Config from DownloadQueue import DownloadQueue from Utils import ObjectSerializer, Notifier -from aiohttp import web +from aiohttp import web, client from aiohttp.web import Request, Response from Webhooks import Webhooks from player.M3u8 import M3u8 @@ -128,6 +128,30 @@ class Main: await self.sio.emit('initial_data', self.serializer.encode(data), to=sid) + async def version_check(self): + try: + with client.ClientSession() as session: + async with session.get('https://api.github.com/repos/ytptube/ytptube/tags') as r: + if r.status != 200: + return + + tags = await r.json() + + for tag in tags: + tagName = tag.get('name') + splitTagName = tagName.split('-') + if len(splitTagName) > 1: + tagName = splitTagName[0] + cvDate = self.config.version.split('-') + if tagName > cvDate[0]: + self.config.new_version_available = True + self.logger.info( + f'New version {tagName} available at') + break + + except Exception as e: + pass + def addTasks(self): tasks_file: str = os.path.join(self.config.config_path, 'tasks.json') if not os.path.exists(tasks_file):