Jump to content

MPD (music player daemon) client


Recommended Posts

Alfred MPD

 

Control MPD from Alfred.

screenshot.png

Installation

 

Download the latest version from GitHub releases or Packal.

 

Usage

  • mpd [<query>] — View mpd status and search for tracks
    • On actions:       
      •   or ⌘+<NUM> — Perform action
    • On tracks:
      • or ⌘+<NUM> — Queue track
      • ⌘+↩ — Play track
      • ⌥+↩ — Clear queue and play track
      • ^+↩ — Queue album
    • On albums/artists/playlists/types:
      •  , or ⌘+<NUM> — Search within albums/artists/playlists/types

 

Licencing, thanks

 

This workflow is released under the MIT licence.
It is based on the Alfred-Workflow library, which is also released under the MIT licence.

 

Changelog

 

0.1.0

  1. First release
Edited by deanishe
Link to comment
  • 5 years later...
  • 4 weeks later...

Please help me. What is the problem?

I just reinstalled MacOS from scratch, installed Python 2. Installed new versione of MPD.

 

[10:23:39.483] Logging Started...
[10:23:41.890] MPD[Script Filter] Queuing argument ''
[10:23:42.163] MPD[Script Filter] Script with argv '' finished
[10:23:42.166] ERROR: MPD[Script Filter] Code 1: .
10:23:42 workflow.py:2061 DEBUG    ---------- MPD (0.1.3) ----------
10:23:42 workflow.py:1468 DEBUG    reading settings from /Users/daniele/Library/Application Support/Alfred/Workflow Data/net.deanishe.alfred.mpd/settings.json
10:23:42 workflow.py:2343 DEBUG    update check not due
10:23:42 ampd:686 DEBUG    opts={'--help': False,
 '--version': False,
 '<action>': None,
 '<query>': u'',
 'do': False,
 'search': True,
 'stats': False,
 'status': False}
10:23:42 ampd:687 DEBUG    mpd: host=localhost, port=6600
10:23:42 workflow.py:1695 DEBUG    loading cached data: /Users/daniele/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/net.deanishe.alfred.mpd/__workflow_latest_version.cpickle
10:23:42 mpd.py:140 DEBUG    mpc command: ['stats']
10:23:42 workflow.py:2080 ERROR    [Errno 2] No such file or directory
Traceback (most recent call last):
  File "/Volumes/GoogleDrive/Il mio Drive/Alfred.alfredpreferences/workflows/user.workflow.182A2FAE-2750-4640-AF36-4B51A5F96294/lib/workflow/workflow.py", line 2073, in run
    func(self)
  File "./ampd", line 691, in main
    return do_search(opts)
  File "./ampd", line 485, in do_search
    return do_stats(opts)
  File "./ampd", line 614, in do_stats
    st = mpd.stats()
  File "/Volumes/GoogleDrive/Il mio Drive/Alfred.alfredpreferences/workflows/user.workflow.182A2FAE-2750-4640-AF36-4B51A5F96294/lib/mpd.py", line 260, in stats
    for line in mpc('stats').splitlines():
  File "/Volumes/GoogleDrive/Il mio Drive/Alfred.alfredpreferences/workflows/user.workflow.182A2FAE-2750-4640-AF36-4B51A5F96294/lib/mpd.py", line 144, in mpc
    p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  File "/Users/daniele/.pyenv/versions/2.7.18/lib/python2.7/subprocess.py", line 394, in __init__
    errread, errwrite)
  File "/Users/daniele/.pyenv/versions/2.7.18/lib/python2.7/subprocess.py", line 1047, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory
10:23:42 workflow.py:2082 INFO     for assistance, see: https://github.com/deanishe/alfred-mpd/issues
10:23:42 workflow.py:2103 DEBUG    ---------- finished in 0.038s ----------
[10:23:42.169] MPD[Script Filter] {
  "items": [
    {
      "valid": false,
      "subtitle": "[Errno 2] No such file or directory",
      "icon": {
        "path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertStopIcon.icns"
      },
      "title": "Error in workflow 'MPD'"
    }
  ]
}

 

Link to comment
6 hours ago, Daniele said:

Please help me. What is the problem?

I just reinstalled MacOS from scratch, installed Python 2. Installed new versione of MPD.

 

[10:23:39.483] Logging Started...
[10:23:41.890] MPD[Script Filter] Queuing argument ''
[10:23:42.163] MPD[Script Filter] Script with argv '' finished
[10:23:42.166] ERROR: MPD[Script Filter] Code 1: .
10:23:42 workflow.py:2061 DEBUG    ---------- MPD (0.1.3) ----------
10:23:42 workflow.py:1468 DEBUG    reading settings from /Users/daniele/Library/Application Support/Alfred/Workflow Data/net.deanishe.alfred.mpd/settings.json
10:23:42 workflow.py:2343 DEBUG    update check not due
10:23:42 ampd:686 DEBUG    opts={'--help': False,
 '--version': False,
 '<action>': None,
 '<query>': u'',
 'do': False,
 'search': True,
 'stats': False,
 'status': False}
