Added feed parser for linux kernel releases
This commit is contained in:
parent
63eb1e3889
commit
d921f0de7b
|
@ -14,8 +14,8 @@
|
|||
"nxy.plugins.admin",
|
||||
"nxy.plugins.bitcoin",
|
||||
"nxy.plugins.ctcp",
|
||||
"nxy.plugins.kernel",
|
||||
"nxy.plugins.mcmaniac",
|
||||
"nxy.plugins.youtube",
|
||||
"nxy.plugins.quotes",
|
||||
"nxy.plugins.tell",
|
||||
"nxy.plugins.timer",
|
||||
|
|
27
nxy/plugins/kernel.py
Normal file
27
nxy/plugins/kernel.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import feedparser
|
||||
from docopt import Dict as DocOptDict
|
||||
from irc3.plugins.command import command
|
||||
from irc3.utils import IrcString
|
||||
|
||||
from . import Plugin
|
||||
from ..utils import fmt
|
||||
|
||||
|
||||
class Kernel(Plugin):
|
||||
URL = 'https://www.kernel.org/feeds/kdist.xml'
|
||||
|
||||
@command
|
||||
def kernel(self, mask: IrcString, channel: IrcString, args: DocOptDict):
|
||||
"""Get Linux kernel releases.
|
||||
|
||||
%%kernel
|
||||
"""
|
||||
feed = feedparser.parse(self.URL)
|
||||
releases = []
|
||||
for e in feed['entries']:
|
||||
version, branch = e['title'].split(': ')
|
||||
if '(EOL)' in e['description']:
|
||||
branch = '%s, {italic}EOL{reset}' % branch
|
||||
releases.append('{bold}%s{reset} (%s)' % (version, branch))
|
||||
return fmt('[Kernel] {releases}'.format(releases=', '.join(releases)))
|
|
@ -1,4 +1,5 @@
|
|||
git+https://github.com/gawel/irc3.git#egg=irc3
|
||||
aiocron==0.6
|
||||
requests==2.14.2
|
||||
feedparser==5.2.1
|
||||
python_dotenv==0.6.4
|
||||
|
|
Loading…
Reference in New Issue
Block a user