Jump to content

Daniele

Member
  • Posts

    52
  • Joined

  • Last visited

Posts posted by Daniele

  1. Hello Dean,
    I don't know if you can help me, but I have the following problem.

    Is there a way, through the workflow, to "force" the system to download the song before playing it? My music folder is on iCloud/Google Drive, and when I play a song, the operating system tells iCloud or Google Drive to download the song automatically, but this doesn't happen with MPD.
    I am forced to go to the Finder and manually download the song. Is there a way to tell the workflow to "download the song before playing it"?

    I found this project that would be useful. But how to integrate it with the workflow?

    Thank you very much.

  2. 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

     

  3. 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 

  4. 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'"
        }
      ]
    }

     

  5. Sorry I tried following the instructions, this is the problem:

     

    daniele@DanieleMacBookAir2 ~ % export PATH="/opt/homebrew/bin:/usr/local/bin:${PATH}"
    daniele@DanieleMacBookAir2 ~ % eval "$(brew shellenv)"
    daniele@DanieleMacBookAir2 ~ % brew install pyenv
    Running `brew update --auto-update`...
    ==> Auto-updated Homebrew!
    Updated 1 tap (homebrew/core).
    
    You have 2 outdated casks installed.
    You can upgrade them with brew upgrade
    or list them with brew outdated.
    
    Warning: pyenv 2.3.2 is already installed and up-to-date.
    To reinstall 2.3.2, run:
      brew reinstall pyenv
    daniele@DanieleMacBookAir2 ~ % brew uninstall pyenv
    Uninstalling /usr/local/Cellar/pyenv/2.3.2... (930 files, 3MB)
    daniele@DanieleMacBookAir2 ~ % brew install pyenv  
    ==> Downloading https://ghcr.io/v2/homebrew/core/pyenv/manifests/2.3.2
    Already downloaded: /Users/daniele/Library/Caches/Homebrew/downloads/b8e6be81580ce4b7f6afe34641660ee285c256a7a508dfb64d50bfc06b90d5b9--pyenv-2.3.2.bottle_manifest.json
    ==> Downloading https://ghcr.io/v2/homebrew/core/pyenv/blobs/sha256:b37a5d64282152f2af9c63d2dbcd25f4ba2a3fa85decdbc2863dbd453a312658
    Already downloaded: /Users/daniele/Library/Caches/Homebrew/downloads/a2da35c7c036aa53d0078cef157147d380bce4a6299426c5a8054237e487365e--pyenv--2.3.2.monterey.bottle.tar.gz
    ==> Pouring pyenv--2.3.2.monterey.bottle.tar.gz
    🍺  /usr/local/Cellar/pyenv/2.3.2: 930 files, 3MB
    ==> Running `brew cleanup pyenv`...
    Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
    Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
    daniele@DanieleMacBookAir2 ~ % pyenv install 2.7.18
    python-build: use openssl@1.1 from homebrew
    python-build: use readline from homebrew
    Downloading Python-2.7.18.tar.xz...
    -> https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tar.xz
    Installing Python-2.7.18...
    patching file configure
    patching file configure.ac
    patching file setup.py
    patching file Mac/Tools/pythonw.c
    patching file setup.py
    patching file Doc/library/ctypes.rst
    patching file Lib/test/test_str.py
    patching file Lib/test/test_unicode.py
    patching file Modules/_ctypes/_ctypes.c
    patching file Modules/_ctypes/callproc.c
    patching file Modules/_ctypes/ctypes.h
    patching file Modules/_ctypes/callproc.c
    patching file setup.py
    patching file Mac/Modules/qt/setup.py
    patching file setup.py
    python-build: use tcl-tk from homebrew
    python-build: use readline from homebrew
    python-build: use zlib from xcode sdk
    
    BUILD FAILED (OS X 12.4 using python-build 20180424)
    
    Inspect or clean up the working tree at /var/folders/2z/smkrnfs54xvgyf05htq8xh680000gn/T/python-build.20220720163156.5009
    Results logged to /var/folders/2z/smkrnfs54xvgyf05htq8xh680000gn/T/python-build.20220720163156.5009.log
    
    Last 10 log lines:
    checking MACHDEP... darwin
    checking EXTRAPLATDIR... $(PLATMACDIRS)
    checking for --without-gcc... no
    checking for --with-icc... no
    checking for gcc... clang
    checking whether the C compiler works... no
    configure: error: in `/var/folders/2z/smkrnfs54xvgyf05htq8xh680000gn/T/python-build.20220720163156.5009/Python-2.7.18':
    configure: error: C compiler cannot create executables
    See `config.log' for more details
    make: *** No targets specified and no makefile found.  Stop.

     

    I also tried to delete all as you suggested previously, but it doesn't work:

     

    daniele@DanieleMacBookAir2 ~ % export PATH="/opt/homebrew/bin:/usr/local/bin:${PATH}"
    daniele@DanieleMacBookAir2 ~ % eval "$(brew shellenv)"
    daniele@DanieleMacBookAir2 ~ % osascript -e "tell application \"Finder\" to delete (POSIX file \"${HOME}/.pyenv\")"
    29:72: execution error: Finder got an error: Handler can’t handle objects of this class. (-10010)
    daniele@DanieleMacBookAir2 ~ % osascript -e "tell application \"Finder\" to delete (POSIX file \"${HOMEBREW_PREFIX}/bin/python\")"
    29:72: execution error: Finder got an error: Handler can’t handle objects of this class. (-10010)
    daniele@DanieleMacBookAir2 ~ % 

     

    Can I download Python here instead? https://www.python.org/downloads/release/python-2718/

     

    After the installation Python is here:

     

    daniele@DanieleMacBookAir2 ~ % which python
    /Library/Frameworks/Python.framework/Versions/2.7/bin/python

     

    Please help me thanks.

     

  6. 14 hours ago, vitor said:

    You’ll need to do some coding. Either make the metronome yourself or grab a ready made tool. Place the code in a Run Script Action and trigger it via a Keyword Input.


    To stop it, add another Keyword Input to kill/terminate the process.


    From your other posts I recall you can code, so I’ll leave the exact implementation to you, though we can assist with particular details which pertain to making it fit into Thank you 

     

  7. Hello mates,

     

    for hardware purposes, I'm forced to move to Windows on my desktop PC. 

     

    Alfred I miss you 🙂  

     

    I do EVERYTHING with Alfred on Mac.

     

    There are several "emulator" of Alfred on Windows.. But really... they suck.

    They're thousands light-years far away from Alfred.

     

    Suggestions? Wox, Listary, Microsoft PowerToys..... sucks sucks sucks...

     

    Sorry for this post, just a personal  outing....

     

  8. Great!  Simply adding 

     

    wf.add_item(title, valid=True, icon=ICON, arg=title, largetext=title)

     

    Dean, I'm using your library for Alfred with Python and it definitely solved all my problems.  I learnt Python thanks to you. I read your code, and try to understand what your're doing with the code. I created over 35 workflows specific for my purposes.

    I have only to say : THANKS! Truly.

  9. Hello,

     

    probably this is a stupid question.

     

    I have a script filter that read a file e print every line on Alfred.

     

    The simple problem is that is the string is too long it will be truncated.

     

    Example:

     

    The string "hello my name is Alex and I'm an university student in New York since 2008" 

     

    became

     

    "hello my name is Alex and ...in New York since 2008"

     

    Is there a shortcut to read all the output?

     

     

    Thanks

     

     

     

     

     

     

  10. Hello,

     

    I have a little script in python that simply check if a file exists.

     

    like this:

     


     

    import os
    
    
    def myfunction():
    	jpg = "Volumes/mydrive/image.jpg"
    	png = "Volumes/mydrive/image.png"
    
    	if os.path.isfile(jpg):
        	 return jpg
        elif os.path.isfile(png):
    	      return png
        else:
       		  return "none"  

     

    The problem is that, if I call this script from command line works perfectly. But if I launch this same script from a Script Filter in Alfred it always give me "none".

     

    What is my mistake?

     

    Thanks

     

     

×
×
  • Create New...