Skip to content
This repository was archived by the owner on May 1, 2025. It is now read-only.

Commit efba4f9

Browse files
committed
add format to makefile and format
1 parent 09161ce commit efba4f9

File tree

8 files changed

+37
-20
lines changed

8 files changed

+37
-20
lines changed

Makefile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
py = python3
12
video = 'xHP6lpOepk4'
23
env = $(shell cat .env | sed 's|\(.*\)|\-e \1|g')
34
DFLAGS =
@@ -7,7 +8,7 @@ ifdef NOCACHE
78
DFLAGS += --no-cache
89
endif
910

10-
.PHONY: build update start stop spawn reboot
11+
.PHONY: build update start stop spawn reboot format
1112

1213
build:
1314
@docker-compose build $(DFLAGS)
@@ -24,6 +25,18 @@ spawn:
2425

2526
reboot: stop spawn
2627

28+
.gitignore: requirements.txt
29+
@$(py) -m pip install -r requirements.txt
30+
@touch .gitignore
31+
32+
node_modules: package.json
33+
@npm i
34+
35+
format: .gitignore node_modules
36+
@$(py) -m black watcher
37+
@$(py) -m isort watcher
38+
@./node_modules/eslint/bin/eslint.js --fix watcher/public
39+
2740
.pull:
2841
@git stash
2942
@git reset --hard HEAD

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
black
2+
isort

watcher/server/autoselenium/chrome.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ def __init__(self, *args, **kwargs):
3939
sb.Popen = old_popen
4040
self.has_quit = False
4141

42-
4342
def quit(self):
4443
try:
4544
if not self.has_quit:
@@ -55,12 +54,10 @@ def __del__(self):
5554

5655
def get_selenium(display: bool = False) -> webdriver.Chrome:
5756
options = __get_options(display)
58-
with open("bruh", 'w+') as fout:
57+
with open("bruh", "w+") as fout:
5958
p = str(Path(__platform_drivers[su.platform]).absolute())
6059
print(p, Path(p).exists(), file=fout)
61-
browser = ChromeDriver(
62-
executable_path=p, options=options
63-
)
60+
browser = ChromeDriver(executable_path=p, options=options)
6461
return browser
6562

6663

watcher/server/indexfinder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
from pathlib import Path
21
import json
32
import sys
3+
from pathlib import Path
44

55
static = Path(__file__).resolve().parent / "../"
66

watcher/server/run_audio.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99
from tempfile import TemporaryFile
1010
from threading import Event, Thread
1111

12+
import requests
1213
from fastapi import FastAPI, Response
1314
from fastapi.middleware.cors import CORSMiddleware
14-
import requests
15-
1615
from models import Timestamp
1716
from yt import YTLiveService
1817

watcher/server/server.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
from threading import Thread
88
from typing import Optional
99

10-
import translators as ts
1110
import aiohttp
11+
import translators as ts
1212
from autoselenium import chrome
13-
from workers import WebSpeechSlave
14-
from yt import YTLiveService
1513
from fastapi import FastAPI
1614
from fastapi.staticfiles import StaticFiles
1715
from models import ClientError, Log
1816
from pyvirtualdisplay import Display
1917
from transcribe import aio_write_transcripts
18+
from workers import WebSpeechSlave
19+
from yt import YTLiveService
2020

2121
static = Path(__file__).resolve().parent / "../public"
2222

@@ -91,5 +91,6 @@ async def info():
9191
async def root():
9292
return {"message": "Hello World"}
9393

94+
9495
web_speech = WebSpeechSlave("http://localhost:42069")
9596
web_speech.start()

watcher/server/transcribe.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@ async def aio_write_transcripts(
77
video: str, transcript: str, translation: str, srtTimes: List[str], timestamp: float
88
):
99
with open("transcripts.txt", "a+") as fout:
10-
json.dump({
11-
"video": video,
12-
"transcript": transcript,
13-
"translation": translation,
14-
"srtTimes": srtTimes,
15-
"timestamp": timestamp
16-
}, fout)
17-
fout.write('\n')
10+
json.dump(
11+
{
12+
"video": video,
13+
"transcript": transcript,
14+
"translation": translation,
15+
"srtTimes": srtTimes,
16+
"timestamp": timestamp,
17+
},
18+
fout,
19+
)
20+
fout.write("\n")

watcher/server/workers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55

66
from autoselenium import chrome
77

8+
89
class WebSpeechSlave(Thread):
910
"""
1011
Opens up web speech in the browser
1112
1213
export REFRESH_CHROME="1" to enable refreshing
1314
"""
15+
1416
refresh_interval = 60 * 15
1517

1618
def __init__(self, host: str):

0 commit comments

Comments
 (0)