<commit_before>#!/bin/python3
import os
import sys
import argparse
import json
import subprocess
import shlex
import socket
from datetime import datetime

# configuration
MINIMUM_WATCHED_PERCENTAGE = 80
MINIMUM_DURATION = 300 # five minutes
IGNORE_ONLINE_STREAMS = True
REMOTE_HOST = 'burza'
REMOTE_LOG_PATH = '/srv/www/tmp.sakuya.pl/public_html/mal/watched.lst'
ALLOWED_EXTENSIONS = ['mkv', 'mp4', 'avi', 'm4v', 'mov', 'flv', 'mpeg', 'mpg', 'wmv', 'ogv', 'webm', 'rm']

def parse_args():
    parser = argparse.ArgumentParser(description='Send playback log')
    parser.add_argument('--path', required=True)
    parser.add_argument('--percent', required=True, type=float)
    parser.add_argument('--duration', required=True, type=float)
    return parser.parse_args()

def main():
    args = parse_args()

    try:
        _,  extension = os.path.splitext(args.path)
        extension = extension.strip('.')

        if extension.lower() not in ALLOWED_EXTENSIONS:
            raise RuntimeError('Extension doesn\'t match allowed files, skipping')

        if not args.duration:
            raise RuntimeError('No information on duration, skipping')
<commit_msg>mod-mpv: fix path to playback history<commit_after>#!/bin/python3
import os
import sys
import argparse
import json
import subprocess
import shlex
import socket
from datetime import datetime

# configuration
MINIMUM_WATCHED_PERCENTAGE = 80
MINIMUM_DURATION = 300 # five minutes
IGNORE_ONLINE_STREAMS = True
REMOTE_HOST = 'burza'
REMOTE_LOG_PATH = '/srv/www/tmp.sakuya.pl/mal/watched.lst'
ALLOWED_EXTENSIONS = ['mkv', 'mp4', 'avi', 'm4v', 'mov', 'flv', 'mpeg', 'mpg', 'wmv', 'ogv', 'webm', 'rm']

def parse_args():
    parser = argparse.ArgumentParser(description='Send playback log')
    parser.add_argument('--path', required=True)
    parser.add_argument('--percent', required=True, type=float)
    parser.add_argument('--duration', required=True, type=float)
    return parser.parse_args()

def main():
    args = parse_args()

    try:
        _,  extension = os.path.splitext(args.path)
        extension = extension.strip('.')

        if extension.lower() not in ALLOWED_EXTENSIONS:
            raise RuntimeError('Extension doesn\'t match allowed files, skipping')

        if not args.duration:
            raise RuntimeError('No information on duration, skipping')

{'fraction_non_alphanumeric': 0.1271404109589041, 'fraction_numerical': 0.00684931506849315, 'mean_word_length': 4.125, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6070231', 'n_tokens_mistral': 785, 'n_tokens_neox': 745, 'n_words': 187}