<commit_before><commit_msg>Added conkycalc<commit_after>#!/usr/bin/env python
# this thing lets me calculate the average songs I played since I joined lastfm
# sure, the website tells me as well, however, I want to have at least a few
# decimals, to see if it changes.
# This thing runs via a script for conky and displays the average there

from datetime import date, datetime
import time
from lxml import html
import requests
import re

# Get the days between today and my lastm joined date
date_format = "%d/%m/%Y"
a = datetime.strptime('09/1/2009', date_format)
b = datetime.strptime(time.strftime("%d/%m/%Y"), date_format)
delta = b - a

# get the current playcount from lastfm
page = requests.get('https://www.last.fm/user/StonedEars')
tree = html.fromstring(page.content)
playcount = tree.xpath('//*[@id="content"]/div[2]/header/div[2]/div/div[2]/div[2]/ul/li[1]/p/a/text()')
cleancount = int(re.sub("[^\d\.]", "", playcount[0])) / int(delta.days + 1)

# Display the stuff
print (str("%.3f" % cleancount))
{'fraction_non_alphanumeric': 0.14624505928853754, 'fraction_numerical': 0.014822134387351778, 'mean_word_length': 4.659217877094972, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 1}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3335970', 'n_tokens_mistral': 344, 'n_tokens_neox': 336, 'n_words': 111}