Skip to content

Commit 2a00e87

Browse files
Merge development into master
2 parents 920853d + b9d0236 commit 2a00e87

File tree

108 files changed

+6864
-1332
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+6864
-1332
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,17 @@ on:
1616
branches: [development]
1717

1818
env:
19+
ROOT_DIRECTORY: .
1920
UI_DIRECTORY: ./frontend
21+
SCRIPTS_DIRECTORY: .github/scripts
2022
UI_ARTIFACT_NAME: ui
2123

2224
jobs:
2325
Frontend:
2426
runs-on: ubuntu-latest
2527
steps:
2628
- name: Checkout repository
27-
uses: actions/checkout@v4
29+
uses: actions/checkout@v5
2830

2931
- name: Cache node_modules
3032
uses: actions/cache@v4
@@ -34,7 +36,7 @@ jobs:
3436
restore-keys: ${{ runner.os }}-modules-
3537

3638
- name: Setup NodeJS
37-
uses: actions/setup-node@v4
39+
uses: actions/setup-node@v5
3840
with:
3941
node-version-file: "${{ env.UI_DIRECTORY }}/.nvmrc"
4042

@@ -71,17 +73,23 @@ jobs:
7173
runs-on: ubuntu-latest
7274
needs: Frontend
7375

76+
strategy:
77+
fail-fast: false
78+
matrix:
79+
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12', '3.13' ]
80+
name: Python ${{ matrix.python-version }} backend
81+
7482
steps:
7583
- name: Checkout repository
76-
uses: actions/checkout@v4
84+
uses: actions/checkout@v5
7785

78-
- name: Set up Python 3.8
79-
uses: actions/setup-python@v5
86+
- name: Set up Python ${{ matrix.python-version }}
87+
uses: actions/setup-python@v6
8088
with:
81-
python-version: "3.8"
89+
python-version: ${{ matrix.python-version }}
8290

8391
- name: Install UI
84-
uses: actions/download-artifact@v4
92+
uses: actions/download-artifact@v5
8593
with:
8694
name: ${{ env.UI_ARTIFACT_NAME }}
8795
path: "${{ env.UI_DIRECTORY }}/build"
@@ -91,15 +99,4 @@ jobs:
9199

92100
- name: Unit Tests
93101
run: |
94-
python3 bazarr.py --no-update &
95-
PID=$!
96-
sleep 15
97-
if kill -s 0 $PID
98-
then
99-
echo "**** Bazarr launch successful ****"
100-
kill $PID
101-
exit 0
102-
else
103-
echo "**** Bazarr launch failed ****"
104-
exit 1
105-
fi
102+
bash '${{ env.SCRIPTS_DIRECTORY }}/build_test.sh'

.github/workflows/release_beta_to_dev.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
exit 1
1919
2020
- name: Checkout
21-
uses: actions/checkout@v4
21+
uses: actions/checkout@v5
2222
with:
2323
fetch-depth: ${{ env.FETCH_DEPTH }}
2424
ref: development
@@ -36,12 +36,12 @@ jobs:
3636
restore-keys: ${{ runner.os }}-modules-
3737

3838
- name: Setup NodeJS
39-
uses: actions/setup-node@v4
39+
uses: actions/setup-node@v5
4040
with:
4141
node-version-file: "${{ env.UI_DIRECTORY }}/.nvmrc"
4242

4343
- name: Install Global Tools
44-
run: npm install -g release-it auto-changelog
44+
run: npm install -g release-it@v16.3.0 auto-changelog
4545

4646
- name: Install UI Dependencies
4747
run: npm install

.github/workflows/release_dev_to_master.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
exit 1
2323
2424
- name: Checkout
25-
uses: actions/checkout@v4
25+
uses: actions/checkout@v5
2626
with:
2727
fetch-depth: 0
2828
ref: development
@@ -38,12 +38,12 @@ jobs:
3838
restore-keys: ${{ runner.os }}-modules-
3939

4040
- name: Setup NodeJS
41-
uses: actions/setup-node@v4
41+
uses: actions/setup-node@v5
4242
with:
4343
node-version-file: "${{ env.UI_DIRECTORY }}/.nvmrc"
4444

4545
- name: Install Global Tools
46-
run: npm install -g release-it auto-changelog
46+
run: npm install -g release-it@v16.3.0 auto-changelog
4747

4848
- name: Install UI Dependencies
4949
run: npm install
@@ -64,7 +64,7 @@ jobs:
6464
runs-on: ubuntu-latest
6565
steps:
6666
- name: Checkout
67-
uses: actions/checkout@v4
67+
uses: actions/checkout@v5
6868

6969
- name: Merge development -> master
7070
uses: devmasx/[email protected]

.github/workflows/test_bazarr_execution.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,16 @@ jobs:
66
runs-on: ubuntu-latest
77
env:
88
ROOT_DIRECTORY: .
9+
UI_DIRECTORY: ./frontend
910
SCRIPTS_DIRECTORY: .github/scripts
1011
FETCH_DEPTH: 15 # Should be enough
12+
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12', '3.13' ]
17+
name: Python ${{ matrix.python-version }} test
18+
1119
steps:
1220
- name: Validate branch
1321
if: ${{ github.ref != 'refs/heads/development' }}
@@ -16,13 +24,13 @@ jobs:
1624
exit 1
1725
1826
- name: Checkout
19-
uses: actions/checkout@v4
27+
uses: actions/checkout@v5
2028
with:
2129
fetch-depth: ${{ env.FETCH_DEPTH }}
2230
ref: development
2331

