chore: update project structure and workflows
- Update .gitignore for new backend structure - Update GitHub workflows for transcriptarr rename - Update launcher.py to use new module name
This commit is contained in:
2
.github/workflows/build_CPU.yml
vendored
2
.github/workflows/build_CPU.yml
vendored
@@ -17,7 +17,7 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Get version from subgen.py
|
- name: Get version from transcriptarr.py
|
||||||
id: get_version
|
id: get_version
|
||||||
run: |
|
run: |
|
||||||
version=$(grep -oP "subgen_version\s*=\s*'\K[^']+" subgen.py)
|
version=$(grep -oP "subgen_version\s*=\s*'\K[^']+" subgen.py)
|
||||||
|
|||||||
2
.github/workflows/build_GPU.yml
vendored
2
.github/workflows/build_GPU.yml
vendored
@@ -17,7 +17,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Get version from subgen.py
|
- name: Get version from transcriptarr.py
|
||||||
id: get_version
|
id: get_version
|
||||||
run: |
|
run: |
|
||||||
version=$(grep -oP "subgen_version\s*=\s*'\K[^']+" subgen.py)
|
version=$(grep -oP "subgen_version\s*=\s*'\K[^']+" subgen.py)
|
||||||
|
|||||||
8
.github/workflows/calver.yml
vendored
8
.github/workflows/calver.yml
vendored
@@ -5,7 +5,7 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- 'main'
|
- 'main'
|
||||||
paths:
|
paths:
|
||||||
- 'subgen.py'
|
- '../../transcriptarr.py'
|
||||||
workflow_dispatch: # Allow manual triggering
|
workflow_dispatch: # Allow manual triggering
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -26,11 +26,11 @@ jobs:
|
|||||||
echo "COMMIT_COUNT=$COMMIT_COUNT"
|
echo "COMMIT_COUNT=$COMMIT_COUNT"
|
||||||
echo "VERSION=${YEAR}.${MONTH}.${COMMIT_COUNT}" >> $GITHUB_ENV
|
echo "VERSION=${YEAR}.${MONTH}.${COMMIT_COUNT}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Update subgen.py with version
|
- name: Update transcriptarr.py with version
|
||||||
run: |
|
run: |
|
||||||
sed -i "s/subgen_version =.*/subgen_version = '${{ env.VERSION }}'/" subgen.py
|
sed -i "s/subgen_version =.*/subgen_version = '${{ env.VERSION }}'/" subgen.py
|
||||||
|
|
||||||
- name: Check if subgen.py was actually changed (compare with HEAD)
|
- name: Check if transcriptarr.py was actually changed (compare with HEAD)
|
||||||
id: check_change
|
id: check_change
|
||||||
run: |
|
run: |
|
||||||
if git diff --quiet HEAD subgen.py; then
|
if git diff --quiet HEAD subgen.py; then
|
||||||
@@ -39,7 +39,7 @@ jobs:
|
|||||||
echo "::set-output name=changed::true"
|
echo "::set-output name=changed::true"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Amend commit if subgen.py changed
|
- name: Amend commit if transcriptarr.py changed
|
||||||
if: steps.check_change.outputs.changed == 'true'
|
if: steps.check_change.outputs.changed == 'true'
|
||||||
env:
|
env:
|
||||||
GIT_AUTHOR_NAME: "McCloudS"
|
GIT_AUTHOR_NAME: "McCloudS"
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -7,6 +7,6 @@
|
|||||||
*.vsix
|
*.vsix
|
||||||
|
|
||||||
#ignore our settings
|
#ignore our settings
|
||||||
subgen.env
|
.env
|
||||||
|
|
||||||
models/
|
models/
|
||||||
20
launcher.py
20
launcher.py
@@ -42,7 +42,7 @@ def prompt_and_save_bazarr_env_variables():
|
|||||||
print(instructions)
|
print(instructions)
|
||||||
env_vars = {
|
env_vars = {
|
||||||
'WHISPER_MODEL': ('Whisper Model', 'Enter the Whisper model you want to run: tiny, tiny.en, base, base.en, small, small.en, medium, medium.en, large, distil-large-v2, distil-medium.en, distil-small.en', 'medium'),
|
'WHISPER_MODEL': ('Whisper Model', 'Enter the Whisper model you want to run: tiny, tiny.en, base, base.en, small, small.en, medium, medium.en, large, distil-large-v2, distil-medium.en, distil-small.en', 'medium'),
|
||||||
'WEBHOOKPORT': ('Webhook Port', 'Default listening port for subgen.py', '9000'),
|
'WEBHOOKPORT': ('Webhook Port', 'Default listening port for transcriptarr.py', '9000'),
|
||||||
'TRANSCRIBE_DEVICE': ('Transcribe Device', 'Set as cpu or gpu', 'gpu'),
|
'TRANSCRIBE_DEVICE': ('Transcribe Device', 'Set as cpu or gpu', 'gpu'),
|
||||||
# Defaulting to False here for the prompt, user can change
|
# Defaulting to False here for the prompt, user can change
|
||||||
'DEBUG': ('Debug', 'Enable debug logging (true/false)', 'False'),
|
'DEBUG': ('Debug', 'Enable debug logging (true/false)', 'False'),
|
||||||
@@ -51,13 +51,13 @@ def prompt_and_save_bazarr_env_variables():
|
|||||||
}
|
}
|
||||||
|
|
||||||
user_input = {}
|
user_input = {}
|
||||||
with open('subgen.env', 'w') as file:
|
with open('.env', 'w') as file:
|
||||||
for var, (description, prompt, default) in env_vars.items():
|
for var, (description, prompt, default) in env_vars.items():
|
||||||
value = input(f"{prompt} [{default}]: ") or default
|
value = input(f"{prompt} [{default}]: ") or default
|
||||||
file.write(f"{var}={value}\n")
|
file.write(f"{var}={value}\n")
|
||||||
print("Environment variables have been saved to subgen.env")
|
print("Environment variables have been saved to .env")
|
||||||
|
|
||||||
def load_env_variables(env_filename='subgen.env'):
|
def load_env_variables(env_filename='.env'):
|
||||||
try:
|
try:
|
||||||
with open(env_filename, 'r') as file:
|
with open(env_filename, 'r') as file:
|
||||||
for line in file:
|
for line in file:
|
||||||
@@ -93,7 +93,7 @@ def main():
|
|||||||
# Changed: action='store_true'
|
# Changed: action='store_true'
|
||||||
parser.add_argument('-a', '--append', action='store_true', help="Append 'Transcribed by whisper' (overrides .env and external ENV)")
|
parser.add_argument('-a', '--append', action='store_true', help="Append 'Transcribed by whisper' (overrides .env and external ENV)")
|
||||||
parser.add_argument('-u', '--update', action='store_true', help="Update Subgen")
|
parser.add_argument('-u', '--update', action='store_true', help="Update Subgen")
|
||||||
parser.add_argument('-x', '--exit-early', action='store_true', help="Exit without running subgen.py")
|
parser.add_argument('-x', '--exit-early', action='store_true', help="Exit without running transcriptarr.py")
|
||||||
parser.add_argument('-s', '--setup-bazarr', action='store_true', help="Prompt for common Bazarr setup parameters and save them for future runs")
|
parser.add_argument('-s', '--setup-bazarr', action='store_true', help="Prompt for common Bazarr setup parameters and save them for future runs")
|
||||||
parser.add_argument('-b', '--branch', type=str, default='main', help='Specify the branch to download from')
|
parser.add_argument('-b', '--branch', type=str, default='main', help='Specify the branch to download from')
|
||||||
parser.add_argument('-l', '--launcher-update', action='store_true', help="Update launcher.py and re-launch")
|
parser.add_argument('-l', '--launcher-update', action='store_true', help="Update launcher.py and re-launch")
|
||||||
@@ -126,7 +126,7 @@ def main():
|
|||||||
# After saving, load them immediately for this run
|
# After saving, load them immediately for this run
|
||||||
load_env_variables()
|
load_env_variables()
|
||||||
else:
|
else:
|
||||||
# Load if not setting up, assuming subgen.env might exist
|
# Load if not setting up, assuming .env might exist
|
||||||
load_env_variables()
|
load_env_variables()
|
||||||
|
|
||||||
|
|
||||||
@@ -157,7 +157,7 @@ def main():
|
|||||||
|
|
||||||
if not os.path.exists(subgen_script_to_run) or args.update or convert_to_bool(os.getenv('UPDATE')):
|
if not os.path.exists(subgen_script_to_run) or args.update or convert_to_bool(os.getenv('UPDATE')):
|
||||||
print(f"Downloading {subgen_script_to_run} from GitHub branch {branch_name}...")
|
print(f"Downloading {subgen_script_to_run} from GitHub branch {branch_name}...")
|
||||||
download_from_github(f"https://raw.githubusercontent.com/McCloudS/subgen/{branch_name}/subgen.py", subgen_script_to_run)
|
download_from_github(f"https://raw.githubusercontent.com/McCloudS/subgen/{branch_name}/transcriptarr.py", subgen_script_to_run)
|
||||||
print(f"Downloading {language_code_script_to_download} from GitHub branch {branch_name}...")
|
print(f"Downloading {language_code_script_to_download} from GitHub branch {branch_name}...")
|
||||||
download_from_github(f"https://raw.githubusercontent.com/McCloudS/subgen/{branch_name}/language_code.py", language_code_script_to_download)
|
download_from_github(f"https://raw.githubusercontent.com/McCloudS/subgen/{branch_name}/language_code.py", language_code_script_to_download)
|
||||||
|
|
||||||
@@ -165,8 +165,8 @@ def main():
|
|||||||
print(f"{subgen_script_to_run} exists and UPDATE is set to False, skipping download.")
|
print(f"{subgen_script_to_run} exists and UPDATE is set to False, skipping download.")
|
||||||
|
|
||||||
if not args.exit_early:
|
if not args.exit_early:
|
||||||
#print(f"DEBUG environment variable for subgen.py: {os.getenv('DEBUG')}")
|
#print(f"DEBUG environment variable for transcriptarr.py: {os.getenv('DEBUG')}")
|
||||||
#print(f"APPEND environment variable for subgen.py: {os.getenv('APPEND')}")
|
#print(f"APPEND environment variable for transcriptarr.py: {os.getenv('APPEND')}")
|
||||||
print(f'Launching {subgen_script_to_run}')
|
print(f'Launching {subgen_script_to_run}')
|
||||||
try:
|
try:
|
||||||
subprocess.run([python_cmd, '-u', subgen_script_to_run], check=True)
|
subprocess.run([python_cmd, '-u', subgen_script_to_run], check=True)
|
||||||
@@ -176,7 +176,7 @@ def main():
|
|||||||
print(f"Error running {subgen_script_to_run}: {e}")
|
print(f"Error running {subgen_script_to_run}: {e}")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print("Not running subgen.py: -x or --exit-early set")
|
print("Not running transcriptarr.py: -x or --exit-early set")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|||||||
Reference in New Issue
Block a user