Skip to content

Commit

Permalink
feat: Update project (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
janw authored Oct 1, 2024
1 parent f198fc7 commit 0e164ee
Show file tree
Hide file tree
Showing 10 changed files with 958 additions and 534 deletions.
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
liberapay: janw
ko_fi: janwxyz
14 changes: 14 additions & 0 deletions .github/workflows/bump-version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Bump version

on:
push:
branches:
- main

jobs:
bump-version:
uses: janw/workflows/.github/workflows/commitizen-bump-version.yaml@main
secrets:
personal-access-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
8 changes: 8 additions & 0 deletions .github/workflows/linters.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: Linters

on:
pull_request:

jobs:
commitizen:
uses: janw/workflows/.github/workflows/commitizen.yaml@main
47 changes: 47 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Publish

on:
push:
tags:
- "v*.*.*"
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v4

- name: Install poetry
run: pipx install poetry

- name: Build package
run: poetry build -vvv

- uses: actions/upload-artifact@v4
with:
name: package
path: |
README.md
pyproject.toml
dist/*
if-no-files-found: error
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')

pypi:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
needs: build
steps:
- uses: actions/download-artifact@v4
with:
name: package

- run: ls dist/*

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1 # cspell: disable-line
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,4 @@ dmypy.json
# End of https://www.gitignore.io/api/python

.vscode/
feed.xml
feed.xml
31 changes: 31 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
ci:
autoupdate_commit_msg: 'build(pre-commit): pre-commit.ci autoupdate'
autoupdate_schedule: weekly
autofix_commit_msg: 'ci(pre-commit): auto fixes from pre-commit hooks'
autofix_prs: true

default_install_hook_types:
- pre-commit
default_stages:
- pre-commit
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.3.5'
hooks:
- id: ruff
args: [ --fix, --exit-non-zero-on-fix ]
- id: ruff-format

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.6.0"
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: debug-statements
- id: check-ast

- repo: https://github.com/python-poetry/poetry
rev: '1.8.0'
hooks:
- id: poetry-check
34 changes: 26 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,40 @@
# Letterboxd-RSS
# Letterboxd RSS

<!-- markdownlint-disable MD033 MD013 -->
<div align="center">

[![version](https://img.shields.io/pypi/v/letterboxd-rss.svg)](https://pypi.org/project/letterboxd-rss/)
[![python](https://img.shields.io/pypi/pyversions/letterboxd-rss.svg)](https://pypi.org/project/letterboxd-rss/)
[![downloads](https://img.shields.io/pypi/dm/letterboxd-rss)](https://pypi.org/project/letterboxd-rss/)

<!-- [![Docker Build](https://github.com/janw/letterboxd-rss/actions/workflows/docker-build.yaml/badge.svg)](https://ghcr.io/janw/letterboxd-rss) -->
<!-- [![Tests](https://github.com/janw/letterboxd-rss/actions/workflows/tests.yaml/badge.svg)](https://github.com/janw/letterboxd-rss/actions/workflows/tests.yaml?query=branch%3Amain) -->
[![pre-commit.ci](https://results.pre-commit.ci/badge/github/janw/letterboxd-rss/main.svg)](https://results.pre-commit.ci/latest/github/janw/letterboxd-rss/main)

[![Maintainability](https://api.codeclimate.com/v1/badges/a3602f453bd063e6dcec/maintainability)](https://codeclimate.com/github/janw/letterboxd-rss/maintainability)
<!-- [![codecov](https://codecov.io/gh/janw/letterboxd-rss/branch/main/graph/badge.svg?token=G8WI2ZILRG)](https://codecov.io/gh/janw/letterboxd-rss) -->

[![ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://docs.astral.sh/ruff/)
[![poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/docs/)
[![pre-commit](https://img.shields.io/badge/-pre--commit-f8b424?logo=pre-commit&labelColor=grey)](https://github.com/pre-commit/pre-commit)

</div>

Convert your [Letterboxd] Watchlist to an RSS feed.

## Installation
## Setup

Install and update using [pip]:
Install via [pipx](https://pipx.pypa.io/stable/):

```
pip install letterboxd-rss
```bash
pipx install letterboxd-rss
```

## Usage

After installing, you may simply call letterboxd-rss from the command line:

```
```bash
$ letterboxd-rss -h

usage: letterboxd-rss [-h] [-o FEED_FILENAME] [-l FEED_LENGTH]
Expand All @@ -32,6 +52,4 @@ optional arguments:
Maximum number of watchlist items to keep in the feed
```


[Letterboxd]: https://letterboxd.com
[pip]: https://pip.pypa.io/en/stable/quickstart/
4 changes: 1 addition & 3 deletions letterboxd_rss/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@

base_url = "https://letterboxd.com/"

MATCH_TOTAL_MOVIES = re.compile(r"to see (\d+)")
s = session()


def process(args):

watchlist_url = args.letterboxd_url.rstrip("/")
if not watchlist_url.startswith("https://"):
watchlist_url = f"{base_url}{watchlist_url}"
Expand Down Expand Up @@ -80,7 +78,7 @@ def process(args):


def extract_metadata(movie, feed):
movie_url = base_url +"film/"+ movie.div.attrs["data-film-slug"]
movie_url = base_url + "film/" + movie.div.attrs["data-film-slug"]
movie_page = s.get(movie_url)
movie_soup = BeautifulSoup(movie_page.text, "html.parser")

Expand Down
Loading

0 comments on commit 0e164ee

Please sign in to comment.