示例#1
0
def main():
    meta = {
        'artist': str(sh.playerctl('metadata', 'artist').wait()),
        #'album': str(sh.playerctl('metadata', 'album').wait()),
        'track': str(sh.playerctl('metadata', 'title').wait()),
    }
    print('  {artist} - {track} '.format(**meta))
示例#2
0
def now_playing():
    META_FILE_REGEX=re.compile(b"xesam:url.+file://(.+)")
    ### Grab the URLEncoded file path from the 'playerctl meta' command
    command = sh.playerctl('metadata')

    from urllib.parse import unquote

    encoded_filepath = META_FILE_REGEX.search(command.stdout).groups()[0]
    filepath = unquote(encoded_filepath)
    filename = filepath.split('/')[-1]

    return '.'.join(filename.split('.')[:-1])
示例#3
0
def previous(qtile):
    sh.playerctl('previous')
示例#4
0
def next(qtile):
    sh.playerctl('next')
示例#5
0
def stop(qtile):
    sh.playerctl('stop')
示例#6
0
def play_pause(qtile):
    sh.playerctl('play-pause')