<commit_before>#!/bin/bash
USERNAME=lastfm_username
UPDATE_INTERVAL=30	# In seconds

###############

if [ ! -d /tmp/tmux-powerline ]; then
	mkdir -p /tmp/tmux-powerline
fi

if [ ! -f /tmp/tmux-powerline/lastfm.txt ]; then
	LAST_UPDATE=0
else
	LAST_UPDATED=$(stat -c %X /tmp/tmux-powerline/lastfm.txt)
fi

INTERVAL_AGO=$(date --date="$UPDATE_INTERVAL second ago" +%s)

if [ $LAST_UPDATED -le $INTERVAL_AGO ]; then
	touch /tmp/tmux-powerline/lastfm.txt
	wget -qO- http://ws.audioscrobbler.com/1.0/user/$USERNAME/recenttracks.txt|head -n 1|sed -e 's/^[0-9]*,//'|sed 's/\xe2\x80\x93/-/' | tee /tmp/tmux-powerline/lastfm.txt
else
	cat /tmp/tmux-powerline/lastfm.txt
fi<commit_msg>Fixed some bugs<commit_after>#!/bin/bash
USERNAME=lastfm_username
UPDATE_INTERVAL=30	# In seconds

###############

if [ ! -d /tmp/tmux-powerline ]; then
	mkdir -p /tmp/tmux-powerline
fi

if [ ! -f /tmp/tmux-powerline/lastfm.txt ]; then
	LAST_UPDATED=0
else
	LAST_UPDATED=$(stat -c %X /tmp/tmux-powerline/lastfm.txt)
fi

INTERVAL_AGO=$(date --date="$UPDATE_INTERVAL second ago" +%s)

if [ $LAST_UPDATED -le $INTERVAL_AGO ]; then
	touch /tmp/tmux-powerline/lastfm.txt
	wget -qO- http://ws.audioscrobbler.com/1.0/user/$USERNAME/recenttracks.txt|head -n 1|sed -e 's/^[0-9]*,//'|sed 's/\xe2\x80\x93/-/' > /tmp/tmux-powerline/lastfm.txt
	cat /tmp/tmux-powerline/lastfm.txt
else
	cat /tmp/tmux-powerline/lastfm.txt
fi
{'fraction_non_alphanumeric': 0.193943763518385, 'fraction_numerical': 0.018745493871665464, 'mean_word_length': 3.921985815602837, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '6399044', 'n_tokens_mistral': 625, 'n_tokens_neox': 601, 'n_words': 102}