<commit_before># requires Python 3
from abc import ABCMeta, abstractmethod
import json
import os.path
import socket
import sys
import time

import hexchat


__module_name__ = "mpv now playing"
__module_version__ = "0.4.2"
__module_description__ = "Announces info of the currently loaded 'file' in mpv"

# # Configuration # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

# Paths to mpv's IPC socket or named pipe.
# Set the same path in your mpv.conf `input-ipc-server` setting
# or adjust these values.
WIN_PIPE_PATH = R"\\.\pipe\mpvsocket"
UNIX_PIPE_PATH = "/tmp/mpv-socket"  # variables are expanded

# Windows only:
# The command that is being executed.
# Supports mpv's property expansion:
# https://mpv.io/manual/stable/#property-expansion
CMD_FMT = R'me is playing \x02${media-title}\x02 [${time-pos}${!duration==0: / ${duration}}]'

# On UNIX, the above is not supported yet
# and this Python format string is used instead.
# `{title}` will be replaced with the title.
LEGACY_CMD_FMT = "me is playing \x02{title}\x02"


# # The Script # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #


def _tempfile_path(*args, **kwargs):
    """Generate a sure-to-be-free tempfile path.

    It's hacky but it works.
    """
    import tempfile
    fd, tmpfile = tempfile.mkstemp()
    # close and delete; we only want the path
    os.close(fd)
    os.remove(tmpfile)
    return tmpfile

<commit_msg>Change default format not to use "IRC styles"<commit_after># requires Python 3
from abc import ABCMeta, abstractmethod
import json
import os.path
import socket
import sys
import time

import hexchat


__module_name__ = "mpv now playing"
__module_version__ = "0.4.2"
__module_description__ = "Announces info of the currently loaded 'file' in mpv"

# # Configuration # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

# Paths to mpv's IPC socket or named pipe.
# Set the same path in your mpv.conf `input-ipc-server` setting
# or adjust these values.
WIN_PIPE_PATH = R"\\.\pipe\mpvsocket"
UNIX_PIPE_PATH = "/tmp/mpv-socket"  # variables are expanded

# Windows only:
# The command that is being executed.
# Supports mpv's property expansion:
# https://mpv.io/manual/stable/#property-expansion
CMD_FMT = R'me is playing: ${media-title} [${time-pos}${!duration==0: / ${duration}}]'

# On UNIX, the above is not supported yet
# and this Python format string is used instead.
# `{title}` will be replaced with the title.
LEGACY_CMD_FMT = "me is playing: {title}"


# # The Script # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #


def _tempfile_path(*args, **kwargs):
    """Generate a sure-to-be-free tempfile path.

    It's hacky but it works.
    """
    import tempfile
    fd, tmpfile = tempfile.mkstemp()
    # close and delete; we only want the path
    os.close(fd)
    os.remove(tmpfile)
    return tmpfile


{'fraction_non_alphanumeric': 0.1523809523809524, 'fraction_numerical': 0.006122448979591836, 'mean_word_length': 3.2255747126436782, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 24, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1288629', 'n_tokens_mistral': 1044, 'n_tokens_neox': 1022, 'n_words': 299}