Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add gui to the project: #2

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,51 @@ on:
push:
branches:
- main
pull_request:

jobs:
mypy_lint:
name: Lint with Mypy
name: Lint files
runs-on: ubuntu-latest
container:
image: python:3.11-bookworm
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: prepare environment
run: |
pip install pipenv -U --quiet
apt-get update
apt-get install python3-wxgtk4.0 libgtk-3-dev -y
pipenv install --dev

- name: run lint
run: |
pipenv run mypy
pipenv run ruff-ci

- name: run checks
run: |
pipenv check

tests:
name: Test with pytest
name: Run tests
runs-on: ubuntu-latest
container:
image: python:3.11-bookworm
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: prepare environment
run: |
pip install pipenv -U --quiet
pipenv install --dev
apt-get update
apt-get install ffmpeg -y
apt-get install python3-wxgtk4.0 libgtk-3-dev ffmpeg -y
pipenv install --dev

- name: run tests
run: |
Expand All @@ -58,12 +67,14 @@ jobs:
- name: prepare environment
run: |
sudo apt-get update
sudo apt-get install python3.11 --install-recommends ffmpeg -y
sudo apt-get install python3.11 python3.11-dev --install-recommends python3-distutils python3-wxgtk4.0 libgtk-3-dev ffmpeg -y
pip install pipenv -U --quiet
pipenv install --dev

- name: run coverage report
run: |
pipenv run coverage

- name: generate requirements.txt
run: |
pipenv requirements --dev > requirements.txt
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ model/
/.vscode
/.coverage
/coverage.xml
/config.ini
/config.yaml
12 changes: 7 additions & 5 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ python-lint-job:
image: python:3.11-bookworm
script:
- pip install pipenv -U --quiet
- apt-get update
- apt-get install python3-wxgtk4.0 libgtk-3-dev -y
- pipenv install --dev
- pipenv run lint

Expand All @@ -19,9 +21,9 @@ python-test-job:
image: python:3.11-bookworm
script:
- pip install pipenv -U --quiet
- pipenv install --dev
- apt-get update
- apt-get install ffmpeg -y
- apt-get install python3-wxgtk4.0 libgtk-3-dev ffmpeg -y
- pipenv install --dev
- pipenv run test

sonarqube-check:
Expand All @@ -41,10 +43,10 @@ sonarqube-check:
- .sonar/cache
script:
- pip install pipenv -U --quiet
- pipenv install --dev
# TODO:check if this is even debian / ubuntu or alpine and install ffprobe
- sudo apt-get update
- sudo apt-get install ffmpeg -y
- apt-get update
- apt-get install python3.11 --install-recommends python3-wxgtk4.0 libgtk-3-dev ffmpeg -y
- pipenv install --dev
- pipenv run coverage
- sonar-scanner
allow_failure: false
Expand Down
10 changes: 7 additions & 3 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ humanize = "*"
enlighten = "*"
psutil = "*"
apischema = "*"
wxpython = {file = "https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-22.04/wxPython-4.2.1-cp311-cp311-linux_x86_64.whl"}

[dev-packages]
pylint = "*"
Expand All @@ -28,15 +29,18 @@ pytest-subtests = "*"
types-requests = "*"
requests = "*"
chardet = "*"
types-wxpython = "*"
types-pyyaml = "*"

[scripts]
check = "python src/entry.py"
check = "python src/entry.py run"
lint = "bash -c 'pipenv run mypy && pipenv run ruff'"
mypy = "mypy src/ tests/ ffmpeg/ --strict --ignore-missing-imports --enable-incomplete-feature=Unpack "
mypy = "mypy src/ tests/ ffmpeg/ --strict --ignore-missing-imports --warn-unreachable"
ruff = "ruff check src/ tests/ ffmpeg/"
ruff-ci = "ruff check src/ tests/ ffmpeg/ --format=github"
ruff-ci = "ruff check src/ tests/ ffmpeg/ --output-format=github"
ruff-fix = "ruff check src/ tests/ ffmpeg/ --fix"
schema = "python src/entry.py schema"
gui = "python src/entry.py gui"
test = "pytest tests/"
coverage = "bash -c 'coverage run -m pytest tests/ && coverage xml'"
extract_translation = "pygettext3 -d video_language_detect -o locales/video_language_detect.pot src/"
Expand Down
38 changes: 33 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,38 @@ VERSION 2: Breaking changes (how the data ist stored) !
Folder, title etc.


