Compare commits

..

5 commits

Author SHA1 Message Date
e2330a15c4
Cleanup Makefile, add Caddy 2024-05-28 10:34:01 +04:00
9b5b09011e
Add dev server Caddyfile 2024-05-28 10:33:42 +04:00
1e1fe6dd16
Config: use None if no proxy specified 2024-05-28 09:09:59 +04:00
21dbc8659d
Fix exception handler in test
`{err:r}` -> `{err!r}`
2024-05-28 09:05:42 +04:00
3e955b2d8f
Update deps 2024-05-28 09:03:26 +04:00
6 changed files with 21 additions and 17 deletions

6
Caddyfile Normal file
View file

@ -0,0 +1,6 @@
http://localhost:4010 {
file_server {
root ./frontend
}
reverse_proxy /ws 127.0.0.1:4009
}

View file

@ -1,4 +1,4 @@
.PHONY: run test build frontend backend .PHONY: run run-backend run-frontend test
run: run:
# See backend/config.py for more fields # See backend/config.py for more fields
@ -6,15 +6,11 @@ run:
COOKIES_DIR=cookies \ COOKIES_DIR=cookies \
python3 ./backend/main.py python3 ./backend/main.py
run-backend: run
run-frontend:
@echo 'Only for development environment!'
caddy run
test: test:
@python3 -m unittest discover -vcs ./backend python3 -m unittest discover -vcs ./backend
build:
make frontend
make backend
frontend:
@cd frontend && echo 'Not implemented'
backend:
@cd backend && echo 'Not implemented'

View file

@ -21,7 +21,7 @@ class Config:
) )
# Proxy URL for yt_proxied downloader (can be used for geo-restricted content) # Proxy URL for yt_proxied downloader (can be used for geo-restricted content)
self.yt_proxy = os.getenv('YT_PROXY') or 'http://127.0.0.1:1080' self.yt_proxy = os.getenv('YT_PROXY') or None
self.save_lyrics = _parse_bool(os.getenv('SAVE_LYRICS'), True) self.save_lyrics = _parse_bool(os.getenv('SAVE_LYRICS'), True)
self.save_cover = _parse_bool(os.getenv('SAVE_COVER'), True) self.save_cover = _parse_bool(os.getenv('SAVE_COVER'), True)

View file

@ -69,7 +69,7 @@ class TestPostProcessorsOnFakeData(TestCase):
if ret != 0: if ret != 0:
raise RuntimeError(f'FFmpeg returned {ret} exit code') raise RuntimeError(f'FFmpeg returned {ret} exit code')
except Exception as err: except Exception as err:
self.skipTest(f'Error while writing empty MP3: {err:r}') self.skipTest(f'Error while writing empty MP3: {err!r}')
id3pp.ID3TagsPP().run(INFO_AFTER) id3pp.ID3TagsPP().run(INFO_AFTER)

View file

@ -22,7 +22,9 @@ class _CreateYDL:
@staticmethod @staticmethod
def yt_proxied() -> YoutubeDL: def yt_proxied() -> YoutubeDL:
ydl = _CreateYDL.youtube() ydl = _CreateYDL.youtube()
ydl.params['proxy'] = config.get().yt_proxy proxy = config.get().yt_proxy
if proxy is not None:
ydl.params['proxy'] = proxy
return ydl return ydl
@staticmethod @staticmethod

View file

@ -1,5 +1,5 @@
websockets==12.0 websockets==12.0
yt-dlp==2024.4.9 yt-dlp==2024.5.27
mutagen==1.47.0 mutagen==1.47.0
urllib3==2.2.1 urllib3==2.2.1
lxml==5.2.1 lxml==5.2.2