Skip to content
This repository was archived by the owner on Oct 13, 2024. It is now read-only.

Commit 8fc2193

Browse files
refactor!: move project to standalone version
1 parent ec00a04 commit 8fc2193

File tree

117 files changed

+5169
-2876
lines changed

Some content is hidden

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

117 files changed

+5169
-2876
lines changed

.flake8

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[flake8]
22
filename =
3-
*.py,
4-
*.pys
3+
*.py
54
max-line-length = 120
65
extend-exclude =
76
venv/

.github/workflows/CI.yml

+49-161
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: CI
33

44
on:
55
pull_request:
6-
branches: [master]
6+
branches: [master, dev/standalone] # TODO: remove dev/standalone ... temporarily allow PRs to this branch
77
types: [opened, synchronize, reopened]
88
push:
99
branches: [master]
@@ -37,177 +37,69 @@ jobs:
3737
build:
3838
needs:
3939
- setup_release
40-
runs-on: ubuntu-20.04
40+
runs-on: ${{ matrix.os }}
41+
strategy:
42+
fail-fast: false
43+
matrix:
44+
os: [windows-2019, ubuntu-20.04, macos-12]
45+
architecture: [x64]
46+
include: # additional runs
47+
- os: windows-2019
48+
architecture: x86
4149

4250
steps:
4351
- name: Checkout
4452
uses: actions/checkout@v4
45-
with:
46-
path: Themerr-plex.bundle
47-
submodules: recursive
4853

49-
- name: Set up Python
50-
uses: LizardByte/setup-python[email protected]
54+
- name: Setup Python
55+
uses: actions/setup-python@v5
5156
with:
52-
python-version: '2.7'
53-
54-
- name: Patch third-party deps
55-
if: false # disabled
56-
shell: bash
57-
working-directory: Themerr-plex.bundle/third-party
58-
run: |
59-
patch_dir=${{ github.workspace }}/Themerr-plex.bundle/patches
57+
python-version: '3.12'
58+
architecture: ${{ matrix.architecture }}
6059

