Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/JVT038/MetaTube
Browse files Browse the repository at this point in the history
  • Loading branch information
JVT038 committed Oct 4, 2024
2 parents 4442569 + 192a4b0 commit 8ddab7a
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 10 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/test_app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,29 @@ on:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.10"
python-version: "3.12"
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Run unit tests for database
run: python tests/testDatabase.py
run: |
export PYTHONPATH="$(pwd)"
pytest tests --disable-warnings
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# For virtual environment
Lib*
lib
lib64
Scripts*
pyvenv.cfg

Expand Down
3 changes: 0 additions & 3 deletions metatube/templates/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,9 @@ <h4 class="text-center">Download settings</h4>
<label for="#hardware_acceleration">Whether to use hardware acceleration with FFmpeg; if yes, select the desired method.</label>
<select class="custom-select" id="hardware_acceleration">
<option value="None">None</option>
<option value="amd">AMD AMF</option>
<option value="qsv">Intel Quick Sync</option>
<option value="omx">OpenMAX OMX</option>
<option value="nvenc">NVIDIA NVENC</option>
<option value="vaapi">Video Acceleration API (VAAPI)</option>
<option value="videotoolbox">Video Toolbox</option>
</select>
</div>
<div class="col d-none">
Expand Down
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mutagen==1.47.0
requests==2.31.0
requests==2.32.3
yt-dlp==2024.9.27
gevent==23.9.1
gevent-websocket==0.10.1
Expand All @@ -12,9 +12,10 @@ sponsorblock.py==0.2.3
python-dateutil==2.8.2
python-dotenv==1.0.1
python-magic==0.4.27
pytest==8.0.0
ffmpeg-python==0.2.0
youtube-search-python==1.6.6
spotipy==2.24.0
urllib3==2.1.0
urllib3==2.2.2
deezer-python==6.1.1
lyricsgenius==3.0.1
8 changes: 6 additions & 2 deletions tests/testDatabase.py → tests/test_database.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from email.policy import default
from config import Config
from metatube.init import Default
from metatube import create_app, db
Expand All @@ -23,7 +22,7 @@ class TestConfig(Config):
# SQLALCHEMY_DATABASE_URI = os.path.join('sqlite:///', basedir, 'metatube/test.db')
# SQLALCHEMY_DATABASE_URI = 'sqlite://'

class TestAutoMigration(unittest.TestCase):
class TestDatabase(unittest.TestCase):
def setUp(self):
self.app = create_app(TestConfig)
self.app_context = self.app.app_context()
Expand All @@ -39,6 +38,11 @@ def testAutoCreation(self):
db.drop_all()
relative_url = 'sqlite:///' + os.path.join('metatube', Config.SQLALCHEMY_DATABASE_URI.replace('sqlite:///', ''))
default = Default(self.app, relative_url)
migrationsPath = os.path.join(Config.BASE_DIR, 'migrations')
if os.path.exists(migrationsPath) and os.path.isdir(migrationsPath) and (os.path.exists(os.path.join(migrationsPath, 'env.py')) and os.path.exists(os.path.join(migrationsPath, 'versions'))):
default.init_db()
else:
default.init_db(False)
self.assertTrue(default.init_db())

def testConfigTable(self):
Expand Down

0 comments on commit 8ddab7a

Please sign in to comment.