2432
- name: Setup NodeJS
25-
uses: actions/setup-node@v4
33+
uses: actions/setup-node@v5
2634
with:
2735
node-version-file: "${{ env.UI_DIRECTORY }}/.nvmrc"
2836

@@ -34,10 +42,10 @@ jobs:
3442
run: npm run build
3543
working-directory: ${{ env.UI_DIRECTORY }}
3644

37-
- name: Set up Python 3.8
38-
uses: actions/setup-python@v5
45+
- name: Set up Python ${{ matrix.python-version }}
46+
uses: actions/setup-python@v6
3947
with:
40-
python-version: "3.8"
48+
python-version: ${{ matrix.python-version }}
4149

4250
- name: Install Python dependencies
4351
run: |

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ If you need something that is not already part of Bazarr, feel free to create a
7979
- Subs4Series
8080
- Subscene
8181
- Subscenter
82+
- SubsRo
8283
- Subsunacs.net
8384
- SubSynchro
8485
- Subtitrari-noi.ro

bazarr.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
from bazarr.app.get_args import args
1111
from bazarr.literals import EXIT_PYTHON_UPGRADE_NEEDED, EXIT_NORMAL, FILE_RESTART, FILE_STOP, ENV_RESTARTFILE, ENV_STOPFILE, EXIT_INTERRUPT
1212

13+
# always flush print statements
14+
sys.stdout.reconfigure(line_buffering=True)
1315

1416
def exit_program(status_code):
1517
print(f'Bazarr exited with status code {status_code}.')
@@ -63,8 +65,11 @@ def start_bazarr():
6365

6466

6567
def terminate_child():
68+
global child_process
6669
print(f"Terminating child process with PID {child_process.pid}")
67-
child_process.terminate()
70+
if child_process.poll() is None: # Process is still running
71+
child_process.terminate() # Send termination signal
72+
child_process.wait() # Ensure it exits
6873

6974

7075
def get_stop_status_code(input_file):
@@ -132,7 +137,7 @@ def interrupt_handler(signum, frame):
132137
interrupted = True
133138
print('Handling keyboard interrupt...')
134139
else:
135-
if not is_process_running(child_process):
140+
if not is_process_running(child_process.pid):
136141
# this will be caught by the main loop below
137142
raise SystemExit(EXIT_INTERRUPT)
138143

bazarr/api/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from .subtitles import api_ns_list_subtitles
1414
from .system import api_ns_list_system
1515
from .webhooks import api_ns_list_webhooks
16+
from .plex import api_ns_list_plex
1617
from .swaggerui import swaggerui_api_params
1718

1819
api_ns_list = [
@@ -26,6 +27,7 @@
2627
api_ns_list_subtitles,
2728
api_ns_list_system,
2829
api_ns_list_webhooks,
30+
api_ns_list_plex,
2931
]
3032

3133
authorizations = {

bazarr/api/plex/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# coding=utf-8
2+
3+
from flask_restx import Namespace
4+
api_ns_plex = Namespace('Plex Authentication', description='Plex OAuth and server management')
5+
6+
from .oauth import * # noqa
7+
api_ns_list_plex = [api_ns_plex]

bazarr/api/plex/exceptions.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# coding=utf-8
2+
3+
class PlexAuthError(Exception):
4+
def __init__(self, message, status_code=500, error_code=None):
5+
super().__init__(message)
6+
self.message = message
7+
self.status_code = status_code
8+
self.error_code = error_code
9+
10+
class InvalidTokenError(PlexAuthError):
11+
def __init__(self, message="Invalid or malformed Plex authentication token. Please re-authenticate with Plex."):
12+
super().__init__(message, status_code=401, error_code="INVALID_TOKEN")
13+
14+
class TokenExpiredError(PlexAuthError):
15+
def __init__(self, message="Plex authentication token has expired. Please re-authenticate with Plex to continue."):
16+
super().__init__(message, status_code=401, error_code="TOKEN_EXPIRED")
17+
18+
class PlexConnectionError(PlexAuthError):
19+
def __init__(self, message="Unable to establish connection to Plex server. Please check server status and network connectivity."):
20+
super().__init__(message, status_code=503, error_code="CONNECTION_ERROR")
21+
22+
class PlexServerNotFoundError(PlexAuthError):
23+
def __init__(self, message="Plex server not found or not accessible. Please verify server URL and authentication credentials."):
24+
super().__init__(message, status_code=404, error_code="SERVER_NOT_FOUND")
25+
26+
class PlexPinExpiredError(PlexAuthError):
27+
def __init__(self, message="Plex authentication PIN has expired. Please request a new PIN and try again."):
28+
super().__init__(message, status_code=410, error_code="PIN_EXPIRED")
29+
30+
class PlexAuthTimeoutError(PlexAuthError):
31+
def __init__(self, message="Plex authentication process timed out. Please try again or check your internet connection."):
32+
super().__init__(message, status_code=408, error_code="AUTH_TIMEOUT")
33+
34+
class UnauthorizedError(PlexAuthError):
35+
def __init__(self, message="Access denied. Please check your Plex authentication credentials and permissions."):
36+
super().__init__(message, status_code=401, error_code="UNAUTHORIZED")

0 commit comments

Comments
 (0)