10:23:42 ampd:687 DEBUG    mpd: host=localhost, port=6600
10:23:42 workflow.py:1695 DEBUG    loading cached data: /Users/daniele/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/net.deanishe.alfred.mpd/__workflow_latest_version.cpickle
10:23:42 mpd.py:140 DEBUG    mpc command: ['stats']
10:23:42 workflow.py:2080 ERROR    [Errno 2] No such file or directory
Traceback (most recent call last):
  File "/Volumes/GoogleDrive/Il mio Drive/Alfred.alfredpreferences/workflows/user.workflow.182A2FAE-2750-4640-AF36-4B51A5F96294/lib/workflow/workflow.py", line 2073, in run
    func(self)
  File "./ampd", line 691, in main
    return do_search(opts)
  File "./ampd", line 485, in do_search
    return do_stats(opts)
  File "./ampd", line 614, in do_stats
    st = mpd.stats()
  File "/Volumes/GoogleDrive/Il mio Drive/Alfred.alfredpreferences/workflows/user.workflow.182A2FAE-2750-4640-AF36-4B51A5F96294/lib/mpd.py", line 260, in stats
    for line in mpc('stats').splitlines():
  File "/Volumes/GoogleDrive/Il mio Drive/Alfred.alfredpreferences/workflows/user.workflow.182A2FAE-2750-4640-AF36-4B51A5F96294/lib/mpd.py", line 144, in mpc
    p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  File "/Users/daniele/.pyenv/versions/2.7.18/lib/python2.7/subprocess.py", line 394, in __init__
    errread, errwrite)
  File "/Users/daniele/.pyenv/versions/2.7.18/lib/python2.7/subprocess.py", line 1047, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory
10:23:42 workflow.py:2082 INFO     for assistance, see: https://github.com/deanishe/alfred-mpd/issues
10:23:42 workflow.py:2103 DEBUG    ---------- finished in 0.038s ----------
[10:23:42.169] MPD[Script Filter] {
  "items": [
    {
      "valid": false,
      "subtitle": "[Errno 2] No such file or directory",
      "icon": {
        "path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertStopIcon.icns"
      },
      "title": "Error in workflow 'MPD'"
    }
  ]
}

 

SOLVED: simply, mpc was installed via brew, so in another dir. Need to specity the correct path for mpc in the workflow configuration. Thanks 

Link to comment
  • 7 months later...

Hello,

After updating to Ventura 13, I have had some problems with the workflow and mpd.

 

I don't know if you can help me because I don't think this problem is "workflow related." Let me explain.

 

Previously, I used to put my music files in a folder synced with Google Drive.

 

Before the update, when I added a file to the playlist through the workflow and played it, Google Drive automatically downloaded the file instantaneously and played it.

Now, I can see the music file on the workflow, I can also add to the playlist,  but when I try to play it, it shows this error:

 

ERROR: Failed to decode /Users/daniele/Library/CloudStorage/GoogleDrive-Daniele/Il mio Drive/DaniSynologyNas/Musica.nosync/I Cugini di campagna/I grandi successi originali/03 Conchiglia bianca.mp3; avformat_open_input() failed: Invalid argument

 

 

Now, If I access manually to the file via Finder, and download it by clicking on it (or simply, playing it via finder, or right-clicking -> making it available offline), the workflow works perfectly.

 

It seems like it couldn't talk to Google Driver/Finder to download the file.

 

The problem could be simply solved by downloading the file properly before playing it.

But How can I do this via the workflow script?

The question is, how I can download a specific file on python

 

Edited by Daniele
Link to comment
On 3/18/2023 at 7:54 AM, Daniele said:

Hello,

After updating to Ventura 13, I have had some problems with the workflow and mpd.

 

I don't know if you can help me because I don't think this problem is "workflow related." Let me explain.

 

Previously, I used to put my music files in a folder synced with Google Drive.

 

Before the update, when I added a file to the playlist through the workflow and played it, Google Drive automatically downloaded the file instantaneously and played it.

Now, I can see the music file on the workflow, I can also add to the playlist,  but when I try to play it, it shows this error:

 

ERROR: Failed to decode /Users/daniele/Library/CloudStorage/GoogleDrive-Daniele/Il mio Drive/DaniSynologyNas/Musica.nosync/I Cugini di campagna/I grandi successi originali/03 Conchiglia bianca.mp3; avformat_open_input() failed: Invalid argument

 

 

Now, If I access manually to the file via Finder, and download it by clicking on it (or simply, playing it via finder, or right-clicking -> making it available offline), the workflow works perfectly.

 

It seems like it couldn't talk to Google Driver/Finder to download the file.

 

The problem could be simply solved by downloading the file properly before playing it.

But How can I do this via the workflow script?

The question is, how I can download a specific file on python

 

Dean, any idea?

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...