module rss.rss_database
¶
Short summary¶
module pyrsslocal.rss.rss_database
Description of a RSS stream.
Classes¶
class |
truncated documentation |
---|---|
Database specific to RSS. |
Static Methods¶
staticmethod |
truncated documentation |
---|---|
Returns the same datetime but with no time. |
|
Returns the same datetime but with no time. |
|
returns the schema for a specific table |
Methods¶
method |
truncated documentation |
---|---|
usual |
|
Creates the missing tables. |
|
Enumerates all the blogs from the database. |
|
Retrieves the latest status for a post. |
|
Enumerates all the posts from the database if the blog id belongs to a selection (or all if blog_selection is empty). … |
|
Enumerate status. |
|
Returns a :epkg:`SQL` query corresponding to list of posts. |
Documentation¶
Description of a RSS stream.
- class pyrsslocal.rss.rss_database.DatabaseRSS(dbfile, table_blogs='blogs', table_posts='posts', table_stats='posts_stat', table_event='events', LOG=<function fLOG>)¶
Bases:
Database
Database specific to RSS.
- Parameters:
dbfile – file database
table_blogs – table name for the blogs
table_posts – table name for the posts
table_stats – table name for the posts stats
table_event – table name for the events
LOG – logging function
- __init__(dbfile, table_blogs='blogs', table_posts='posts', table_stats='posts_stat', table_event='events', LOG=<function fLOG>)¶
- Parameters:
dbfile – file database
table_blogs – table name for the blogs
table_posts – table name for the posts
table_stats – table name for the posts stats
table_event – table name for the events
LOG – logging function
- __str__()¶
usual
- create_missing_table()¶
Creates the missing tables.
- enumerate_blogs(sorted_=True, specific=None, daily_freq=1.5, now=None, addstat=False)¶
Enumerates all the blogs from the database.
- Parameters:
sorted – sorted by title
specific – specific search - None: all blogs - today: get all blogs for today - twoday: get all blogs for today and yesterday - week: get all blogs for last week - notfrequent: get all blogs publishing less posts in a day than
daily_freq
- frequent: get all blogs publishing more posts in a day thandaily_freq
daily_freq – see parameter specific
now – if None, today means today, if not None,
now
will have the meaning of todayaddstat – if True, the function will a field corresponding to the number of posts from this blog
- Returns:
enumeration of
StreamRSS
- enumerate_latest_status(postid, nb=1, connect=True)¶
Retrieves the latest status for a post.
- Parameters:
postid – post id
nb – number of desired status
connect – connect (True) or skip connection (False)
- Returns:
enumerate on values from
table_stats
ordered by decreasing time
- enumerate_posts(blog_selection=None, post_selection=None, sorted_=True, first=1000, specific=None, daily_freq=1.5, now=None, addstatus=False, searchterm=None)¶
Enumerates all the posts from the database if the blog id belongs to a selection (or all if blog_selection is empty).
- Parameters:
blog_selection – list of blogs to consider (or empty for all)
post_selection – list of posts to consider
sorted – sorted by date
first – we only consider the first
first
specific – specific search - None: all posts - today: get all posts for today - week: get all posts for last week
daily_freq – see parameter specific
now – if None, today means today, if not None,
now
will have the meaning of todayaddstatus – if True, fetches the status of a blog
searchterm – if not None, filters using a SQL like search (using
%
)
- Returns:
enumeration of
BlogPost
- enumerate_posts_status(blog_selection=None, post_selection=None, sorted_=True, specific=None, now=None, searchterm=None)¶
Enumerate status.
- Parameters:
blog_selection – list of blogs to consider (or empty for all)
post_selection – list of posts to consider
sorted – sorted by date
specific – specific search - None: all posts - today: get all posts for today - week: get all posts for last week
now – if None, today means today, if not None,
now
will have the meaning of todaysearchterm – if not None, filters using a SQL like search (using
%
)
- Returns:
enumerate on values from
table_stats
ordered by decreasing time
- static getday(dt)¶
Returns the same datetime but with no time.
- Parameters:
dt – datetime
- Returns:
datetime which correspond to the beginning of the day
- static getdayn(dt)¶
Returns the same datetime but with no time.
- Parameters:
dt – datetime
- Returns:
datetime which correspond to the beginning of the day
- private_process_condition(blog_selection=None, post_selection=None, sorted_=True, specific=None, now=None, searchterm=None)¶
Returns a :epkg:`SQL` query corresponding to list of posts.
- Parameters:
blog_selection – list of blogs to consider (or empty for all)
post_selection – list of posts to consider
sorted – sorted by date
specific – specific search - None: all posts - today: get all posts for today - week: get all posts for last week
searchterm – if not None, filters using a SQL like search (using
%
)now – if None, today means today, if not None,
now
will have the meaning of today
- Returns:
SQL query
- static schema_table(table)¶
returns the schema for a specific table
- Parameters:
table – name (in [“stats”, “event”])
- Returns:
dictionary