Jump to content

xilopaint

Member
  • Posts

    896
  • Joined

  • Last visited

  • Days Won

    24

Posts posted by xilopaint

  1. 5 hours ago, deanishe said:

     

    Not that I know of.

     

    The model names are contained in /System/Library/PrivateFrameworks/ServerInformation.framework/Versions/A/Resources/English.lproj/SIMachineAttributes.plist, and I found some code that the author says can convert a model name into its icon, so perhaps you could read the model names from the plist and feed them to that code to get the right icons?

     

    Hey, don't you think the one-line code mentioned in the SO question you linked is more suitable to my needs?

     

    EDIT: btw, is this line Swift or Objective-C?

  2. 9 minutes ago, deanishe said:

     

    Not that I know of.

     

    The model names are contained in /System/Library/PrivateFrameworks/ServerInformation.framework/Versions/A/Resources/English.lproj/SIMachineAttributes.plist, and I found some code that the author says can convert a model name into its icon, so perhaps you could read the model names from the plist and feed them to that code to get the right icons?

     

    Oh, that looks good! I just don't know anything of Swift or Objective-C (I'm not even sure which of the two languages that code snippet refers to). If anyone can submit a PR I will be grateful. Otherwise I will have to learn how to implement this.

  3. Soulver 3 has been released with automation features including a command-line interface and an Alfred Workflow. The workflow uses the Soulver CLI, which is located inside Soulver’s bundle and symlinked to /usr/local/bin/.

     

    I would love to see an integration with Alfred and use Soulver syntax instead of Alfred standard calculator. Soulver has a friendly syntax which includes:

     

    1) Percentages:

     

    120 + 10%                             | 132
    500k - 30%                            | 350k

    10% of 200                            | 20
    20 is what % of 200             | 10%
    20 is 10% of what                | 200

     

    2) Proportions:

     

    6 is to 60 as 8 is to what                     | 80
    5 is to 10 as what is to 80                   | 40

     

    3) Phrase functions:

     

    larger of 100 and 200                             | 200
    greater of 100 and 200                           | 200

    smaller of 5 and 10                                 | 5
    lesser of 5 and 10                                   | 5

    remainder of 21 divided by 5                | 1 
    21 mod 5                                                  | 1

     

    3) Currency conversions (including crypto!):

     

    10 USD in EUR                    | 8.88 EUR
    20 GBP in AUD                   | 36.29 AUD

    20 BTC in USD                    | 156,250.00 USD
    1,000 EUR in ETH               | 4.47 ETH

     

    4) Units conversions

     

    10 km in m                                            | 10,000 m
    5 hours 30 minutes to seconds        | 19,800 seconds
    100 pounds in kg                                 | 45.36 kg

     

    5)  Date Calculation

     

    10 June + 3 weeks                                             | 1 July
    April 1, 2019 − 3 months 5 days                      | 25 December 2018
    Yesterday + 1 week                                           | 11 June
    Today − 1 month                                               | 5 May
    3:35 am + 7 hours 15 minutes                        | 10:50 am
    12/02/1988 + 32 years                                    | 12 February 2020
    01.05.2005 + 3 years 2 months 3 weeks      | 22 July 2008

     

    I love 1Password integration and honestly think Soulver would make a great integration with Alfred as well.

     

    Here's Soulver documentation.

  4. On 1/12/2018 at 5:33 PM, deanishe said:

    A rather minor thing, but would you consider storing the generated txt files in the workflow's data or cache directory, not in the workflow directory?

     

    The issue is that files in the workflow directory get synced between machines, so when I use the workflow to quickly check which video card my Mac has or what the numerical version of the OS is (I can never ever seem to remember which is 10.10, 10.11, 10.12 etc.), the cache files often contain the data from the wrong Mac, so it takes a lot longer than need be to load.

     

     

    Your issue is fixed in the new workflow. See my last post.

     

    Btw, would you help me to find a way to generate mymac.png programatically without the need of using the HardwareIcons.xml file? All Mac icons are located in

    /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/ but I didn't find a way to correlate one of them to the user machine.


    There are 3 icons for the MacBook Air in this folder as an example:

     

    com.apple.macbookair.icns

    com.apple.macbookair-11-unibody.icns
    com.apple.macbookair-13-unibody.icns.

     

    Is there any .plist file determining which one should be displayed in About This Mac.app?

     

    I don't know if @RodgerWW is still active on the Forum. Maybe he can contribute for this discussion.

  5. I've just released a new About This Mac workflow on GitHub based on Rodger's work.


    The new workflow should be more fast and reliable since I've fixed some bugs and rewritten the code to not write any more .txt files.


    The  xabout keyword was suppressed since the data is generated in each run so no need to reset the workflow.

  6. 5 hours ago, deanishe said:

    I have one workflow per repo so I can use GitHub releases for updates.

     

    Fundamentally, I have a subdirectory with the actual workflow contents (that I can symlink or copy to Alfred’s workflow directory).

     

    In the case of scripting languages, this is called “src”,  and I have the README, licence and probably the built workflow in the repo root.

     

    In the case of compiled languages (Go in my case), the “build” subdirectory is what gets linked to Alfred’s workflow directory. The top-level contains code and build scripts (as is normal with Go).

     

    I adopted your folder structure. Btw, I also created a workflow for your script to symlink/install workflows. It's awesome.

  7. 12 minutes ago, godbout said:

    Is that too much for you to add?  🙄😂

     

    I will not add it by default. It'll be like a 'pro user' thing. If there's no `cli`, then it will open the magnet link with the default mac app. If there's a `cli` variable, then it will use the cli. Knowing myself, if I add it, I'll forget to remove it. Now that you added it, it will stay there on subsequent updates.

     

     

     

    Please, make it at your own discretion. I really appreciate your effort in supporting CLIs. I just didn't understand why you didn't leave the environment variable with a blank value.

  8. 1 hour ago, godbout said:

    @xilopaint can you try this version? https://www.dropbox.com/s/bdtphtve5vfr1dh/KAT.alfredworkflow?dl=0

     

    Add a `cli` global variable. It should contain the command and a `{magnet}` variable that will be replaced by the magnet link chosen through Alfred. There' also a possibility to copy the magnet with the cmd modifier. (It's version 3.0.0 because I've updated some of the workflow's objects and I should work only with Alfred 4 from now on.)

      

    Let me know if it works well. If it does I will release an official update.

     

    It works! Thanks!

     

    Why didn't you add the cli variable on the configuration sheet?

  9. 1 hour ago, godbout said:

    What about if when using `cmd` it copies the magnet to the clipboard rather than opening the magnet? You should be able to do something with that. That sounds more proper to me, for the workflow.

     

    That can be useful in some cases but I want the torrent added to transmission via CLI. It's not a big deal if you think this feature doesn't suit your workflow as I will add it anyway.

     

    In any case I agree with @deanishe that your workflow would be much more versatile if it does output the magnet link instead of handling it internally in code.

  10. 4 hours ago, godbout said:

    I think @deanishe makes very good points. To be honest I had never thought of the torrent command line clients. What's the advantage? Why do you guys use that rather than a GUI client?

     

    The main and obvious advantage of the CLI is the same of Alfred: you can do tasks without a GUI. Just add your torrent and forget about it. It will be downloaded in your ~/Downloads folder. No GUI, no distractions.

     

    "Oh, but I want to check the download progress sometimes and I don't want to type a command in Terminal for this". Not a problem, just type 127.0.0.1:9091 in your browser's address bar. You will have a functional web Transmission GUI. Or better than that, just create a bookmark for this URL and use Alfred to open it. You just don't need a separate GUI app.

     

    With your workflow + transmission-cli I can have my downloads delivered at the proper folder in the most alfredish way, which means no browser, no Terminal, no third-party GUI apps, just the Alfred panel.

     

    4 hours ago, godbout said:

    I coud still add something more like for power users. Like if there's a global variable `cli`, use that instead of open. Quick to do. If it does make sense and help, I'll add it.

     

    Sounds a good implementation to me.

  11. 9 minutes ago, deanishe said:

     

    Looks that way. My post that you quoted looks weird, too.

     

    I've found the bug. If the quote on that post is expanded the quote button/link is not clickable.

  12. 2 minutes ago, deanishe said:

    I mean, you didn't even consider how to support command-line clients in general (e.g. "provide an optional workflow variable to specify a shell command to open the magnet:// URL"). You just asked him to hard-code your favourite one.

     

    I don't even know if other CLI clients exist.

  13. @godbout a key modifier seems fine to me. You can use a dynamic subtext to show a warning like (e.g. "You don't have transmission command-line utilities installed") if the action is not applicable to that user.

     

    EDIT: Weirdly I can't quote your last post. A forum bug?

  14. 12 minutes ago, deanishe said:

    IMO, a workflow author should implement opening in the default app via a discrete workflow element, not buried in code, so it’s easy for users to change, but the rest is on the user.

     

    I mean, in most cases, the reason ultimately boils down to “I have a problem with my own defaults”. That generally doesn’t seem like it should be made the workflow author’s problem.

     

    The problem here is the user has to make the changes for every release if the workflow author doesn't implement them.

  15. 26 minutes ago, deanishe said:

    Oh, right. I was talking about a separate app to handle magnet links system-wide, not editing the workflow.

     

    Have you looked at the source code? There must be a /usr/bin/open command in there somewhere that you can swap for /usr/local/bin/transmission-cli.

     

    Thanks! I achieved to do it by changing this:

    public static function download($magnetLink = '')
        {
            $crawler = (new Client())->request('GET', getenv('url') . $magnetLink);
            $magnetLink = $crawler->filter('#tab-technical a.siteButton.giantButton')->attr('href');
            return exec("open $magnetLink 2>&1", $result);
            
        }

     

    to this:

    public static function download($magnetLink = '')
        {
            $crawler = (new Client())->request('GET', getenv('url') . $magnetLink);
            $magnetLink = $crawler->filter('#tab-technical a.siteButton.giantButton')->attr('href');
            return exec("/usr/local/bin/transmission-remote -a \"$magnetLink\" 2>&1", $result);
        }

     

    Still I think this integration would be a nice improvement to the workflow.

  16. On 6/4/2019 at 6:19 AM, Acidham said:

     

    From just the description, it is a feature not a bug ;) 

     

    In case a Workflow has no Keyword,ScriptFilter or ListFilter you cannot proceed to the next step because there is nothing to choose. 

     

    Otherwise please provide more info. 

     

    Are you sure it's the current behaviour for keywords? I was pretty sure that in my last PR this was changed to not listing blank keywords. It seems to me @bk161124 is running an outdated version of the workflow.

  17. 7 hours ago, deanishe said:

     

    No, but opening magnet:// links in the default app is exactly how the workflow works

     

    I just don't know how to pass the magnet link to the command-line interface if it's not output by the workflow.

  18. 2 hours ago, deanishe said:

     

    You can create a wrapper app with Automator or Platypus containing a script that passes the magnet URL to transmission-cli.


    That's what I do for .sublime-project files (for some reason, the GUI app doesn't open them properly, but the subl CLI command does).

     

    You can also make it work everywhere, not just in Alfred, though I suppose you might not want that behaviour everywhere.

     

    But the Script Filter doesn't output the magnet link.

  19. Would you consider to integrate your workflow with transmission-cli? It can be installed with `brew install transmission` and work headless. That would allow us to start downloading the file from Alfred without the need of any GUI BitTorrent client which is the perfect scenario.

     

    A possible implementation would include a check for the existence of the CLI in the user machine, otherwise the current flow is used. An environment variable on the workflow configuration sheet would make the job as well (the user would set the value to 1 to use the flow with the integration).

×
×
  • Create New...