61-
# youtube-dl patches
62-
pushd youtube-dl
63-
git apply -v "${patch_dir}/youtube_dl-compat.patch"
64-
popd
65-
66-
- name: Set up Python Dependencies
67-
shell: bash
68-
working-directory: Themerr-plex.bundle
60+
- name: Setup Python Dependencies
6961
run: |
70-
echo "Installing Requirements"
71-
python --version
72-
python -m pip --no-python-version-warning --disable-pip-version-check install --upgrade pip setuptools
73-
74-
# install dev requirements
75-
python -m pip install --upgrade \
76-
-r requirements-build.txt \
77-
-r requirements-dev.txt
78-
79-
python -m pip install --upgrade --target=./Contents/Libraries/Shared \
80-
-r requirements.txt --no-warn-script-location
62+
python -m pip install --upgrade pip setuptools wheel
63+
python -m pip install -r requirements-dev.txt
8164
8265
- name: Compile Locale Translations
83-
working-directory: Themerr-plex.bundle
8466
run: |
8567
python ./scripts/_locale.py --compile
8668
8769
- name: Install npm packages
88-
working-directory: Themerr-plex.bundle
70+
shell: bash
8971
run: |
72+
# install node_modules
9073
npm install
91-
mv ./node_modules ./Contents/Resources/web
9274
93-
- name: Build plist
94-
shell: bash
95-
working-directory: Themerr-plex.bundle
96-
env:
97-
BUILD_VERSION: ${{ needs.setup_release.outputs.release_tag }}
75+
# move node_modules directory to web directory
76+
mv -f ./node_modules/ ./web/
77+
78+
- name: Compile Docs
79+
working-directory: docs
80+
run: |
81+
make html
82+
83+
- name: Build pyinstaller package
9884
run: |
99-
python ./scripts/build_plist.py
85+
python ./scripts/build.py
10086
10187
- name: Package Release
102-
shell: bash
10388
run: |
104-
7z \
105-
"-xr!*.git*" \
106-
"-xr!*.pyc" \
107-
"-xr!__pycache__" \
108-
"-xr!plexhints*" \
109-
"-xr!Themerr-plex.bundle/.*" \
110-
"-xr!Themerr-plex.bundle/cache.sqlite" \
111-
"-xr!Themerr-plex.bundle/codecov.yml" \
112-
"-xr!Themerr-plex.bundle/crowdin.yml" \
113-
"-xr!Themerr-plex.bundle/DOCKER_README.md" \
114-
"-xr!Themerr-plex.bundle/Dockerfile" \
115-
"-xr!Themerr-plex.bundle/docs" \
116-
"-xr!Themerr-plex.bundle/patches" \
117-
"-xr!Themerr-plex.bundle/scripts" \
118-
"-xr!Themerr-plex.bundle/tests" \
119-
a "./Themerr-plex.bundle.zip" "Themerr-plex.bundle"
89+
7z a "./Themerr-plex_${{ runner.os }}_${{ matrix.architecture }}.zip" "dist"
12090
12191
mkdir artifacts
122-
mv ./Themerr-plex.bundle.zip ./artifacts/
92+
mv "./Themerr-plex_${{ runner.os }}_${{ matrix.architecture }}.zip" ./artifacts/
12393
12494
- name: Upload Artifacts
125-
uses: actions/upload-artifact@v4
95+
uses: actions/upload-artifact@v4 # https://github.com/actions/upload-artifact
12696
with:
127-
name: Themerr-plex.bundle
97+
name: Themerr-plex_${{ runner.os }}_${{ matrix.architecture }}
12898
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
12999
path: |
130100
${{ github.workspace }}/artifacts
131101
132-
- name: Create/Update GitHub Release
133-
if: ${{ needs.setup_release.outputs.publish_release == 'true' }}
134-
uses: LizardByte/[email protected]
135-
with:
136-
allowUpdates: true
137-
body: ${{ needs.setup_release.outputs.release_body }}
138-
discussionCategory: announcements
139-
generateReleaseNotes: ${{ needs.setup_release.outputs.release_generate_release_notes }}
140-
name: ${{ needs.setup_release.outputs.release_tag }}
141-
prerelease: true
142-
tag: ${{ needs.setup_release.outputs.release_tag }}
143-
token: ${{ secrets.GH_BOT_TOKEN }}
144-
145-
pytest:
146-
needs: [build]
147-
strategy:
148-
fail-fast: false
149-
matrix:
150-
os: [windows-latest, ubuntu-latest, macos-latest]
151-
152-
runs-on: ${{ matrix.os }}
153-
steps:
154-
- name: Checkout
155-
uses: actions/checkout@v4
156-
157-
- name: Download artifacts
158-
uses: actions/download-artifact@v4
159-
with:
160-
name: Themerr-plex.bundle
161-
162-
- name: Extract artifacts zip
163-
shell: bash
164-
run: |
165-
# extract zip
166-
7z x Themerr-plex.bundle.zip -o.
167-
168-
# move all files from "Themerr-plex.bundle" to root, with no target directory
169-
cp -r ./Themerr-plex.bundle/. .
170-
171-
# remove zip
172-
rm Themerr-plex.bundle.zip
173-
174-
- name: Set up Python
175-
uses: LizardByte/[email protected]
176-
with:
177-
python-version: '2.7'
178-
179-
- name: Bootstrap Plex server
180-
env:
181-
PLEXAPI_PLEXAPI_TIMEOUT: "60"
182-
id: bootstrap
183-
uses: LizardByte/[email protected]
184-
with:
185-
additional_server_queries: >-
186-
put|/system/agents/com.plexapp.agents.imdb/config/1?order=com.plexapp.agents.imdb%2Cdev.lizardbyte.themerr-plex
187-
put|/system/agents/com.plexapp.agents.themoviedb/config/1?order=com.plexapp.agents.themoviedb%2Cdev.lizardbyte.themerr-plex
188-
put|/system/agents/com.plexapp.agents.themoviedb/config/2?order=com.plexapp.agents.themoviedb%2Cdev.lizardbyte.themerr-plex
189-
put|/system/agents/com.plexapp.agents.thetvdb/config/2?order=com.plexapp.agents.thetvdb%2Cdev.lizardbyte.themerr-plex
190-
get|/:/plugins/dev.lizardbyte.themerr-plex/prefs/set?bool_overwrite_plex_provided_themes=true
191-
plugin_bundles_to_install: >-
192-
Themerr-plex.bundle
193-
without_music: true
194-
without_photos: true
195-
196-
- name: Install python dependencies
197-
shell: bash
198-
run: |
199-
python -m pip --no-python-version-warning --disable-pip-version-check install --upgrade \
200-
pip setuptools wheel
201-
python -m pip --no-python-version-warning --disable-pip-version-check install --no-build-isolation \
202-
-r requirements-dev.txt
203-
204102
- name: Test with pytest
205-
env:
206-
PLEX_PLUGIN_LOG_PATH: ${{ steps.bootstrap.outputs.PLEX_PLUGIN_LOG_PATH }}
207-
PLEXAPI_AUTH_SERVER_BASEURL: ${{ steps.bootstrap.outputs.PLEX_SERVER_BASEURL }}
208-
PLEXAPI_AUTH_SERVER_TOKEN: ${{ steps.bootstrap.outputs.PLEXTOKEN }}
209-
PLEXAPI_PLEXAPI_TIMEOUT: "60"
210-
PLEXTOKEN: ${{ steps.bootstrap.outputs.PLEXTOKEN }}
211103
id: test
212104
shell: bash
213105
run: |
@@ -216,30 +108,26 @@ jobs:
216108
--tb=native \
217109
--verbose \
218110
--color=yes \
219-
--cov=Contents/Code \
111+
--cov=src \
220112
tests
221113
222-
- name: Debug log file
223-
if: always()
224-
shell: bash
225-
run: |
226-
echo "Debugging log file"
227-
if [[ "${{ runner.os }}" == "Windows" ]]; then
228-
log_file=$(cygpath.exe -u \
229-
"${{ steps.bootstrap.outputs.PLEX_PLUGIN_LOG_PATH }}/dev.lizardbyte.themerr-plex.log")
230-
else
231-
log_file="${{ steps.bootstrap.outputs.PLEX_PLUGIN_LOG_PATH }}/dev.lizardbyte.themerr-plex.log"
232-
fi
233-
cat "${log_file}"
234-
235114
- name: Upload coverage
236-
# any except canceled or skipped
237-
if: >-
238-
always() &&
239-
(steps.test.outcome == 'success' || steps.test.outcome == 'failure') &&
240-
startsWith(github.repository, 'LizardByte/')
241115
uses: codecov/codecov-action@v4
242116
with:
243117
fail_ci_if_error: true
244-
flags: ${{ runner.os }}
118+
flags: "${{ runner.os }}-${{ matrix.architecture }}"
245119
token: ${{ secrets.CODECOV_TOKEN }}
120+
verbose: true
121+
122+
- name: Create/Update GitHub Release
123+
if: ${{ needs.setup_release.outputs.publish_release == 'true' }}
124+
uses: LizardByte/[email protected]
125+
with:
126+
allowUpdates: true
127+
body: ${{ needs.setup_release.outputs.release_body }}
128+
discussionCategory: announcements
129+
generateReleaseNotes: ${{ needs.setup_release.outputs.release_generate_release_notes }}
130+
name: ${{ needs.setup_release.outputs.release_tag }}
131+
prerelease: true
132+
tag: ${{ needs.setup_release.outputs.release_tag }}
133+
token: ${{ secrets.GH_BOT_TOKEN }}

