mirror of
https://github.com/tanrax/RSSingle.git
synced 2025-03-03 03:35:46 +01:00
Compare commits
32 Commits
add-limit-
...
dependabot
Author | SHA1 | Date | |
---|---|---|---|
63e71bc075 | |||
fe49baf040 | |||
4434603b33 | |||
67c1342ce1 | |||
f8b43a8b79 | |||
a63da96bd1 | |||
9532ff5760 | |||
21610500db | |||
1d8d444d2c | |||
2555616e65 | |||
8cd30e8b9e | |||
5e931082e4 | |||
62d93c43b9 | |||
e17c396fb2 | |||
768ca68241 | |||
34b4ae3e2b | |||
4ab9bc864f | |||
8e5e7646ce | |||
ab3c1b4610 | |||
84b108e154 | |||
e9980668c4 | |||
c1aa3e59d1 | |||
6be4933a9a | |||
cfd6bddafc | |||
4b5c774324 | |||
e03fff3a42 | |||
b7cfae13e1 | |||
57ed8aef3a | |||
b526fc582f | |||
f7a2c2417e | |||
1f36dea889 | |||
daf79338b5 |
5
.dockerignore
Normal file
5
.dockerignore
Normal file
@ -0,0 +1,5 @@
|
||||
/LICENSE
|
||||
/README.md
|
||||
/rssingle.png
|
||||
/Dockerfile
|
||||
/config.yml
|
8
.github/dependabot.yml
vendored
8
.github/dependabot.yml
vendored
@ -4,8 +4,16 @@ updates:
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
groups:
|
||||
gh-actions-deps:
|
||||
patterns:
|
||||
- "*"
|
||||
|
||||
- package-ecosystem: "pip"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
groups:
|
||||
python-deps:
|
||||
patterns:
|
||||
- "*"
|
||||
|
59
.github/workflows/ci.yml
vendored
Normal file
59
.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
name: CI workflow for RSSingle
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build-and-check:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ["3.8", "3.9", "3.10"]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install flake8
|
||||
pip install -r requirements.txt
|
||||
- name: Lint with flake8
|
||||
run: |
|
||||
# stop the build if there are Python syntax errors or undefined names
|
||||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
||||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
||||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
||||
|
||||
# to be completed once macOS builds fixed
|
||||
create-and-publish-release:
|
||||
needs: build-and-check
|
||||
if: startsWith(github.ref, 'refs/tags/') && success()
|
||||
strategy:
|
||||
matrix:
|
||||
# `--windowed` is for macOS, and `--onefile` is for other OSes.
|
||||
pyinstaller-type: ['--windowed', '--onefile']
|
||||
runner: ["macos-latest", "windows-latest", "ubuntu-latest"]
|
||||
runs-on: ${{ matrix.runner }}
|
||||
name: Builder for Python all-in-one executables, published on a release.
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
- name: Set up Python 3.8
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.8"
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install pyinstaller
|
||||
pip install -r requirements.txt
|
||||
- name: Build RSSingle (Windows, Linux)
|
||||
if: ${{ matrix.runner != 'macos-latest' }}
|
||||
run: pyinstaller --onefile ./rssingle.py
|
||||
- name: Build RSSingle (macOS)
|
||||
if: ${{ matrix.runner == 'macos-latest' }}
|
||||
run: pyinstaller --windowed ./rssingle.py
|
||||
- name: List artifacts for finishing this action
|
||||
run: find ./dist/
|
45
.github/workflows/container.yml
vendored
Normal file
45
.github/workflows/container.yml
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
name: Container image builder for RSS single
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["CI workflow for RSSingle"]
|
||||
types: [completed]
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
build-and-push-container-image:
|
||||
name: Build and push container image to Docker Hub and GHCR.io
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' && github.repository == 'tanrax/RSSingle' }}
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build container image
|
||||
id: build
|
||||
uses: redhat-actions/buildah-build@v2
|
||||
with:
|
||||
image: ${{ github.repository }}
|
||||
tags: latest
|
||||
containerfiles: Dockerfile
|
||||
|
||||
- name: Push container image to Docker Hub
|
||||
uses: redhat-actions/push-to-registry@v2
|
||||
with:
|
||||
image: ${{ steps.build.outputs.image }}
|
||||
tags: ${{ steps.build.outputs.tags }}
|
||||
registry: docker.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.DOCKER_TOKEN }}
|
||||
|
||||
- name: Push container image to GHCR.io
|
||||
uses: redhat-actions/push-to-registry@v2
|
||||
with:
|
||||
image: ${{ steps.build.outputs.image }}
|
||||
tags: ${{ steps.build.outputs.tags }}
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
|
18
Dockerfile
Normal file
18
Dockerfile
Normal file
@ -0,0 +1,18 @@
|
||||
FROM docker.io/python:3.8-buster AS base
|
||||
|
||||
FROM base AS build
|
||||
|
||||
WORKDIR /work
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN pip3 install pyinstaller
|
||||
|
||||
RUN pip3 install -r /work/requirements.txt
|
||||
RUN pyinstaller --onefile /work/rssingle.py
|
||||
|
||||
FROM docker.io/python:3.8-buster AS app
|
||||
|
||||
COPY --from=build /work/dist/rssingle /rssingle
|
||||
|
||||
ENTRYPOINT ["/rssingle"]
|
@ -6,3 +6,6 @@ max_entries: 2 # Delete this line to get all
|
||||
feeds:
|
||||
- https://programadorwebvalencia.com/feed/
|
||||
- https://republicaweb.es/feed/
|
||||
filter_strings:
|
||||
- unwanted
|
||||
- exclude_this
|
||||
|
@ -1,7 +1,7 @@
|
||||
feedgen==0.9.0
|
||||
feedparser==6.0.10
|
||||
listparser==0.19.0
|
||||
lxml==4.9.3
|
||||
python-dateutil==2.8.2
|
||||
pyyaml==6.0
|
||||
pyinstaller==6.0.0
|
||||
feedgen==1.0.0
|
||||
feedparser==6.0.11
|
||||
listparser==0.20
|
||||
lxml==5.2.2
|
||||
python-dateutil==2.9.0.post0
|
||||
pyyaml==6.0.1
|
||||
pyinstaller==6.9.0
|
16
rssingle.py
16
rssingle.py
@ -15,7 +15,7 @@ import json
|
||||
import yaml
|
||||
|
||||
|
||||
# Varaibles
|
||||
# Variables
|
||||
|
||||
log = None
|
||||
CONFIG_PATH = "config.yml"
|
||||
@ -87,6 +87,16 @@ def parse_rss_feed(url) -> feedparser.FeedParserDict:
|
||||
log.warning("Failed to parse RSS feed.")
|
||||
# Now, we could handle gracefully.
|
||||
|
||||
def filter_feed_entries(entry) -> bool:
|
||||
"""
|
||||
This function filters feed entries based on strings defined in config.yml.
|
||||
"""
|
||||
filter_strings = CONFIG.get("filter_strings", [])
|
||||
for filter_str in filter_strings:
|
||||
if filter_str.lower() in entry.get("title", "").lower() or filter_str.lower() in entry.get("summary", "").lower():
|
||||
log.debug(f"Entry filtered out: {entry['title']}")
|
||||
return False
|
||||
return True
|
||||
|
||||
def main():
|
||||
log.debug("Loading feed list into memory..")
|
||||
@ -100,10 +110,14 @@ def main():
|
||||
for entry in entries[:CONFIG["max_entries"]] if "max_entries" in CONFIG else entries:
|
||||
log.debug("New feed entry created.")
|
||||
|
||||
if not filter_feed_entries(entry):
|
||||
continue # Skip this entry
|
||||
|
||||
fe = fg.add_entry()
|
||||
|
||||
log.debug("Working on new feed entry..")
|
||||
|
||||
|
||||
try:
|
||||
fe.id(entry["id"])
|
||||
except KeyError:
|
||||
|
Reference in New Issue
Block a user