Merge branch 'WIP' into 'master'

Merge branch WIP

See merge request sjehuda/slixfeed!1
This commit is contained in:
Schimon Jehudah 2023-11-02 12:14:43 +00:00
commit 63ae7500df
3 changed files with 33 additions and 1 deletions

18
slixfeed/feedhandler.py Normal file
View file

@ -0,0 +1,18 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from urllib.parse import urlparse
async def get_title(url, feed):
"""
Get title of feed.
:param url: URL
:param feed: Parsed feed
:return: Title or URL hostname.
"""
try:
title = feed["feed"]["title"]
except:
title = urlparse(url).netloc
return title

14
slixfeed/settings.py Normal file
View file

@ -0,0 +1,14 @@
async def get_value_default(key):
"""
Get settings default value.
:param key: "enabled", "interval", "quantum".
:return: Integer.
"""
if key == "enabled":
result = 1
elif key == "quantum":
result = 4
elif key == "interval":
result = 30
return result