[33] Fixes 'NoneType' object has no attribute 'headers' Error and Fixes letterboxd descriptions from not getting all the text (#2085)

This commit is contained in:
meisnate12 2024-05-30 13:17:49 -04:00 committed by GitHub Action
parent 169afa1196
commit 12e08a3333
5 changed files with 38 additions and 23 deletions

View file

@ -9,6 +9,12 @@ jobs:
increment-version:
runs-on: ubuntu-latest
if: github.base_ref == 'nightly' && github.event.pull_request.merged
outputs:
version: ${{ steps.update-version.outputs.version }}
build-value: ${{ steps.update-version.outputs.build-value }}
commit-msg: ${{ steps.update-version.outputs.commit-msg }}
commit-hash: ${{ steps.update-version.outputs.commit-hash }}
commit-short: ${{ steps.update-version.outputs.commit-short }}
steps:
- name: Create App Token
@ -26,21 +32,31 @@ jobs:
fetch-depth: 0
- name: Update VERSION File
id: update-version
run: |
value=$(cat VERSION)
old_msg=$(git log -1 HEAD --pretty=format:%s)
if [[ "$value" == *"-"* ]]; then
version="${value%-build*}"
build_value="$((${value#*-build} + 1))"
new_value="${value%-build*}-build${build_value}"
new_msg="[${build_value}] ${old_msg}"
new_value="${version}-build${build_value}"
elif [[ "$value" == *"!"* ]]; then
new_value="${value%!*}"
new_msg="[${new_value}] ${old_msg}"
version="${value%!*}"
new_value="${version}"
build_value="${new_value}"
else
new_value="${value%-build*}-build1"
new_msg="[1] ${old_msg}"
version="${value%-build*}"
build_value="1"
new_value="${version}-build${build_value}"
fi
new_msg="[${build_value}] ${old_msg}"
echo "version=${version}" >> $GITHUB_OUTPUT
echo "build-value=${build_value}" >> $GITHUB_OUTPUT
echo "commit-msg=${old_msg}" >> $GITHUB_OUTPUT
echo "commit-hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
echo "commit-short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "$new_value" > "VERSION"
git config --local user.email "action@github.com"
@ -80,7 +96,7 @@ jobs:
docker-build:
runs-on: ubuntu-latest
needs: [ verify-changes ]
needs: [ increment-version, verify-changes ]
if: needs.verify-changes.outputs.build == 'true'
steps:
@ -147,17 +163,18 @@ jobs:
commit-notification:
runs-on: ubuntu-latest
needs: [ docker-build, verify-changes ]
if: ${{ success() && needs.verify-changes.outputs.build == 'true' }}
needs: [ increment-version, verify-changes, docker-build ]
if: ${{ success() && needs.increment-version.outputs.build == 'true' }}
steps:
- name: Send Discord Commit Notification
uses: Kometa-Team/discord-notifications@master
with:
webhook_id_token: ${{ secrets.NIGHTLY_WEBHOOK }}
title: ${{ vars.TEXT_COMMITS }}
title: Kometa ${{ needs.verify-changes.outputs.version }} Build ${{ needs.verify-changes.outputs.build-value }}
url: https://github.com/Kometa-Team/Kometa/commit/${{ needs.verify-changes.outputs.commit-hash }}
description: ${{ needs.verify-changes.outputs.commit-msg }}
message: "<@&967002147520675840> - An update to Kometa has now been published and is available to users of the **nightly** branch."
commits: "true"
color: ${{ vars.COLOR_SUCCESS }}
username: ${{ vars.BOT_NAME }}
avatar_url: ${{ vars.BOT_IMAGE }}

View file

@ -1 +1 @@
2.0.1-build32
2.0.1-build33

View file

@ -136,7 +136,6 @@ for arg_key, arg_data in arguments.items():
env_branch = get_env("BRANCH_NAME", "master")
is_docker = get_env("KOMETA_DOCKER", False, arg_bool=True)
is_linuxserver = get_env("KOMETA_LINUXSERVER", False, arg_bool=True)
is_lxml = get_env("KOMETA_LXML", False, arg_bool=True)
secret_args = {}
plex_url = None
@ -266,16 +265,12 @@ def start(attrs):
logger.info_center("| . \\ | `--` | | | | | | |____ | | / _____ \\ ")
logger.info_center("|__|\\__\\ \\______/ |__| |__| |_______| |__| /__/ \\__\\ ")
logger.info("")
if is_lxml:
system_ver = "lxml Docker"
elif is_linuxserver:
system_ver = "Linuxserver"
elif is_docker:
system_ver = f"Docker: {env_branch}"
else:
system_ver = f"Python {platform.python_version()}"
my_requests = Requests(local_version, env_branch, git_branch, verify_ssl=False if run_args["no-verify-ssl"] else True)
logger.info(f" Version: {my_requests.local} ({system_ver}){f' (Git: {git_branch})' if git_branch else ''}")
if is_linuxserver or is_docker:
system_ver = f"{'Linuxserver' if is_linuxserver else 'Docker'}: {env_branch}"
else:
system_ver = f"Python {platform.python_version()}) ({f'Git: {git_branch}' if git_branch else f'Branch: {my_requests.branch}'}"
logger.info(f" Version: {my_requests.local} ({system_ver})")
if my_requests.newest:
logger.info(f" Newest Version: {my_requests.newest}")
logger.info(f" Platform: {platform.platform()}")

View file

@ -57,7 +57,9 @@ class Letterboxd:
logger.trace(f"URL: {list_url}")
response = self.requests.get_html(list_url, language=language)
descriptions = response.xpath("//meta[@property='og:description']/@content")
return descriptions[0] if len(descriptions) > 0 and len(descriptions[0]) > 0 else None
if len(descriptions) > 0 and len(descriptions[0]) > 0 and "About this list: " in descriptions[0]:
return str(descriptions[0]).split("About this list: ")[1]
return None
def validate_letterboxd_lists(self, err_type, letterboxd_lists, language):
valid_lists = []

View file

@ -116,6 +116,7 @@ class Requests:
raise Failed(f"Image Error: {response.status_code} on Image URL: {url}")
if "Content-Type" not in response.headers or response.headers["Content-Type"] not in self.image_content_types:
raise Failed("Image Not PNG, JPG, or WEBP")
return response
def get_stream(self, url, location, info="Item"):
with self.session.get(url, stream=True) as r: