<commit_before>#!/bin/sh

cd /home/librefm/turtle/data/wip || exit 1

#we rely on lack of whitespace here
LIST=$(echo "SELECT DISTINCT username FROM Users;" | psql -q -t)

for I in $LIST; do

    cat /home/librefm/scripts/license > $I.text.utf8
    
    echo 'COPY (SELECT * FROM Scrobbles where username='"'$I'"') TO STDOUT WITH CSV HEADER;' | psql -q >> $I.text.utf8

    mv -- $I.text.utf8 /home/librefm/turtle/data/
done<commit_msg>user dump locking if lockfile-progs is installed<commit_after>#!/bin/sh

cd /home/librefm/turtle/data/wip || exit 1

if [ -x /usr/bin/lockfile-create ]; then
	lockfile-create /var/lock/gnukebox-userdump.lock
	lockfile-touch /var/lock/gnukebox-userdump.lock &
	LOCKER="$!"
else
	echo >&2 "Running without locking."
fi

#we rely on lack of whitespace here
LIST=$(echo "SELECT DISTINCT username FROM Users;" | psql -q -t)

for I in $LIST; do

    cat /home/librefm/scripts/license > $I.text.utf8
    
    echo 'COPY (SELECT * FROM Scrobbles where username='"'$I'"') TO STDOUT WITH CSV HEADER;' | psql -q >> $I.text.utf8

    mv -- $I.text.utf8 /home/librefm/turtle/data/
done

if [ -x /usr/bin/lockfile-create ]; then
	kill "${LOCKER}"
	lockfile-remove /var/lock/gnukebox-userdump.lock
fi
{'fraction_non_alphanumeric': 0.14987714987714987, 'fraction_numerical': 0.007371007371007371, 'mean_word_length': 3.3487544483985765, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, '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': '1511082', 'n_tokens_mistral': 487, 'n_tokens_neox': 464, 'n_words': 126}