Skip to content

Commit 1dbb6de

Browse files
committed
Move scraper files to a subfolder
1 parent 601c7d0 commit 1dbb6de

Some content is hidden

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

44 files changed

+37
-59
lines changed

.github/workflows/Publish.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,19 @@ jobs:
1616
- name: Set up Python
1717
uses: actions/setup-python@v4
1818
with:
19-
python-version-file: pyproject.toml
19+
python-version-file: scraper/pyproject.toml
2020
architecture: x64
2121

2222
- name: Build packages
23+
working-directory: scraper
2324
run: |
2425
pip install -U pip build
2526
python -m build --sdist --wheel
2627
2728
- name: Upload to PyPI
2829
uses: pypa/gh-action-pypi-publish@release/v1.8
2930
with:
30-
packages-dir: dist/
31+
packages-dir: scraper/dist/
3132

3233
- name: Build and push Docker image
3334
uses: openzim/docker-publish-action@v10

.github/workflows/QA.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,23 @@ jobs:
1616
- name: Set up Python
1717
uses: actions/setup-python@v4
1818
with:
19-
python-version-file: pyproject.toml
19+
python-version-file: scraper/pyproject.toml
2020
architecture: x64
2121

2222
- name: Install dependencies
23+
working-directory: scraper
2324
run: |
2425
pip install -U pip
2526
pip install -e .[lint,check,scripts,test]
2627
2728
- name: Check black formatting
29+
working-directory: scraper
2830
run: inv lint-black
2931

3032
- name: Check ruff
33+
working-directory: scraper
3134
run: inv lint-ruff
3235

3336
- name: Check pyright
34-
run: inv check-pyright
37+
working-directory: scraper
38+
run: inv check-pyright

.github/workflows/Tests.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,17 @@ jobs:
1616
- name: Set up Python
1717
uses: actions/setup-python@v4
1818
with:
19-
python-version-file: pyproject.toml
19+
python-version-file: scraper/pyproject.toml
2020
architecture: x64
2121

2222
- name: Install dependencies (and project)
23+
working-directory: scraper
2324
run: |
2425
pip install -U pip
2526
pip install -e .[test,scripts]
2627
2728
- name: Run the tests
29+
working-directory: scraper
2830
run: inv coverage --args "-vvv"
2931

3032
- name: Upload coverage report to codecov
@@ -40,10 +42,11 @@ jobs:
4042
- name: Set up Python
4143
uses: actions/setup-python@v4
4244
with:
43-
python-version-file: pyproject.toml
45+
python-version-file: scraper/pyproject.toml
4446
architecture: x64
4547

4648
- name: Ensure we can build Python targets
49+
working-directory: scraper
4750
run: |
4851
pip install -U pip build
4952
python3 -m build --sdist --wheel

.gitignore

+7-7
Original file line numberDiff line numberDiff line change
@@ -366,13 +366,13 @@ pyrightconfig.json
366366
# End of https://www.toptal.com/developers/gitignore/api/linux,macos,python,database,visualstudiocode,intellij
367367

368368
# JS deps
369-
src/youtube2zim/templates/assets/chosen/
370-
src/youtube2zim/templates/assets/jquery.min.js
371-
src/youtube2zim/templates/assets/ogvjs/
372-
src/youtube2zim/templates/assets/videojs-ogvjs.js
373-
src/youtube2zim/templates/assets/videojs/
374-
src/youtube2zim/templates/assets/polyfills.js
375-
src/youtube2zim/templates/assets/webp-hero.bundle.js
369+
scraper/src/youtube2zim/templates/assets/chosen/
370+
scraper/src/youtube2zim/templates/assets/jquery.min.js
371+
scraper/src/youtube2zim/templates/assets/ogvjs/
372+
scraper/src/youtube2zim/templates/assets/videojs-ogvjs.js
373+
scraper/src/youtube2zim/templates/assets/videojs/
374+
scraper/src/youtube2zim/templates/assets/polyfills.js
375+
scraper/src/youtube2zim/templates/assets/webp-hero.bundle.js
376376

377377
# output dir
378378
output

CHANGELOG

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Changed
11+
12+
- Move scraper files to `scraper` subfolder and update workflows
13+
1014
## [2.3.0] - 2024-05-22
1115

1216
### Added

Dockerfile

+8-7
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,25 @@ RUN apt-get update \
1414
pip
1515

1616
# Custom entrypoint
17-
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
17+
COPY scraper/entrypoint.sh /usr/local/bin/entrypoint.sh
1818
ENTRYPOINT ["entrypoint.sh"]
1919
RUN mkdir -p /output
2020
WORKDIR /output
2121

2222
# Copy pyproject.toml and its dependencies
23-
COPY pyproject.toml README.md openzim.toml /src/
24-
COPY src/youtube2zim/__about__.py /src/src/youtube2zim/__about__.py
23+
COPY README.md /src/
24+
COPY scraper/pyproject.toml scraper/openzim.toml /src/scraper/
25+
COPY scraper/src/youtube2zim/__about__.py /src/scraper/src/youtube2zim/__about__.py
2526

2627
# Install Python dependencies
27-
RUN pip install --no-cache-dir /src
28+
RUN pip install --no-cache-dir /src/scraper
2829

2930
# Copy code + associated artifacts
30-
COPY src /src/src
31+
COPY scraper/src /src/scraper/src
3132
COPY *.md LICENSE CHANGELOG /src/
3233

3334
# Install + cleanup
34-
RUN pip install --no-cache-dir /src \
35-
&& rm -rf /src
35+
RUN pip install --no-cache-dir /src/scraper \
36+
&& rm -rf /src/scraper
3637

3738
CMD ["youtube2zim", "--help"]

README.md

+1
File renamed without changes.
File renamed without changes.
File renamed without changes.

openzim.toml scraper/openzim.toml

File renamed without changes.

pyproject.toml scraper/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
66
name = "youtube2zim"
77
requires-python = ">=3.12,<3.13"
88
description = "Make ZIM file from a Youtube channel, user or playlist(s)"
9-
readme = "README.md"
9+
readme = "../README.md"
1010
dependencies = [
1111
"python-slugify==3.0.3",
1212
"yt-dlp", # youtube-dl should be updated as frequently as possible
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/youtube2zim/locale/fr/LC_MESSAGES/messages.po scraper/src/youtube2zim/locale/fr/LC_MESSAGES/messages.po

-1
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,3 @@ msgstr "Page {current}/{total}"
3333
#: youtube2zim/scraper.py:872
3434
msgid "Back to top"
3535
msgstr "Haut"
36-

src/youtube2zim/playlists/scraper.py scraper/src/youtube2zim/playlists/scraper.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def handle_single_zim(self):
198198

199199
@staticmethod
200200
def compute_format(playlist, fmt):
201-
return fmt.format(**playlist.__dict__(), **{"period": "{period}"})
201+
return fmt.format(**playlist.to_dict(), **{"period": "{period}"})
202202

203203
def fetch_metadata(self):
204204
"""retrieves and loads metadata from --metadata-from"""
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/youtube2zim/youtube.py scraper/src/youtube2zim/youtube.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def from_id(cls, playlist_id):
4343
creator_name=playlist_json["snippet"]["channelTitle"],
4444
)
4545

46-
def __dict__(self):
46+
def to_dict(self):
4747
return {
4848
"playlist_id": self.playlist_id,
4949
"title": self.title,

tasks.py scraper/tasks.py

File renamed without changes.
File renamed without changes.
-649 Bytes
Binary file not shown.

src/youtube2zim/locale/messages.pot

-35
This file was deleted.

0 commit comments

Comments
 (0)