<commit_before>#!/usr/bin/env python

import sys
import rospy
from lg_volume_control import VolumeControlSlave
from lg_volume_control.srv import Volume
from std_msgs.msg import Int8


def main():
    rospy.init_node('volume_control_slave')

    rospy.wait_for_service('volume')
    volume_to_set = grab_master_volume()

    audio_sink = rospy.get_param('~default_sink', 0)

    volume_slave = VolumeControlSlave(audio_sink)
    volume_slave.set_volume(volume_to_set)

    rospy.Subscriber('/volume/level', Int8, volume_slave.set_volume_topic_handler)

    rospy.spin()


def grab_master_volume():
    try:
        master_node_volume = rospy.ServiceProxy('volume', Volume)
        rospy.sleep(1)
        volume = master_node_volume()
        rospy.logdebug("got volume {} from master".format(volume))
        return volume.volume
    except rospy.ServiceException, e:
        rospy.logerr("Problem grabbing the master volume")
        return None<commit_msg>fix default sink<commit_after>#!/usr/bin/env python

import sys
import rospy
from lg_volume_control import VolumeControlSlave
from lg_volume_control.srv import Volume
from std_msgs.msg import Int8


def main():
    rospy.init_node('volume_control_slave')

    rospy.wait_for_service('volume')
    volume_to_set = grab_master_volume()

    audio_sink = rospy.get_param('~default_sink', "@DEFAULT_SINK@")

    volume_slave = VolumeControlSlave(audio_sink)
    volume_slave.set_volume(volume_to_set)

    rospy.Subscriber('/volume/level', Int8, volume_slave.set_volume_topic_handler)

    rospy.spin()


def grab_master_volume():
    try:
        master_node_volume = rospy.ServiceProxy('volume', Volume)
        rospy.sleep(1)
        volume = master_node_volume()
        rospy.logdebug("got volume {} from master".format(volume))
        return volume.volume
    except rospy.ServiceException, e:
        rospy.logerr("Problem grabbing the master volume")
        return None
{'fraction_non_alphanumeric': 0.09420289855072464, 'fraction_numerical': 0.0036231884057971015, 'mean_word_length': 4.020779220779221, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2134473', 'n_tokens_mistral': 649, 'n_tokens_neox': 627, 'n_words': 119}