Skip to content

Commit 9948839

Browse files
committed
Initial commit with cleaned history
0 parents  commit 9948839

14 files changed

+581
-0
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: "[BUG] "
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '...'
17+
3. Scroll down to '...'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem.
25+
26+
**Desktop (please complete the following information):**
27+
- OS: [e.g. Linux Arch]
28+
- Kernel version [e.g. 6.10.10-arch1-1]
29+
30+
**Additional context**
31+
Add any other context about the problem here.

.github/ISSUE_TEMPLATE/config.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Bug Report
4+
url: https://github.com/fam007e/SRT_Trans/issues/new?template=bug_report.md
5+
about: File a bug report for the project.
6+
- name: Feature Request
7+
url: https://github.com/fam007e/SRT_Trans/issues/new?template=feature_request.md
8+
about: Suggest a new feature for the project.
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: "[FEATURE] "
5+
labels: enhancement
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex: I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

.github/PULL_REQUEST_TEMPLATE.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
## Description
2+
3+
Please include a summary of the changes and the related issue. Please also include relevant motivation and context.
4+
5+
Fixes # (issue)
6+
7+
## Type of change
8+
9+
Please delete options that are not relevant.
10+
11+
- [ ] Bug fix (non-breaking change which fixes an issue)
12+
- [ ] New feature (non-breaking change which adds functionality)
13+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
14+
- [ ] Documentation update
15+
16+
## Checklist:
17+
18+
- [ ] My code follows the style guidelines of this project
19+
- [ ] I have performed a self-review of my own code
20+
- [ ] I have commented my code, particularly in hard-to-understand areas
21+
- [ ] I have made corresponding changes to the documentation
22+
- [ ] My changes generate no new warnings
23+
- [ ] Any dependent changes have been merged and published in downstream modules

