Giter Site home page Giter Site logo

Comments (3)

mdbraber avatar mdbraber commented on August 30, 2024

You can send commands through a TCP connection on port 65432 on localhost. E.g. you can use the commands 'on' 'off' or any number that corresponds with your radio presets. Below is an example script which I use with an Alfred workflow to issue the commands (this is similar to remote.py in the repository). Also check the explanation in the README.

import socket
import sys
import time
import subprocess
import errno
from socket import error as socket_error

HOST = '127.0.0.1'  # The server's hostname or IP address
PORT = 65432        # The port used by the server

def connect():
    try:
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        s.connect((HOST, PORT))
        return s
    except socket_error as serr:
        if serr.errno != errno.ECONNREFUSED:
            raise serr
        subprocess.Popen(["open","/Applications/RadioBar.app"])
        time.sleep(5)
        return connect()

try:
    s = connect()
    s.sendall(sys.argv[1])
    data = s.recv(1024)
    print(data)
except socket_error as serr:
    print(serr)
    sys.exit(1)

from radiobar.

helotpl avatar helotpl commented on August 30, 2024

Thank you for reply. How are you plugging such script to keys? Are you able to control other media apps once they are playing after assigning these keys to radiobar?

from radiobar.

mdbraber avatar mdbraber commented on August 30, 2024

Take a look at apps like Alfred, Keyboard Maestro or Fastscripts.

from radiobar.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.