<commit_before>package cmus

import (
	"github.com/guelfey/go.dbus"
)

var data string

func Manager(notify chan int) {
	con, _ := dbus.SessionBus()
	con.BusObject().Call("org.freedesktop.DBus.AddMatch", 0, "member='track_change',interface='net.sourceforge.cmus'")
	sig := make(chan *dbus.Signal, 10)
	con.Signal(sig)

	cmus := con.Object("net.sourceforge.cmus", "/net/sourceforge/cmus")
	format := func() {
		artist := ""
		cmus.Call("artist", 0).Store(&artist)
		title := ""
		cmus.Call("title", 0).Store(&title)
		data = "dddddd;1c1c1c; \u266b "
		data += artist;
		if artist != "" && title != "" {
			data += " - "
		}
		data += title
		data += " \u266b ;;"
		notify <- 0
	}

	format()
	for _ = range sig {
		format()
	}
}

func Format() string {
	return data
}<commit_msg>handle exit signal from cmus<commit_after>package cmus

import (
	"github.com/guelfey/go.dbus"
	"strings"
)

var data string

func Manager(notify chan int) {
	con, _ := dbus.SessionBus()
	con.BusObject().Call("org.freedesktop.DBus.AddMatch", 0, "type='signal',interface='net.sourceforge.cmus'")
	sig := make(chan *dbus.Signal, 10)
	con.Signal(sig)

	cmus := con.Object("net.sourceforge.cmus", "/net/sourceforge/cmus")
	format := func() {
		artist := ""
		cmus.Call("artist", 0).Store(&artist)
		title := ""
		cmus.Call("title", 0).Store(&title)
		data = "dddddd;1c1c1c; \u266b "
		data += artist;
		if artist != "" && title != "" {
			data += " - "
		}
		data += title
		data += " \u266b ;;"
		notify <- 0
	}

	format()
	for s := range sig {
		switch strings.TrimPrefix(s.Name, "net.sourceforge.cmus.") {
		case "track_change": fallthrough
		case "exit":
			format()
		}
	}
}

func Format() string {
	return data
}
{'fraction_non_alphanumeric': 0.19410029498525075, 'fraction_numerical': 0.017699115044247787, 'mean_word_length': 3.5962059620596207, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 3, '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': '2582957', 'n_tokens_mistral': 739, 'n_tokens_neox': 668, 'n_words': 128}