Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed imdb_watchlist #2140

Merged
merged 10 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/increment-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
increment-build:
runs-on: ubuntu-latest
needs: [ verify-changes ]
if: needs.verify-changes.outputs.build == 'true'
outputs:
version: ${{ steps.update-version.outputs.version }}
build-value: ${{ steps.update-version.outputs.build-value }}
Expand Down
35 changes: 27 additions & 8 deletions .github/workflows/validate-pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ jobs:

validate-pull:
runs-on: ubuntu-latest
outputs:
build: ${{ steps.list-changes.outputs.build }}
steps:

- name: Display Refs
Expand All @@ -29,13 +31,29 @@ jobs:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}

- name: Get changes
id: get-changes
run: echo "files=$(git diff --name-only HEAD^ | xargs)" >> $GITHUB_OUTPUT

- name: List changed files
id: list-changes
run: |
for file in ${{ steps.get-changes.outputs.files }}; do
if [[ $file =~ ^(defaults|fonts|modules|kometa.py|requirements.txt|.dockerignore|Dockerfile).*$ ]] ; then
echo "$file will trigger docker build"
echo "build=true" >> $GITHUB_OUTPUT
else
echo "$file will not trigger docker build"
fi
done

- name: Run Spellcheck
uses: rojopolis/[email protected]

docker-build-pull:
runs-on: ubuntu-latest
needs: [ validate-pull ]
if: contains(github.event.pull_request.labels.*.name, 'docker') || contains(github.event.pull_request.labels.*.name, 'tester')
if: needs.verify-changes.outputs.build == 'true' && (contains(github.event.pull_request.labels.*.name, 'docker') || contains(github.event.pull_request.labels.*.name, 'tester'))
outputs:
commit-msg: ${{ steps.update-version.outputs.commit-msg }}
version: ${{ steps.update-version.outputs.version }}
Expand All @@ -53,6 +71,7 @@ jobs:
- name: Check Out Repo
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}

Expand Down Expand Up @@ -170,22 +189,22 @@ jobs:
- name: Get Description
id: get-description
run: |
body="${{ github.event.pull_request.body }}"
body=$(echo "$body" | sed -n '/## Description/,/## Issues Fixed or Closed/{/## Description/b;/## Issues Fixed or Closed/b;p}')
body='${{ github.event.pull_request.body }}'
body=$(echo "$body" | sed -n '/## Description/,/##/{/## Description/b;/##/b;p}')
body=$(echo $body|tr -d '\n')
echo "description=$body" >> $GITHUB_OUTPUT
echo 'description=$body' >> $GITHUB_OUTPUT

- name: Discord Testers Notification
uses: Kometa-Team/discord-notifications@master
with:
webhook_id_token: ${{ secrets.TESTERS_WEBHOOK }}
message: "The Kometa team are requesting <@&917323027438510110> to assist with testing an upcoming feature/bug fix.
message: 'The Kometa team are requesting <@&917323027438510110> to assist with testing an upcoming feature/bug fix.

* For Local Git pull and checkout the `${{ github.event.pull_request.head.ref }}` branch${{ needs.docker-build-pull.outputs.extra-text }}

* For Docker use the `kometateam/kometa:${{ needs.docker-build-pull.outputs.tag-name }}` image to do your testing

Please report back either here or on the original GitHub Pull Request"
Please report back either here or on the original GitHub Pull Request'
title: ${{ github.event.pull_request.title }}
description: ${{ steps.get-description.outputs.description }}
url: https://github.com/Kometa-Team/${{ vars.REPO_NAME }}/pull/${{ github.event.number }}
Expand All @@ -198,14 +217,14 @@ jobs:
update-testers:
runs-on: ubuntu-latest
needs: [ docker-build-pull ]
if: github.event.action == 'synchronize' && github.event.label.name == 'tester'
if: github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'tester')
steps:

- name: Discord Testers Notification
uses: Kometa-Team/discord-notifications@master
with:
webhook_id_token: ${{ secrets.TESTERS_WEBHOOK }}
message: "New Commit Pushed to `${{ needs.docker-build-pull.outputs.tag-name }}`: ${{ needs.docker-build-pull.outputs.version }}"
message: 'New Commit Pushed to `${{ needs.docker-build-pull.outputs.tag-name }}`: ${{ needs.docker-build-pull.outputs.version }}'
description: ${{ needs.docker-build-pull.outputs.commit-msg }}
url: https://github.com/Kometa-Team/${{ vars.REPO_NAME }}/pull/${{ github.event.number }}
color: ${{ vars.COLOR_SUCCESS }}
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Added tenacity requirement at 8.4.2
Update PlexAPI requirement to 4.15.14
Update psutil requirement to 6.0.0
Update setuptools requirement to 70.1.0
Update setuptools requirement to 70.1.1

