Merge pull request #68 from arabcoders/dev

fixes
This commit is contained in:
Abdulmohsen 2024-01-21 00:16:18 +03:00 committed by GitHub
commit 96dc93a663
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 28 additions and 2 deletions

View file

@ -35,6 +35,7 @@ jobs:
runs-on: ubuntu-latest
permissions:
packages: write
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
@ -91,10 +92,11 @@ jobs:
cache-to: type=gha, scope=${{ github.workflow }}
- name: Version tag
uses: Jorricks/action-python-autotagging@1.0.1
if: github.event_name != 'pull_request'
uses: arabcoders/action-python-autotagger@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
repo_name: arabcoders/ytptube
path: app/version.py
variable: APP_VERSION

View file

@ -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):