Giter Site home page Giter Site logo

radiobar's Introduction

RadioBar

macOS menubar app to play user-defined radio stations with help from rumps and VLC. It includes a remote to switch channels, on/off, pause/resume etc. Forked from RadioBar by David May

screenshot

Features

  • ▶️ Show Now Playing information (in menubar and/or notifications)
  • Lightweight and fast!
  • 🖥️ Menubar only, no Dock icon
  • 🎵 Add any streaming URL that VLC can play
  • 💤 Stop playing when macOS goes to sleep
  • 🕹️ Remote control via scripts and launchers such as Alfred

Installation

Make sure you have vlc installed, e.g. using brew cask install vlc. Also, if you don't have Python installed, install it with brew install python3. Use the master repo of rumps to use the sleep() and wake() events (see PR #109)

  • Adapt channels.json to your needs
  • Check the source code to e.g. change notification settings (manual for now)
  • Build the .app using python setup.py py2app (see Development)
  • Install the .app from the dist/ directory

Currently no packaged .app is distributed because I've not yet been able to include an easy way to change / update channels. Suggestions for an easy / simple mechanism are welcome!

Usage

  • Click a channel to start streaming (a ✔ is shown in front)
  • Click the current channel to pause streaming (a - is shown in front)
  • Click "Stop" to stop streaming a channel
  • "Now Playing" information shows on top of the menu and/or in menubar (truncated for long titles on smaller screens)
  • Notifications are show when the "Now playing" information changes (unless it's the channel / show name)

Check radiobar.py source code to set options to show notifications or show nowplaying in the menubar.

Pause / resume stops streaming (but shows the channel as paused). It's not buffering radio (which didn't seem logical for live radio). You can also use the remote.py to automate switching channels, see below.

When macOS sleeps streaming will be stopped and you have to manually resume it (this is a feature). This only works if you're using the latest version of rumps (see PR #109).

Remote