.github/workflows/build-release.yml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Release Binary
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- srt_tr.py
9+
10+
jobs:
11+
release:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v2
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v2
20+
with:
21+
python-version: '3.10'
22+
23+
- name: Install Dependencies
24+
run: |
25+
pip install -r requirements.txt
26+
pip install pyinstaller
27+
28+
- name: Build binary
29+
run: |
30+
pyinstaller --onefile --name srt_tr_win.exe srt_tr.py
31+
pyinstaller --onefile --name srt_tr_linux srt_tr.py
32+
chmod +x dist/*
33+
34+
- name: Set up GitHub CLI
35+
run: |
36+
sudo apt-get install -y gh
37+
38+
- name: Authenticate GitHub CLI
39+
run: |
40+
echo "${{ secrets.SRT_TR_TOKEN }}" | gh auth login --with-token
41+
42+
- name: Create release
43+
id: create_release
44+
run: |
45+
version=$(date +'%Y.%m.%d')".$(git rev-list --count HEAD)"
46+
changelog=$(git log --oneline --pretty=format:"* %s (%h)" | head -n 20)
47+
echo "Changelog: $changelog" > dist/changelog.txt
48+
49+
gh release create "v${version}" dist/srt_tr_win.exe dist/srt_tr_linux dist/changelog.txt --title "Release v${version}" --notes "$changelog"
50+
51+
- name: Clean up binaries
52+
run: |
53+
rm dist/srt_tr_win.exe dist/srt_tr_linux

.github/workflows/discord-webhook.yml

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Discord Webhook Notification
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [opened, closed, reopened]
9+
pull_request_review:
10+
types: [submitted, edited, dismissed]
11+
issues:
12+
types: [opened, closed, reopened]
13+
release:
14+
types: [published, edited, released]
15+
check_run:
16+
types: [completed]
17+
check_suite:
18+
types: [completed]
19+
deployment:
20+
types: [created, completed]
21+
22+
jobs:
23+
notify:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Send notification to Discord for Push
27+
if: github.event_name == 'push'
28+
run: |
29+
curl -H "Content-Type: application/json" \
30+
-d "{\"content\": \"New push event in repository: ${{ github.repository }} by ${{ github.actor }}.\"}" \
31+
${{ secrets.DISCORD_WEBHOOK_URL }}
32+
33+
- name: Send notification to Discord for Pull Request
34+
if: github.event_name == 'pull_request'
35+
run: |
36+
curl -H "Content-Type: application/json" \
37+
-d "{\"content\": \"New pull request event in repository: ${{ github.repository }} by ${{ github.actor }}.\"}" \
38+
${{ secrets.DISCORD_WEBHOOK_URL }}
39+
40+
- name: Send notification to Discord for Pull Request Review
41+
if: github.event_name == 'pull_request_review'
42+
run: |
43+
curl -H "Content-Type: application/json" \
44+
-d "{\"content\": \"New pull request review event in repository: ${{ github.repository }} by ${{ github.actor }}.\"}" \
45+
${{ secrets.DISCORD_WEBHOOK_URL }}
46+
47+
- name: Send notification to Discord for Issues
48+
if: github.event_name == 'issues'
49+
run: |
50+
curl -H "Content-Type: application/json" \
51+
-d "{\"content\": \"New issue event in repository: ${{ github.repository }} by ${{ github.actor }}.\"}" \
52+
${{ secrets.DISCORD_WEBHOOK_URL }}
53+
54+
- name: Send notification to Discord for Release
55+
if: github.event_name == 'release'
56+
run: |
57+
curl -H "Content-Type: application/json" \
58+
-d "{\"content\": \"New release event in repository: ${{ github.repository }} by ${{ github.actor }}.\"}" \
59+
${{ secrets.DISCORD_WEBHOOK_URL }}
60+
61+
- name: Send notification to Discord for Check Run
62+
if: github.event_name == 'check_run'
63+
run: |
64+
curl -H "Content-Type: application/json" \
65+
-d "{\"content\": \"New check run completed in repository: ${{ github.repository }}.\"}" \
66+
${{ secrets.DISCORD_WEBHOOK_URL }}
67+
68+
- name: Send notification to Discord for Check Suite
69+
if: github.event_name == 'check_suite'
70+
run: |
71+
curl -H "Content-Type: application/json" \
72+
-d "{\"content\": \"New check suite completed in repository: ${{ github.repository }}.\"}" \
73+
${{ secrets.DISCORD_WEBHOOK_URL }}
74+
75+
- name: Send notification to Discord for Deployment
76+
if: github.event_name == 'deployment'
77+
run: |
78+
curl -H "Content-Type: application/json" \
79+
-d "{\"content\": \"New deployment event in repository: ${{ github.repository }}.\"}" \
80+
${{ secrets.DISCORD_WEBHOOK_URL }}

.github/workflows/issue-slash-cmd.yml

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Close issue on /close
2+
3+
on:
4+
issue_comment:
5+
types: [created, edited]
6+
7+
jobs:
8+
closeIssueOnClose:
9+
# Skip this job if the comment was created/edited on a PR
10+
if: ${{ !github.event.issue.pull_request }}
11+
runs-on: ubuntu-latest
12+
permissions:
13+
issues: write
14+
pull-requests: none
15+
contents: read
16+
17+
steps:
18+
- run: echo "command=false" >> $GITHUB_ENV
19+
20+
- name: Check for /close command
21+
id: check_close_command
22+
run: |
23+
if [[ "${{ contains(github.event.comment.body, '/close') }}" == "true" ]]; then
24+
echo "command=true" >> $GITHUB_ENV
25+
echo "close_command=true" >> $GITHUB_ENV
26+
echo "reopen_command=false" >> $GITHUB_ENV
27+
else
28+
echo "close_command=false" >> $GITHUB_ENV
29+
fi
30+
31+
- name: Check for /open or /reopen command
32+
id: check_reopen_command
33+
run: |
34+
if [[ "${{ contains(github.event.comment.body, '/open') }}" == "true" ]] || [[ "${{ contains(github.event.comment.body, '/reopen') }}" == "true" ]]; then
35+
echo "command=true" >> $GITHUB_ENV
36+
echo "reopen_command=true" >> $GITHUB_ENV
37+
echo "close_command=false" >> $GITHUB_ENV
38+
else
39+
echo "reopen_command=false" >> $GITHUB_ENV
40+
fi
41+
42+
- name: Check if the user is allowed
43+
id: check_user
44+
if: env.command == 'true'
45+
run: |
46+
ALLOWED_USERS=("fam007e")
47+
if [[ " ${ALLOWED_USERS[@]} " =~ " ${{ github.event.comment.user.login }} " ]]; then
48+
echo "user=true" >> $GITHUB_ENV
49+
else
50+
echo "user=false" >> $GITHUB_ENV
51+
fi
52+
53+
- name: Close issue if conditions are met
54+
if: env.close_command == 'true' && env.user == 'true'
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
ISSUE_NUMBER: ${{ github.event.issue.number }}
58+
run: |
59+
echo Closing the issue...
60+
if [[ "${{ contains(github.event.comment.body, 'not planned') }}" == "true" ]]; then
61+
gh issue close $ISSUE_NUMBER --repo ${{ github.repository }} --reason 'not planned'
62+
else
63+
gh issue close $ISSUE_NUMBER --repo ${{ github.repository }}
64+
fi
65+
66+
- name: Reopen issue if conditions are met
67+
if: env.reopen_command == 'true' && env.user == 'true'
68+
env:
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
ISSUE_NUMBER: ${{ github.event.issue.number }}
71+
run: |
72+
echo Reopening the issue...
73+
gh issue reopen $ISSUE_NUMBER --repo ${{ github.repository }}

.github/workflows/pylint.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Pylint
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
python-version: ["3.8", "3.9", "3.10"]
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Set up Python ${{ matrix.python-version }}
14+
uses: actions/setup-python@v3
15+
with:
16+
python-version: ${{ matrix.python-version }}
17+
- name: Install dependencies
18+
run: |
19+
python -m pip install --upgrade pip
20+
pip install pylint tqdm deep-translator
21+
- name: Analysing the code with pylint
22+
run: |
23+
pylint $(git ls-files '*.py')

.github/workflows/python-publish.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# This workflow will upload a Python Package using Twine when a release is created
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
3+
4+
name: Upload Python Package
5+
6+
on:
7+
release:
8+
types: [published]
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
deploy:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v3
23+
with:
24+
python-version: '3.x'
25+
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install build twine deep-translator tqdm
30+
31+
- name: Build package
32+
run: python -m build
33+
34+
- name: Publish package to PyPI
35+
uses: pypa/[email protected]
36+
with:
37+
user: __token__
38+
password: ${{ secrets.PYPI_API_TOKEN }}

LICENSE

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
MIT License
2+
3+
Copyright (c) 2024 fam007e
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+
23+
---
24+
25+
This project is open-source and contributions are welcome! Please feel free to
26+
fork this repository, submit issues, and create pull requests to improve the
27+
code and add new features.

0 commit comments

Comments
 (0)