.github/workflows/localize.yml

+13-15
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ on:
66
branches: [master]
77
paths: # prevents workflow from running unless these files change
88
- '.github/workflows/localize.yml'
9-
- 'Contents/Strings/Themerr-plex.po'
10-
- 'Contents/Code/**.py'
11-
- 'Contents/Resources/web/templates/**'
9+
- 'locale/themerr-plex.po'
10+
- 'src/**.py'
11+
- 'web/templates/**'
1212
workflow_dispatch:
1313

1414
jobs:
@@ -19,18 +19,16 @@ jobs:
1919
steps:
2020
- name: Checkout
2121
uses: actions/checkout@v4
22-
with:
23-
submodules: recursive
2422

25-
- name: Set up Python
26-
uses: LizardByte/setup-python[email protected]
23+
- name: Install Python
24+
uses: actions/setup-python@v5 # https://github.com/actions/setup-python
2725
with:
28-
python-version: '2.7'
26+
python-version: '3.12'
2927

30-
- name: Set up Python Dependencies
28+
- name: Setup Python Dependencies
3129
run: |
32-
python -m pip install --upgrade pip setuptools requests
33-
python -m pip install -r requirements.txt # requests is required to install python-plexapi
30+
python -m pip install --upgrade pip setuptools wheel
31+
python -m pip install -r requirements.txt
3432
3533
- name: Update Strings
3634
run: |
@@ -42,14 +40,14 @@ jobs:
4240
git config --global pager.diff false
4341
4442
# print the git diff
45-
git diff Contents/Strings/themerr-plex.po
43+
git diff locale/themerr-plex.po
4644
4745
# set the variable with minimal output, replacing `\t` with ` `
48-
OUTPUT=$(git diff --numstat Contents/Strings/themerr-plex.po | sed -e "s#\t# #g")
46+
OUTPUT=$(git diff --numstat locale/themerr-plex.po | sed -e "s#\t# #g")
4947
echo "git_diff=${OUTPUT}" >> $GITHUB_ENV
5048
5149
- name: git reset
52-
if: ${{ env.git_diff == '1 1 Contents/Strings/themerr-plex.po' }} # only run if more than 1 line changed
50+
if: ${{ env.git_diff == '1 1 locale/themerr-plex.po' }} # only run if more than 1 line changed
5351
run: |
5452
git reset --hard
5553
@@ -61,7 +59,7 @@ jobs:
6159
uses: peter-evans/create-pull-request@v6
6260
with:
6361
add-paths: |
64-
Contents/Strings/*.po
62+
locale/*.po
6563
token: ${{ secrets.GH_BOT_TOKEN }} # must trigger PR tests
6664
commit-message: New localization template
6765
branch: localize/update

.github/workflows/python-flake8.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,11 @@ jobs:
2626
- name: Set up Python
2727
uses: actions/setup-python@v5 # https://github.com/actions/setup-python
2828
with:
29-
python-version: '3.10'
29+
python-version: '3.12'
3030

3131
- name: Install dependencies
3232
run: |
33-
# pin flake8 before v6.0.0 due to removal of support for type comments (required for Python 2.7 type hints)
34-
python -m pip install --upgrade pip setuptools "flake8<6"
33+
python -m pip install --upgrade pip setuptools flake8
3534
3635
- name: Test with flake8
3736
run: |

.gitignore

+6-21
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,7 @@ ipython_config.py
101101
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102102
#poetry.lock
103103

104-
# pdm
105-
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106-
#pdm.lock
107-
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108-
# in version control.
109-
# https://pdm.fming.dev/#use-with-ide
110-
.pdm.toml
111-
112-
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
104+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
113105
__pypackages__/
114106

115107
# Celery stuff
@@ -153,22 +145,15 @@ dmypy.json
153145
cython_debug/
154146

155147
# PyCharm
156-
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
148+
# JetBrains specific template is maintainted in a separate JetBrains.gitignore that can
157149
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158150
# and can be added to the global gitignore or merged into this file. For a more nuclear
159151
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
160152
.idea/
161153

162-
# Remove the agent Info.plist since we are building it
163-
Contents/Info.plist
164-
165-
# Remove plexhints files
166-
plexhints-temp
167-
*cache.sqlite
168-
169-
# Remove python modules
170-
Contents/Libraries/Shared/
171-
172154
# npm
173155
node_modules/
174-
package-lock.json
156+
*package-lock.json
157+
158+
# project files and directories
159+
config/

0 commit comments

Comments
 (0)