Skip to content

Commit

Permalink
Initial commit (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tohrusky authored Aug 19, 2024
1 parent 64db932 commit 3a2d94d
Show file tree
Hide file tree
Showing 22 changed files with 951 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/CI-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: CI-test

env:
GITHUB_ACTIONS: true

on:
push:
branches: ["main"]
paths-ignore:
- "**.md"
- "LICENSE"

pull_request:
branches: ["main"]
paths-ignore:
- "**.md"
- "LICENSE"

workflow_dispatch:

jobs:
CI:
strategy:
matrix:
os-version: ["ubuntu-20.04", "macos-13", "windows-latest"]
python-version: ["3.10"]
poetry-version: ["1.8.3"]

runs-on: ${{ matrix.os-version }}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ matrix.poetry-version }}

- uses: FedericoCarboni/setup-ffmpeg@v3
id: setup-ffmpeg
with:
ffmpeg-version: release

- name: Test
run: |
pip install numpy==1.26.4
pip install pre-commit pytest mypy ruff types-requests pytest-cov coverage pydantic openai openai-whisper requests beautifulsoup4 tenacity pysrt
make lint
make test
- name: Codecov
if: matrix.os-version == 'ubuntu-20.04'
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
34 changes: 34 additions & 0 deletions .github/workflows/Release-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Release-pypi

on:
workflow_dispatch:

jobs:
Pypi:
strategy:
matrix:
python-version: ["3.10"]
poetry-version: ["1.8.3"]

runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ matrix.poetry-version }}

- name: Build package
run: |
make build
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API }}
165 changes: 165 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

*.DS_Store

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml
.pdm-python
.pdm-build/

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/
/.ruff_cache/

/assets/*.srt
/assets/*.mp3
43 changes: 43 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-json
- id: check-yaml
- id: check-xml
- id: check-toml

# autofix json, yaml, markdown...
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
hooks:
- id: prettier

# autofix toml
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.12.0
hooks:
- id: pretty-format-toml
args: [--autofix]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.6
hooks:
- id: ruff-format
- id: ruff
args: [--fix, --exit-non-zero-on-fix]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.7.1
hooks:
- id: mypy
args: [yuisub, tests]
pass_filenames: false
additional_dependencies:
- types-requests
- types-certifi
- pytest
- pydantic
- tenacity
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.DEFAULT_GOAL := default

.PHONY: test
test:
poetry run pytest --cov=yuisub --cov-report=xml --cov-report=html

.PHONY: lint
lint:
poetry run pre-commit install
poetry run pre-commit run --all-files

.PHONY: build
build:
poetry build --format wheel
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# yuisub

Auto translation of new anime episodes based on Yui-MHCP001
51 changes: 51 additions & 0 deletions assets/eng.srt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
1
00:00:06,520 --> 00:00:07,790
<font face="Trebuchet MS" size="24">Masachika-sama.</font>

2
00:00:11,770 --> 00:00:13,110
<font face="Trebuchet MS" size="24">Masachika-sama.</font>

3
00:00:14,520 --> 00:00:15,500
<font face="Trebuchet MS" size="24">Ayano...</font>

4
00:00:16,010 --> 00:00:17,570
<font face="Trebuchet MS" size="24">You need something?</font>

5
00:00:17,570 --> 00:00:19,890
<font face="Trebuchet MS" size="24">I apologize for startling you.</font>

6
00:00:19,890 --> 00:00:22,870
<font face="Trebuchet MS" size="24">May I have a moment of your time?</font>

7
00:00:23,330 --> 00:00:24,940
<font face="Trebuchet MS" size="24">Uh, okay.</font>

8
00:00:24,940 --> 00:00:26,620
<font face="Trebuchet MS" size="24">Thank you.</font>

9
00:00:26,620 --> 00:00:27,560
<font face="Trebuchet MS" size="24">Please follow me.</font>

10
00:00:28,420 --> 00:00:31,940
<font face="Trebuchet MS" size="24"><i>She's like a ninja. Never fails to amaze me.</i></font>

11
00:01:50,580 --> 00:01:51,250
<font size="20"><b><font color="#fafcea">{\an7}<font size="35">Sometimes</font></font></b></font>

12
00:01:51,250 --> 00:01:52,000
<font size="20"><font face="Times New Roman"><b><font color="#4d402e"><font size="35">{\an8}in Russian</font></font></b></font></font>

13
00:01:52,000 --> 00:01:52,750
<font size="20"><font face="Times New Roman"><b><font color="#4d402e"><font size="35">{\an8}Hides Her</font></font></b></font></font>
Binary file added assets/test.mp3
Binary file not shown.
2 changes: 2 additions & 0 deletions poetry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
virtualenvs.create = false
virtualenvs.options.system-site-packages = true
Loading

0 comments on commit 3a2d94d

Please sign in to comment.