## config.ini example
## config.yaml example

```ini
[settings]
scan_amount = 100
start_position = 0
```yaml
general:
target_file: data/data.json

parser:
root_folder: /my/media/root/folder/
special:
- Extras
- Specials
- Special
video_formats:
- mp4
- mkv
- avi
ignore_files:
- metadata
- extrafanart
- theme-music
exception_on_error: false

scanner:
scanner_type: config
config:
scan_amount: 100
start_position: 0
```


## Current version

```yaml
2.2.0
```
2 changes: 1 addition & 1 deletion locales/de/LC_MESSAGES/video_language_detect.po
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: 2.1.0\n"
"Project-Id-Version: 2.2.0\n"
"POT-Creation-Date: 2023-08-22 21:44+0200\n"
"PO-Revision-Date: 2023-08-22 23:44+0200\n"
"Last-Translator: Totto16 <[email protected]>\n"
Expand Down
2 changes: 1 addition & 1 deletion locales/en/LC_MESSAGES/video_language_detect.po
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: 2.1.0\n"
"Project-Id-Version: 2.2.0\n"
"POT-Creation-Date: 2023-08-22 21:44+0200\n"
"PO-Revision-Date: 2023-08-22 23:45+0200\n"
"Last-Translator: Totto16 <[email protected]>\n"
Expand Down
2 changes: 1 addition & 1 deletion locales/video_language_detect.pot
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: 2.1.0\n"
"Project-Id-Version: 2.2.0\n"
"POT-Creation-Date: 2023-08-22 23:41+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
Expand Down
172 changes: 172 additions & 0 deletions schema/config_schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
{
"$ref": "#/$defs/Config",
"$defs": {
"Config": {
"type": "object",
"properties": {
"general": {
"anyOf": [
{
"$ref": "#/$defs/GeneralConfig"
},
{
"type": "null"
}
]
},
"parser": {
"anyOf": [
{
"$ref": "#/$defs/ParserConfig"
},
{
"type": "null"
}
]
},
"scanner": {
"anyOf": [
{
"$ref": "#/$defs/FullLanguageScannerConfig"
},
{
"$ref": "#/$defs/NoLanguageScannerConfig"
},
{
"$ref": "#/$defs/ConfigScannerConfig"
},
{
"type": "null"
}
]
}
},
"required": [
"general",
"parser",
"scanner"
],
"additionalProperties": false
},
"GeneralConfig": {
"type": "object",
"properties": {
"target_file": {
"type": "string"
}
},
"required": [
"target_file"
],
"additionalProperties": false
},
"ParserConfig": {
"type": "object",
"properties": {
"root_folder": {
"type": "string"
},
"special": {
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"video_formats": {
"type": "array",
"items": {
"type": "string"
},
"minItems": 1,
"uniqueItems": true,
"default": []
},
"ignore_files": {
"type": "array",
"items": {
"type": "string"
},
"default": []
},
"exception_on_error": {
"type": [
"boolean",
"null"
],
"default": true
}
},
"required": [
"root_folder",
"special"
],
"additionalProperties": false
},
"FullLanguageScannerConfig": {
"type": "object",
"properties": {
"scanner_type": {
"type": "string",
"const": "full"
}
},
"required": [
"scanner_type"
],
"additionalProperties": false
},
"NoLanguageScannerConfig": {
"type": "object",
"properties": {
"scanner_type": {
"type": "string",
"const": "nothing"
}
},
"required": [
"scanner_type"
],
"additionalProperties": false
},
"ConfigScannerConfig": {
"type": "object",
"properties": {
"scanner_type": {
"type": "string",
"const": "config"
},
"config": {
"anyOf": [
{
"$ref": "#/$defs/ConfigScannerDict"
},
{
"type": "null"
}
]
}
},
"required": [
"scanner_type",
"config"
],
"additionalProperties": false
},
"ConfigScannerDict": {
"type": "object",
"properties": {
"start_position": {
"type": "integer"
},
"scan_amount": {
"type": "integer"
}
},
"additionalProperties": false
}
},
"$schema": "http://json-schema.org/draft/2020-12/schema#"
}
File renamed without changes.
3 changes: 0 additions & 3 deletions src/classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,6 @@ def get_mean(
new_values,
normalize_percents=normalize_percents,
)
case _: # stupid mypy
msg = "UNREACHABLE"
raise RuntimeError(msg)


class Prediction:
Expand Down
Loading
Loading