2021, week 24

Created: by Pradeep Gowda. Updated: Jun 19, 2021 Tagged: weekly, python

Table of Contents

[TOC]

Monday, 2021-06-14 to Sunday, 2021-06-20

Code

Now using this script as I alluded in the previous week to generate the From around the web section from my pinboard.in bookmarks.

#!./venv/bin/python3

"""
gen_pinboard_bookmarks.py

Generate a list of markdown formatted stories
derived from pinboard.
(run venv/bin/pinboard-to-sqlite posts backups/pinboard.db
from the ~/btbytes dir first)
"""

import sqlite3
from isoweek import Week


def main(fromstring=None):
    """fromstring in the form of 2021W23"""
    con = sqlite3.connect('backups/pinboard.db')
    if fromstring:
        week = Week.fromstring(fromstring)
    else:
        week = Week.thisweek()
    first = week.days()[0].strftime('%Y-%m-%d')
    last = week.days()[-1].strftime('%Y-%m-%d')
    cur = con.cursor()
    cur.execute('select href, description, time, shared, tags, extended from posts where time >= ? and time <= ? and shared=1', (first, last))
    print(f'{week}, {first} - {last}\n')
    print('## From around the web\n')
    for r in cur.fetchall():
        if '#weekly' in r[4]:
            print(f'''* [{r[1]}]({r[0]})
{r[5]}
''')

if __name__ == '__main__':
    import sys
    if len(sys.argv) > 1:
        main(sys.argv[1])
    else:
        main()

From around the web


« Previous week | Next week »