Use the include remote.py to send commands to a running RadioBar instance to change channels and switch on/off. You can also use the command as part of an Alfred workflow. remote.py understands the following commands:

  • n - switch to channel n in your list (starting at 1) - start playing if stopped
  • off - stop playing raudio
  • pause - pause playing radio (don't switch station, but stop streaming)
  • resume | on - resume playing radio (start streaming again)
  • nowplaying - output the now playing info
  • show - output the now playing info and trigger a notification

Development

Make sure you have VLC installed, ie. brew cask install vlc.

Tested in Python 2.7.x and 3.x. To run, try:

  1. pip install -r requirements.txt
  2. python radiobar.py

To re-build the macOS app, run:

  1. rm -rf ./dist/ ./build/
  2. python setup.py py2app

You can also use the supplied Makefile to use make clean, make build (default) and make install (to copy the new .app to /Applications)

Bugs

  • "Now playing" integration is experimental and might not work as expected

  • Sleep / wake only works when using a patched version of rumps until PR #109 gets merged.. This is now merged in rumps master.

  • parse_with_options might not not be needing the second argument (timeout) in your version. You could remove it (not sure yet if it makes any difference). I'm still trying to implement a hook that watches for metadata changes for now playing. Tips welcome :-)

  • To use it with the current VLC (>= 3.x) we need to preload the libvlccore.dylib as a workaround. See oaubert/python-vlc#37 for more info.

Credits

This is a fork of RadioBar built by wass3r (David May). All credits for the intial concept go to him!

License

MIT

radiobar's People

Contributors

mdbraber avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

radiobar's Issues

Keyboard / Touchbar media keys not working

This app is great, but one final piece is missing, ability to pause/resume or switch radio staton with media keys on keyboard or touchbar. Also in Big Sur currently playing has been introduced to menubar and radiobar is not present there with it's playback. Finally bluetooth headphones have media controls and they are not working with radiobar.

Python works, App does not

When compiled to a ".app" file the app does not start. Instead i get an error message "RadioBar Error" with the options "Open Console" and "Terminate".
Clicking on "Open Console" opens the system Error Console, but does not offer any help...

radiobar.py is working but app is not working

Hello.
The radiobar is super nice and small. I don't know why but when start radiobar.py** script is working perfectly only message that I get in console is
python3 radiobar.py radiobar.py:195: SyntaxWarning: "is not" with a literal. Did you mean "!="? if self.active_station is not None and self.menu[self.active_station].state is not 0:.

I add my favorite radio station in channels.json and everything is running perfectly. But when use py2app, after that radiobar.app in not starting. Just get an error message "RadioBar Error" with the options "Open Console" and "Terminate". Even I try with Makefile and the result is the same. May be I'm doing it something wrong because i'm beginner at Python.

After use py2app I get this message
`Modules not found (unconditional imports):

  • OpenSSL (urllib3.contrib.pyopenssl)
  • StringIO.StringIO (pkg_resources._vendor.six, urllib3.packages.six)
  • _abcoll (rumps.packages.ordereddict)
  • _gdbm (dbm.gnu)
  • _overlapped (asyncio.windows_events)
  • backports (urllib3.packages.ssl_match_hostname)
  • backports.CertificateError (backports.ssl_match_hostname)
  • backports.match_hostname (backports.ssl_match_hostname)
  • com (com.sun.jna)
  • com.jna (com.sun)
  • com.sun (com.sun.jna.platform)
  • cryptography (cryptography, cryptography.hazmat.backends, cryptography.x509.extensions, requests, urllib3.contrib.pyopenssl)
  • cryptography.version (cryptography.hazmat, cryptography.x509, urllib3.contrib.pyopenssl)
  • cryptography.hazmat (cryptography.hazmat.backends.openssl)
  • cryptography.hazmat.backends (cryptography.hazmat.backends.openssl.x509, urllib3.contrib.pyopenssl)
  • cryptography.hazmat.backends.openssl (urllib3.contrib.pyopenssl)
  • cryptography.hazmat.backends.openssl.backend (cryptography.hazmat.backends.openssl.x509)
  • cryptography.hazmat.backends.openssl.x509 (urllib3.contrib.pyopenssl)
  • cryptography.x509 (cryptography.hazmat, cryptography.x509, requests, urllib3.contrib.pyopenssl)
  • cryptography.x509.UnsupportedExtension (cryptography, cryptography.x509.extensions)
  • dummy_thread (rumps.packages.ordereddict)
  • msvcrt.getch (subprocess)
  • ordereddict (pkg_resources._vendor.pyparsing)
  • simplejson (requests.compat)
  • socks (urllib3.contrib.socks)
  • thread (rumps.packages.ordereddict)
  • urllib3.packages.six.moves (urllib3.connection, urllib3.connectionpool, urllib3.exceptions, urllib3.packages.six.moves, urllib3.packages.six.moves.urllib.parse, urllib3.response, urllib3.util.queue, urllib3.util.response) [module alias]
  • urllib3.packages.six.moves.http_client (urllib3.connection, urllib3.connectionpool, urllib3.exceptions, urllib3.packages.six.moves.http_client, urllib3.packages.six.moves.urllib, urllib3.util.queue) [module alias]
  • urllib3.packages.six.moves.queue (urllib3.packages.six.moves.http_client, urllib3.packages.six.moves.urllib, urllib3.response, urllib3.util.response) [module alias]
  • urllib3.packages.six.moves.urllib (urllib3.poolmanager, urllib3.request, urllib3.util.url) [module alias]
  • urllib3.packages.six.moves.urllib.parse (urllib3.poolmanager, urllib3.request, urllib3.util.url) [module alias]
  • win32com (win32com)
  • win32com.shell (win32com.shell)
  • win32com.shellcon (win32com.shell)

Modules not found (conditional imports):

  • Cookie (requests.compat)
  • OpenSSL.crypto (urllib3.contrib.pyopenssl)
  • Queue (urllib3.util.queue)
  • StringIO (pkg_resources._vendor.six, requests.compat, urllib3.packages.six)
  • com (pkg_resources._vendor.appdirs)
  • com.sun.jna (pkg_resources._vendor.appdirs)
  • com.sun.jna.platform (pkg_resources._vendor.appdirs)
  • cookielib (requests.compat)
  • cryptography.x509.extensions (urllib3.contrib.pyopenssl)
  • urllib2 (requests.compat)
  • urlparse (requests.compat)
  • win32com (pkg_resources._vendor.appdirs)
  • win32com.shell (pkg_resources._vendor.appdirs)

Errors in the console are
error 21:31:55.502606 +0300 sharingd Trying to grab power assertion while we already have one
error 21:32:01.034378 +0300 deleted volume validation failed for <<(null)>>
error 21:32:01.034627 +0300 deleted volume validation failed for <<(null)>>
error 21:32:05.523824 +0300 sharingd Trying to grab power assertion while we already have one
error 21:32:30.649135 +0300 deleted volume validation failed for <<(null)>>
error 21:32:30.649382 +0300 deleted volume validation failed for <<(null)>>
error 21:32:30.687786 +0300 symptomsd CacheDelete failed to retrieve files: The folder “Debuggability” doesn’t exist.
error 21:32:30.738950 +0300 cloudd Identity set was expected to have a current key set .
error 21:32:30.739017 +0300 cloudd Identity set does not have a current key set. Not using it.
error 21:32:30.739092 +0300 cloudd Didn't get a service identity from the PCS framework

I did everything that is the description. Any suggestions. I'm running on MacOS HIGH SIERRA (10.13.6)

Thank you in advance

No module named 'Rumps' ?

HI,

When using python setup.py py2app I'm getting the following error:

Traceback (most recent call last):
  File "setup.py", line 22, in <module>
    setup(
  File "/usr/local/lib/python3.8/site-packages/setuptools/__init__.py", line 165, in setup
    return distutils.core.setup(**attrs)
  File "/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python3.8/site-packages/py2app/build_app.py", line 907, in run
    self._run()
  File "/usr/local/lib/python3.8/site-packages/py2app/build_app.py", line 1125, in _run
    self.run_normal()
  File "/usr/local/lib/python3.8/site-packages/py2app/build_app.py", line 1237, in run_normal
    pkgdirs = self.collect_packagedirs()
  File "/usr/local/lib/python3.8/site-packages/py2app/build_app.py", line 1201, in collect_packagedirs
    [
  File "/usr/local/lib/python3.8/site-packages/py2app/build_app.py", line 1202, in <listcomp>
    os.path.join(os.path.realpath(self.get_bootstrap(pkg)), "")
  File "/usr/local/lib/python3.8/site-packages/py2app/build_app.py", line 2043, in get_bootstrap
    bootstrap = imp_find_module(bootstrap)[1]
  File "/usr/local/lib/python3.8/site-packages/modulegraph/util.py", line 33, in imp_find_module
    result = imp.find_module(name, path)
  File "/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/imp.py", line 296, in find_module
    raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named 'rumps'
  • macOS 10.15.6
  • python 3.8.5 via brew

Is "ImportError: No module named 'rumps'" relevant?

Thanks,

Steve

'NoneType' object is not subscriptable ?

macOS 10.14.
Python 3.7.2 (also tried with Python 2.7.10)

I get 'NoneType' object is not subscriptable ? from python3 setup.py py2app - can anyone help please? setup seems to be complaining about py2app being required, but afaict I already have it?

➜  pip3 install py2app
Requirement already satisfied: py2app in /usr/local/lib/python3.7/site-packages (0.18)
Requirement already satisfied: macholib>=1.11 in /usr/local/lib/python3.7/site-packages (from py2app) (1.11)
Requirement already satisfied: altgraph>=0.16 in /usr/local/lib/python3.7/site-packages (from py2app) (0.16.1)
Requirement already satisfied: modulegraph>=0.17 in /usr/local/lib/python3.7/site-packages (from py2app) (0.17)
Requirement already satisfied: setuptools in /usr/local/lib/python3.7/site-packages (from modulegraph>=0.17->py2app) (40.8.0)

and:

➜  ~ pip install py2app
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Requirement already satisfied: py2app in /Library/Python/2.7/site-packages (0.18)
Requirement already satisfied: altgraph>=0.16 in /Library/Python/2.7/site-packages (from py2app) (0.16.1)
Requirement already satisfied: modulegraph>=0.17 in /Library/Python/2.7/site-packages (from py2app) (0.17)
Requirement already satisfied: macholib>=1.11 in /Library/Python/2.7/site-packages (from py2app) (1.11)
Requirement already satisfied: setuptools in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from modulegraph>=0.17->py2app) (18.5)

Here's setup's full complaint:

Thanks,

➜  radiobar git:(master) python3 setup.py py2app
running py2app
creating /Users/steveharman/radiobar/build
creating /Users/steveharman/radiobar/build/bdist.macosx-10.14-x86_64
creating /Users/steveharman/radiobar/build/bdist.macosx-10.14-x86_64/python3.7-standalone
creating /Users/steveharman/radiobar/build/bdist.macosx-10.14-x86_64/python3.7-standalone/app
creating /Users/steveharman/radiobar/build/bdist.macosx-10.14-x86_64/python3.7-standalone/app/collect
creating /Users/steveharman/radiobar/build/bdist.macosx-10.14-x86_64/python3.7-standalone/app/temp
creating /Users/steveharman/radiobar/dist
creating build/bdist.macosx-10.14-x86_64/python3.7-standalone/app/lib-dynload
creating build/bdist.macosx-10.14-x86_64/python3.7-standalone/app/Frameworks
Traceback (most recent call last):
  File "setup.py", line 26, in <module>
    setup_requires=['py2app'],
  File "/usr/local/lib/python3.7/site-packages/setuptools/__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/Users/steveharman/radiobar/.eggs/py2app-0.18-py3.7.egg/py2app/build_app.py", line 838, in run
    self._run()
  File "/Users/steveharman/radiobar/.eggs/py2app-0.18-py3.7.egg/py2app/build_app.py", line 1053, in _run
    self.run_normal()
  File "/Users/steveharman/radiobar/.eggs/py2app-0.18-py3.7.egg/py2app/build_app.py", line 1146, in run_normal
    mf = self.get_modulefinder()
  File "/Users/steveharman/radiobar/.eggs/py2app-0.18-py3.7.egg/py2app/build_app.py", line 997, in get_modulefinder
    debug=debug,
  File "/Users/steveharman/radiobar/.eggs/modulegraph-0.17-py3.7.egg/modulegraph/find_modules.py", line 338, in find_modules
    find_needed_modules(mf, scripts, includes, packages)
  File "/Users/steveharman/radiobar/.eggs/modulegraph-0.17-py3.7.egg/modulegraph/find_modules.py", line 256, in find_needed_modules
    path = m.packagepath[0]
TypeError: 'NoneType' object is not subscriptable

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.