[core] restructure to allow PIP packaging
OK - so I have to admit I *hate* the fact that PIP seems to require a subdirectory named like the library. But since the PIP package is something really nifty to have (thanks to @tony again!!!), I updated the codebase to hopefully conform with what PIP expects. Testruns so far look promising...
This commit is contained in:
parent
1d25be2059
commit
320827d577
146 changed files with 2509 additions and 2 deletions
59
bumblebee_status/modules/contrib/mocp.py
Normal file
59
bumblebee_status/modules/contrib/mocp.py
Normal file
|
@ -0,0 +1,59 @@
|
|||
# pylint: disable=C0111,R0903
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""Displays information about the current song in mocp. Left click toggles play/pause. Right click toggles shuffle.
|
||||
|
||||
Requires the following executable:
|
||||
* mocp
|
||||
|
||||
Parameters:
|
||||
* mocp.format: Format string for the song information. Replace string sequences with the actual information:
|
||||
|
||||
* %state State
|
||||
* %file File
|
||||
* %title Title, includes track, artist, song title and album
|
||||
* %artist Artist
|
||||
* %song SongTitle
|
||||
* %album Album
|
||||
* %tt TotalTime
|
||||
* %tl TimeLeft
|
||||
* %ts TotalSec
|
||||
* %ct CurrentTime
|
||||
* %cs CurrentSec
|
||||
* %b Bitrate
|
||||
* %r Sample rate
|
||||
|
||||
contributed by `chrugi <https://github.com/chrugi>`_ - many thanks!
|
||||
"""
|
||||
|
||||
import core.module
|
||||
import core.widget
|
||||
import core.input
|
||||
|
||||
import util.cli
|
||||
|
||||
|
||||
class Module(core.module.Module):
|
||||
def __init__(self, config, theme):
|
||||
super().__init__(config, theme, core.widget.Widget(self.description))
|
||||
|
||||
core.input.register(self, button=core.input.LEFT_MOUSE, cmd="mocp -G")
|
||||
core.input.register(self, button=core.input.RIGHT_MOUSE, cmd="mocp -t shuffle")
|
||||
self.__format = self.parameter("format", "%state %artist - %song | %ct/%tt")
|
||||
self.__running = False
|
||||
|
||||
def description(self, widget):
|
||||
return self.__info if self.__running == True else "Music On Console Player"
|
||||
|
||||
def update(self):
|
||||
self.__load_song()
|
||||
|
||||
def __load_song(self):
|
||||
try:
|
||||
self.__info = util.cli.execute("mocp -Q '{}'".format(self.__format)).strip()
|
||||
self.__running = True
|
||||
except RuntimeError:
|
||||
self.__running = False
|
||||
|
||||
|
||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
Loading…
Add table
Add a link
Reference in a new issue