Jump to content

vitor

Staff
  • Posts

    8,494
  • Joined

  • Last visited

  • Days Won

    708

Posts posted by vitor

  1. After making some tests, I was able to reproduce the problem. The bad news is that there is currently no way to avoid that in Alfred unless the workflow goes back to its previous, slower, mode of operation. You can understand why, then, I’m a bit thorn on this.
     
    The problem arises from how Alfred operates, even though it’s a feature, not a bug. You’ll notice it’s not the tags themselves that get truncated, it’s the full text you type into the workflow. This happens when the script filter didn’t have time to update with everything you typed. So we need to either give it a moment before pressing return, or go back to the previous version. Needless to say, I find neither of those options optimal, but unfortunately it is also out of my control, as this is something having to do with the way workflows in Alfred work.
     
    The optimal solution, however, would be to not have that limitation at all, and I’ve started a thread with that request, where you can voice your opinion — the more interest there is, the more likely this is to be considered/implemented. There’s also another thread with a similar request, that you can follow.

  2. I think I will just convert the video with osx built in encoder. Definitely faster.

     

    I disagree. If that’s the kind of thing you do so often that you want a workflow, that doing it that way is definitely slower.

    The method I’ve outlined takes longer to setup, granted, but you only have to do that once, and in the long run it’s way faster, if only because it’ll be a one step process with a single keyword, instead of a multiple step process where you have to type the keyword, wait for it to download (which varies from video to video), start another process to convert it, wait for that to finish, and delete the video. It’s a small tedious process multiple times, versus a big tedious process once.

    Perceived speed is often better than actual speed, psychologically (if only to us, users of software like Alfred). “Set it and forget it” is arguably the better option — that is why workflows are great.

  3. There are many workflows that need configuring before being used (mainly the ones that need some type of account login/setting). However, there's no practical way of implementing that via Alfred. I find making users edit settings manually or having a separate option that'll always show in the results, for an action you typically only run once, to be non-optimal experiences.

    For this purpose, I have two workflows that employ a script filter, that does something like this

    if (settings_file_exists)
        show xml with
            text — “configure your account”
            arg — <some_string_to_let_the_script_know_it_is_a_configuration> {query}
    else
        show xml with
            text — “do your action”
            arg — {query}
    

    Even though this works well with DownVid, since only the configuration is needed (the else part takes no input); with PinAdd, not so much.

    The problem here is that since PinAdd takes {query} as the xml’s arg, if your computer is slow at the moment or you type too fast and then press return, Alfred will act immediately, without waiting for the xml to rebuild/re‐output with the updated {query}. Realistically, I only need the xml to build once, and then take the full, correct, untruncated {query} as the argument, where requested.

    Perhaps script filters aren’t build around this idea, but there is clearly a need for it, as currently you only get one of the worlds — either you can show different options depending on the case but you can’t really type some action to be passed through (script filters), or you can get the action perfectly but without having options (keyword input).

    My suggestion is then, perhaps instead of creating more options in script filters for specific cases, maybe create a separate category like “keyword filter” or “keyword conditional” or some better name. What this would do is allow you to specify some code to run as soon as you enter its name (much like script filters do), but this code would run only once, outputting some predefined xml, and would take a full argument passed through, much like the keyword input.

  4. Here are the instructions on how to change this workflow to get the audio from videos, instead of (or in addition to) the video.

    I warn you that it may be a lengthy process (it’s not difficult, it just takes a while, specially if you do not have some things installed).

    youtube-dl uses ffmpeg to extract the audio, so you likely need to install it, but I cover that in the instructions.

    1. Open a terminal.
    2. Install homebrew (if you don’t have it). It might ask you to install XCode’s CLI tools.

    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

    3. Install ffmpeg (again, if you don’t have it) by running

    brew install ffmpeg

    4. After it finishes, you can close the terminal.
    5. Open the workflow, and after that double-click the topmost “Run Script” node.
    6. At the top of the code that appears, paste this

    export PATH="/usr/local/bin:$PATH"

    7. Now you’ll have to make a choice. Keep in mind that it’ll still download the video, but it’ll then extract the audio from it and delete the video (or not, that’s the choice).
    8. If you want to always download only the audio, change (a few lines under getfile() {)

    python youtube-dl --no-playlist --newline --output "${downdir}/%(title)s.%(ext)s" "${link}" > "${progressfile}"
    

    to 

    python youtube-dl --extract-audio --no-playlist --newline --output "${downdir}/%(title)s.%(ext)s" "${link}" > "${progressfile}"
    

    If you want to keep both the audio and video, change it to

    python youtube-dl --extract-audio --keep-video --no-playlist --newline --output "${downdir}/%(title)s.%(ext)s" "${link}" > "${progressfile}"
    

    9. You can now save. You’re done.

    Steps 2 and 3 can take some time, particularly 3 since it will download and compile from source (ffmpeg can take some time).

    If you have any difficulty with any of the steps, please state what problems you’re having, and we can work from there.

  5. Before reporting an issue with downloading, open a terminal then copy and paste the following code and press ↩:


    PATH="/opt/homebrew/bin:/usr/local/bin:${PATH}"
    brew upgrade yt-dlp
    


    Then try again. If the download still fails, return to the same terminal window and run:


    yt-dlp "YOUR-URL-HERE"
    


    Replacing YOUR-URL-HERE (but keep the double quotes) with the URL that is failing. Then report the error on the yt-dlp issue tracker, as they’re the ones who’ll be able to fix the issue. The workflow relies on that tool for the downloads.

  6. Usage


    Download video from a plethora of online sources via the dv keyword. Download audio with da. Your clipboard and frontmost browser tab are checked for links.


    dv.png

    • ↩: Download.
    • ⌘↩: Download full playlist.
    • ⌥↩: Toggle adding to Watch List.

    Alternatively, download with the Universal Action.


    ua.png


    Check download progress via the dp keyword.


    dp.png

    • ⌘↩: Restart download.
    • ⌃↩: Cancel.

    ⤓ Install on the Alfred Gallery | Source

     

  7. Wow, Vitor, it's crazy quick now!

    I love it. I love it. I love it. I love it... THANKS! :D

    Thanks for the update and the insight.  The new version is definitely faster.

     

    Thank you all, it’s good to know the difference is as noticeable as I hoped it’d be.

     

    I think squiggly brackets would work but something quicker to type would be perhaps splitting the description from tags with a forward slash,

     

    e.g. pin onetag anothertag / This is my description, and if there is no slash then there is no description.

     

    Agreed, something quicker would be more convenient, as would be having a single separator. My only worry is to not set something that could possibly be used as a tag, that’s why I’m a fan of repeated characters for this (something like “||” or even “,,”). I’ll do some tests.

  8. Update.

    It now outputs notifications (it’s nice to know the action you’ve selected got through).

    When deleting files, instead of simply moving them to the trash, it uses applescript to delete them. This will give you both that satisfying “send to trash” sound and will give you greater flexibility, like having access to the Put Back option in the trash, or being able to press ⌘+Z to get the files to their original locations (you need to do it once for each file).

×
×
  • Create New...