# Removed Features

Expand All @@ -16,5 +16,6 @@ Added [`letterboxd_user_lists`](https://kometa.wiki/en/latest/files/dynamic_type
# Bug Fixes
Fixed multiple anime `int()` Errors
Fixed #2100 `verify_ssl` wasn't working when downloading images
Fixed `imdb_watchlist`

Various other Minor Fixes
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.2-build23
2.0.2-build23.8
29 changes: 17 additions & 12 deletions docs/files/builders/imdb.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,31 +118,36 @@ collections:

Finds every item in an IMDb User's Watchlist.

The expected input is an IMDb User ID (example: `ur12345678`). Multiple values are supported as a list or as a comma-separated string.
| List Parameter | Description |
|:---------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `user_id` | Specify the User ID for the IMDb Watchlist. **This attribute is required.**<br>**Options:** The ID that starts with `ur` found in the URL of the watchlist. (ex. `ur12345678`) |
| `limit` | Specify how items you want returned by the query.<br>**Options:** Any Integer `0` or greater where `0` get all items.<br>**Default:** `0` |
| `sort_by` | Choose from one of the many available sort options.<br>**Options:** `custom.asc`, `custom.desc`, `title.asc`, `title.desc`, `rating.asc`, `rating.desc`, `popularity.asc`, `popularity.desc`, `votes.asc`, `votes.desc`, `release.asc`, `release.desc`, `runtime.asc`, `runtime.desc`, `added.asc`, `added.desc`<br>**Default:** `custom.asc` |

Multiple values are supported as a list only a comma-separated string will not work.

The `sync_mode: sync` and `collection_order: custom` Setting are recommended since the lists are continuously updated and in a specific order.

```yaml
collections:
My Watch Watchlist:
imdb_watchlist: ur64054558
collection_order: custom
sync_mode: sync
```
```yaml
collections:
My Friends Watchlists:
imdb_watchlist: ur64054558, ur12345678
imdb_watchlist:
user_id: ur64054558
sort_by: rating.asc
collection_order: custom
sync_mode: sync
```

```yaml
collections:
My Friends Watchlists:
imdb_watchlist:
- ur64054558
- ur12345678
collection_order: custom
- user_id: ur64054558
sort_by: rating.asc
limit: 100
- user_id: ur12345678
sort_by: rating.asc
limit: 100
sync_mode: sync
```

Expand Down
12 changes: 3 additions & 9 deletions modules/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1477,12 +1477,9 @@ def _imdb(self, method_name, method_data):
self.builders.append((method_name, value))
else:
raise Failed(f"{self.Type} Error: imdb_id {value} must begin with tt")
elif method_name == "imdb_list":
try:
for imdb_dict in self.config.IMDb.validate_imdb_lists(self.Type, method_data):
self.builders.append((method_name, imdb_dict))
except Failed as e:
logger.error(e)
elif method_name in ["imdb_list", "imdb_watchlist"]:
for imdb_dict in self.config.IMDb.validate_imdb(self.Type, method_name, method_data):
self.builders.append((method_name, imdb_dict))
elif method_name == "imdb_chart":
for value in util.get_list(method_data):
if value in imdb.movie_charts and not self.library.is_movie:
Expand All @@ -1493,9 +1490,6 @@ def _imdb(self, method_name, method_data):
self.builders.append((method_name, value))
else:
raise Failed(f"{self.Type} Error: chart: {value} is invalid options are {[i for i in imdb.charts]}")
elif method_name == "imdb_watchlist":
for imdb_user in self.config.IMDb.validate_imdb_watchlists(self.Type, method_data, self.language):
self.builders.append((method_name, imdb_user))
elif method_name == "imdb_award":
for dict_data in util.parse(self.Type, method_name, method_data, datatype="listdict"):
dict_methods = {dm.lower(): dm for dm in dict_data}
Expand Down
Loading