Jump to content

buffaloseven

Member
  • Posts

    18
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by buffaloseven

  1. On 12/29/2019 at 6:56 AM, vitor said:

     

    That’s unnecessary and leads to more code. We can make it less code by getting rid of Dir.exist?. I’ve done so in the just released update.


    Thinking about it today, the bugs were introduced when I changed the code to allow for multiple installations of the same player. That’s an uncommon situation, but it can happen.

     

    Haha, sounds good to me. I'm not a coder by trade or anything like that, so I tend to just find band-aids. I'm glad you were able to make a better solution than what I did 🙂

  2. Thanks for the quick response. I updated to the latest version and now get this error:

    [21:53:34.208] ERROR: WatchList[Run Script] /Users/Brad/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.8A7FDDB5-5037-4878-A927-CB706D0B9751/watchlist_functions.rb:386:in `exist?': no implicit conversion of nil into String (TypeError)
    	from /Users/Brad/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.8A7FDDB5-5037-4878-A927-CB706D0B9751/watchlist_functions.rb:386:in `block in play_item'
    	from /Users/Brad/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.8A7FDDB5-5037-4878-A927-CB706D0B9751/watchlist_functions.rb:395:in `play_item'
    	from /Users/Brad/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.8A7FDDB5-5037-4878-A927-CB706D0B9751/watchlist_functions.rb:300:in `play'
    	from /Users/Brad/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/44CE6029-3DF0-438B-AC11-5478A7281816:3:in `<main>'
    

    EDIT: I was able to solve the problem by coercing the Nil value returned by the mdfind capture to a string, which then played nicely with the Dir.exist? call. My code looks like this:

      # The 'split' together with 'last' serves to try to pick the last installed version, in case more than one is found (multiple versions in Homebrew Cellar, for example)
      video_player = lambda {
        mpv = Open3.capture2('mdfind', 'kMDItemCFBundleIdentifier', '=', 'io.mpv').first.strip.split("\n").last.to_s
        return [mpv + '/Contents/MacOS/mpv', '--quiet'] if Dir.exist?(mpv)
    
        iina = Open3.capture2('mdfind', 'kMDItemCFBundleIdentifier', '=', 'com.colliderli.iina').first.strip.split("\n").last.to_s
        return iina + '/Contents/MacOS/IINA' if Dir.exist?(iina)
    
        vlc = Open3.capture2('mdfind', 'kMDItemCFBundleIdentifier', '=', 'org.videolan.vlc').first.strip.split("\n").last.to_s
        return vlc + '/Contents/MacOS/VLC' if Dir.exist?(vlc)
    
        return 'other'
      }.call

     

  3. I decided to hop on the bandwagon and give this a try today and it's spitting back the following error when I try to play an item:

    [00:33:41.490] ERROR: WatchList[Run Script] /Users/Brad/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.8A7FDDB5-5037-4878-A927-CB706D0B9751/watchlist_functions.rb:385:in `block in play_item': undefined method `+' for nil:NilClass (NoMethodError)
    	from /Users/Brad/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.8A7FDDB5-5037-4878-A927-CB706D0B9751/watchlist_functions.rb:395:in `play_item'
    	from /Users/Brad/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.8A7FDDB5-5037-4878-A927-CB706D0B9751/watchlist_functions.rb:300:in `play'
    	from /Users/Brad/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/D157EE3F-E0E6-4693-9A97-53231258EB81:3:in `<main>'
    

    Running on macOS 10.15.2 and Alfred 4.0.7. Am I missing some sort of Ruby dependency?

  4. Thanks for the quick reply. Everything is set up properly and xattr is present and functions from /usr/bin/xattr. I decided to enter into the the workflow directory and run it in the terminal instead of through Alfred, and got the following output:

     

    ┌─ Brad Alfred.alfredpreferences/workflows/user.workflow.4DC46062-706A-4E1E-975E-EECCD63ECD3E took 10s 
    ┕> ./downvid "https://www.youtube.com/watch?v=A6XFbNBT-h8" video watchlist_false playlist_false
    ERROR: unable to open for writing: [Errno 30] Read-only file system: '/My Top 10 Favorite Games of 2019.m4a.part'
    ./downvid: /usr/local/bin/xattr: /usr/local/opt/python/bin/python2.7: bad interpreter: No such file or directory

    I'm not sure if that writing error is important (is it just something I'm missing by not triggering through Alfred?), but I noticed for some reason it's looking for /usr/local/bin instead of /usr/bin?

  5. I did a bunch of testing tonight and was able to figure out where the problem is occurring. After updating everything and setting everything up fresh, I was still having the problem. I manually commented out parts of the DV bash script until I found the problematic lines:

        # xattr seems to return before the action is complete, not giving enough time for the file to have the attribute before sending to WatchList, so only continue after the attribute is present
        until mdls -raw -name kMDItemWhereFroms "${filename}" | grep --quiet --invert-match '(null)'; do
            sleep 1
        done

    If I comment out this line, all works as expected. Any ideas on how I could troubleshoot this further? I'm guessing that the until never resolves, so it's just sleeping until I manually kill it.

     

    Relatedly, you can fix the problem with missing letters in the dvp Alfred script filter by changing

    	progress = filecontents[-1].delete('[download]').strip
    to
    	progress = filecontents[-1].sub('[download]', '').strip

     

  6. Never doubt the simple solutions:

    ┌─ Brad Workflow Data/com.vitorgalvao.alfred._sharedresources/bin 
    ┕> ./Notificator.app/Contents/Resources/Scripts/notificator --message 'testing'
    zsh: no such file or directory: ./Notificator.app/Contents/Resources/Scripts/notificator

    Also, I noticed that there is a copy of youtube-dl, but it's not located in the bin folder, it's in the parent folder.

  7. I'm running: 

     

    - macOS 10.15.1 (19B88)

    - ffmpeg version 4.2.1

    ┌─ Brad ~/Downloads 
    ┕> ffmpeg -version
    ffmpeg version 4.2.1 Copyright (c) 2000-2019 the FFmpeg developers
    built with Apple clang version 11.0.0 (clang-1100.0.33.8)
    configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.1_2 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk/Contents/Home/include/darwin -fno-stack-check' --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
    libavutil      56. 31.100 / 56. 31.100
    libavcodec     58. 54.100 / 58. 54.100
    libavformat    58. 29.100 / 58. 29.100
    libavdevice    58.  8.100 / 58.  8.100
    libavfilter     7. 57.100 /  7. 57.100
    libavresample   4.  0.  0 /  4.  0.  0
    libswscale      5.  5.100 /  5.  5.100
    libswresample   3.  5.100 /  3.  5.100
    libpostproc    55.  5.100 / 55.  5.100

    - Alfred 4.0.6

    - Downvid 1.22.12

     

    Querying ffmpeg in your workflow's resource folder doesn't work, as I assume it doesn't fetch it if the system has it installed already?

  8. Hmmm. Here's another example. It never notifies me that the file is complete (no downloaded notification is triggered) and just hangs like this forever unless I use the abort (Ctrl key shortcut) to cancel it or manually kill the bash process.

     

    Worth noting, that for the example shown in the screenshot, the file was in fact muxed and available in my Downloads folder...so is something just hanging and preventing it from finishing out the process?

    Screen Shot 2019-12-03 at 9.58.24 PM.jpg

  9. I've been having problems with this workflow lately and haven't been able to figure it out, so I thought I'd share it back here. So far, I've had no issues getting the workflow to initiate downloads. It correctly downloads the video and audio files. After muxing, though, it throws the following error (for example, from the video located https://www.youtube.com/watch?v=W3NWOShvLug) when inspecting the progress using dvp:

     

    [14:24:00.383] DownVid[Script Filter] {"rerun":1,"items":[{"title":"DownVid Progress","subtitle":"ffmpeg There re't y subtites t embe / Exploring The Path to Carcosa Expansion w_ Matt Newman.f137.mp4","valid":false,"mods":{"ctrl":{"valid":true},"cmd":{"valid":true}}}]}

    Furthermore, it appears that the background bash process then hangs. The muxed file is located in my downloads folder and can be watched with no issues. If I delete the video file, DownVid finally throws the notification that it's completed downloading and the hung bash processes quit.

     

    Because I've seen it requested elsewhere, from my Terminal:

    ┌─ Brad ~/Downloads 
    ┕> which sed
    /usr/bin/sed
    
    ┌─ Brad ~/Downloads 
    ┕> which youtube-dl
    /usr/local/bin/youtube-dl
    
    ┌─ Brad ~/Downloads 
    ┕> youtube-dl --version
    2019.11.28
    

    Any thoughts on how I can fix this? Here's the output when I run it through youtube-dl using my standard settings:

    ┌─ Brad ~/Downloads 
    ┕> youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4' --all-subs --convert-subs srt --write-thumbnail https://www.youtube.com/watch\?v\=W3NWOShvLug     
    [youtube] W3NWOShvLug: Downloading webpage
    [youtube] W3NWOShvLug: Downloading video info webpage
    WARNING: video doesn't have subtitles
    [youtube] W3NWOShvLug: Downloading thumbnail ...
    [youtube] W3NWOShvLug: Writing thumbnail to: Exploring The Path to Carcosa Expansion w_ Matt Newman-W3NWOShvLug.jpg
    [download] Destination: Exploring The Path to Carcosa Expansion w_ Matt Newman-W3NWOShvLug.f137.mp4
    [download] 100% of 205.21MiB in 00:13
    [download] Destination: Exploring The Path to Carcosa Expansion w_ Matt Newman-W3NWOShvLug.f140.m4a
    [download] 100% of 13.21MiB in 00:02
    [ffmpeg] Merging formats into "Exploring The Path to Carcosa Expansion w_ Matt Newman-W3NWOShvLug.mp4"
    Deleting original file Exploring The Path to Carcosa Expansion w_ Matt Newman-W3NWOShvLug.f137.mp4 (pass -k to keep)
    Deleting original file Exploring The Path to Carcosa Expansion w_ Matt Newman-W3NWOShvLug.f140.m4a (pass -k to keep)
    [ffmpeg] There aren't any subtitles to convert

     

  10. That’s a nice stopgap solution, but I think I’d still like to see it embedded as an option right in the list filter action. Alfred obviously has fuzzy matching capabilities that are highly performant, hopefully it wouldn’t be too difficult to extend it into List Filters. 
     

    Thanks for pointing this workflow out, though; I’ll probably use it for a couple lists until there’s some sort of resolution to this request. 

  11. A workflow to quickly toggle macOS font smoothing on and off.

     

    When Marco Arment pointed out the problem/suggestions regarding macOS font smoothing on Twitter, it made me realize that text really does look better on a retina display with font smoothing turned off. Often I work with an external monitor, however, using a workspace that mixes a retina display with a non-retina display. macOS cannot set font smoothing on a per-display basis, so I created this quick workflow to be able to toggle the feature on and off easily.

     

    To use, simply type smooth in Alfred and you'll be presented with the option to enable or disable font smoothing.  If you utilize the hotkey (by default ⌃⌘F), Alfred will toggle the state to the opposite of the current setting.

     

    You'll find the workflow over on Packal: http://www.packal.org/workflow/toggle-font-smoothing

    Screen Shot 2017-10-21 at 3.25.17 PM.png

    Screen Shot 2017-10-21 at 3.25.24 PM.png

  12. Thx but i want to use it as a snippets at alfred 3

     

     

    I don't think you can do calculations within a snippet, but you could use that workflow to calculate the date you want, and then create a snippet where the date is filled in using the {clipboard} placeholder. So your workflow could be...

     

    Use workflow above to trigger Alfred and calculate your date. Press enter to copy to clipboard. Then just type your shortcut and have it fill in the snippet with the date from the clipboard. This would be a better solution if you wanted the date embedded within a larger string.

     

    If you want to just paste in a date, you could use the date calculation workflow, set the format to the format you want to use, and then modify the workflow so that when the date is copied to the clipboard it's automatically pasted into the focused application. This would allow you to quickly insert the value into your documents.

     

    EDIT: If you're interested, I've made a modification to the Date Calculation workflow that will paste the result to the front-most application when you press enter on the result while holding the command key down. I can put it up for you to download if you'd like.

×
×
  • Create New...