Jump to content

JAAE

Member
  • Posts

    8
  • Joined

  • Last visited

Posts posted by JAAE

  1. Hello,

     

    I have several script filter workflows that are in essence collections of bookmarks on some topic. E.g. keyword 'ebike' produces a list of URLs for webpages on ebikes.

     

    Some of the script filters are scripted in ruby, and these produce a list in sorted order: the last or most used URLs are listed first. This is the behaviour that I want. Other workflows are scripted in python, and these I cannot get to sort the way I like.

     

    Here is an example in ruby:

    require 'json'
    
    arg = ARGV.to_s
    
    if !arg.include? " "
    arg = ARGV[0]
    query = arg.to_s
    
    else
    arg = ARGV.join(" ")
    query = arg.to_s
    end
    
    URL0 = "http://la-conjugaison.nouvelobs.com/rechercher/index.php?mot=" + query + "&moteur=conjugaison"
    URL1 = "http://la-conjugaison.nouvelobs.com/rechercher/index.php?mot=" + query + "&moteur=synonyme"
    URL2 = "http://la-conjugaison.nouvelobs.com/rechercher/index.php?mot=" + query + "&moteur=definition"
    
    script_filter_items = []
    
    script_filter_items.push(uid: 'JAAE-CONJ-00000', title: 'Conjugaison', arg: URL0)
    script_filter_items.push(uid: 'JAAE-CONJ-00001', title: 'Synonyme', arg: URL1)
    script_filter_items.push(uid: 'JAAE-CONJ-00002', title: 'Definition', arg: URL2)
    
    puts({ items: script_filter_items }.to_json)

     

    And here an example in python:

    import json
    import sys
    
    URLs = {
    "eBikes on Reddit": ["https://www.reddit.com/r/ebikes/","JAAE-ebikes-0000001"],
    "Modern Bike": ["https://www.modernbike.com/","JAAE-ebikes-0000002"],
    "Pedelec Forum": ["https://www.pedelecforum.de/forum/index.php?forums/bosch.30/","JAAE-ebikes-0000003"],
    "Youtube 'The Yorkshire Bike Mechanic'": ["https://www.youtube.com/c/TheYorkshireBikeMechanic/videos","JAAE-ebikes-0000004"]
    }
    alfred_results = []
    for key in URLs.keys():
     	result = {
     			"title": key,
     			"subtitle": "",
     			"arg": URLs[key][0],
     			"UID": URLs[key][1]
     	}
     	alfred_results.append(result)
    response = json.dumps({
     	"items": alfred_results
    })
    sys.stdout.write(response)

     

    What am I doing wrong or overlooking?

     

    Any help would be greatly appreciated.

     

    Regards

  2. Hello,

     

    I have this workflow that outputs {query} Mb to a large type utility. The result would be something as short as "52 Mb", yet it is always split over two lines in the output. Is there a way to force large type to just one line?

     

    Thanks for any help.

    Screen Shot 16 Oct 2019 at 13.06:17.png

  3. Doesn't seem to work for me. I get following debug information:

    Starting debug for 'RSync Folders'

     

    [2018-04-11 11:19:22][ERROR: action.script] 0:49: execution error: sh: -c: line 0: unexpected EOF while looking for matching `''

    sh: -c: line 1: syntax error: unexpected end of file (2)

  4. Hello Vitor

     

    I downloaded and installed your workflow, and I agree it's awesome. I managed to tinker with it to change the default download location, and to prevent downloading videos larger than 720p Height. All of these Alfred workflows are great for learning about scripting and the inner workings of OS X.

     

    I have a question though. I 'm not using watchlist, and so I was wondering were the download queue is saved when you select multiple video's to download.

     

    Thanks

×
×
  • Create New...