Hi John,

I can't get your suggestion to work with mdfind:

> Why go through the indirection of a shell script and a query results
rather than just preparing
> a sequence of args and then grabbing all the results, e.g.
> { mdfind "kMDItemAuthor == '*MyFavoriteAuthor*'" } utf8 [ lines ]
with-process-reader

- Trying this command format (with a different MD Attribute) works fine in
the terminal:

➜  ~ git:(master) ✗ mdfind "kMDItemComposer == 'Dylan'"
/Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/11 Wedding
Song.m4a
/Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/10 Never Say
Goodbye.m4a
/Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/09 You Angel
You.m4a
/Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/08 Dirge.m4a
...
➜  ~ git:(master) ✗

- But trying the same command in the with-process-reader format fails in
the listener:

IN: scratchpad { mdfind "kMDItemComposer == 'Dylan'" } utf8 [ lines ]
with-process-reader

Process exited with error code 254

Launch descriptor:

T{ process
    { command { mdfind "kMDItemComposer == 'Dylan'" } }
    { environment H{ } }
    { environment-mode +append-environment+ }
    { stdout T{ fd { disposed t } { fd 23 } } }
    { group +same-group+ }
    { status 254 }
    { pipe
        T{ pipe
            { in T{ fd { disposed t } { fd 19 } } }
            { out T{ fd { disposed t } { fd 23 } } }
        }
    }
}
---------------
-Switching single & double quotes around doesn't help:
IN: scratchpad { mdfind 'kMDItemComposer == "Dylan"' } utf8 [ lines ]
with-process-reader

Error
No word named “'kMDItemComposer” found in current vocabulary search path
(however, mdfind 'kMDItemComposer == "Dylan"' works in terminal)

---------------
-Ok, so trying various permutations of single, double, triple quotes in the
command:
IN: scratchpad { """mdfind "kMDItemComposer == 'Dylan'"""" } utf8 [ lines ]
with-process-reader

Process exited with error code 255
(however, mdfind "kMDItemComposer == 'Dylan'" works in terminal)

---------------
IN: scratchpad { """mdfind 'kMDItemComposer == "Dylan"'""" } utf8 [ lines ]
with-process-reader

Process exited with error code 255
(however, mdfind 'kMDItemComposer == "Dylan"' works in terminal)

---------------
IN: scratchpad { "mdfind" """'kMDItemComposer == "Dylan"'""" } utf8 [ lines
] with-process-reader

Process exited with error code 1
(again, mdfind 'kMDItemComposer == "Dylan"' works in terminal)

---------------
-Using the code from the spotlight.factor vocab works like the terminal
example above:
IN: scratchpad "Dylan" by-Composer mdfind .

{
    "/Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/11
Wedding Song.m4a"
    "/Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/10
Never Say Goodbye.m4a"
    "/Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/09 You
Angel You.m4a"
    "/Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/08
Dirge.m4a"
    "/Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/07
Forever Young (Continued).m4a"
    "/Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/06
Forever Young.m4a"
    ...
}

I'm probably missing something simple, but I haven't found a way to get
mdfind to work in
a process command, and reading the output stream-lines.
Hence, my relief at getting "a shell script and a query results" approach
to work without blowing up.

I agree, it would be much more elegant to craft a solution in the form of
your suggestion.
If anyone can cook one up, that would really be sweet! I just want to
access the Spotlight
MetaData Index from Factor in the simplest possible way. Meanwhile, I'll
exercise spotlight;
baroque as it is, it gets me to the MetaData, and does find things.

Thanks,
Charles



On Fri, Nov 8, 2013 at 8:37 AM, John Benediktsson <mrj...@gmail.com> wrote:

> Hi,
>
> Why go through the indirection of a shell script and a query results
> rather than just preparing a sequence of args and then grabbing all the
> results, e.g.
>
> { mdfind "kMDItemAuthor == '*MyFavoriteAuthor*'" } utf8 [ lines ]
> with-process-reader
>
>
>
>
>
> On Fri, Nov 8, 2013 at 1:55 AM, CW Alston <cwalsto...@gmail.com> wrote:
>
>> (Oops- forgot to sign in)
>> Thanks for the heads-up, Björn - try this link, folks.
>>  ~cw
>>
>>
>> On Fri, Nov 8, 2013 at 1:14 AM, CW Alston <cwalsto...@gmail.com> wrote:
>>
>>> Thanks for the heads-up, Björn - try this 
>>> link<https://gist.github.com/anonymous/7368381>
>>> .
>>>
>>> ~cw
>>>
>>>
>>> On Fri, Nov 8, 2013 at 12:49 AM, Björn Lindqvist <bjou...@gmail.com>wrote:
>>>
>>>> 2013/11/8 CW Alston <cwalsto...@gmail.com>:
>>>> > Greetings, Factorials -
>>>> >
>>>> > I've posted a vocab to the pastebin, a Factor interface to OS X
>>>> Spotlight.
>>>> > Pardon the length; this should be split into at least 2 code files &
>>>> > a docs file. Just seems best to show everything together for the post.
>>>>
>>>> Check your link, it doesn't go anywhere. :) Perhaps try
>>>> https://gist.github.com/ for long-lived pastes because they dont
>>>> delete them after a few days.
>>>>
>>>>
>>>> --
>>>> mvh/best regards Björn Lindqvist
>>>>
>>>
>>>
>>>
>>> --
>>> *~ Memento Amori*
>>>
>>
>>
>>
>> --
>> *~ Memento Amori*
>>
>>
>> ------------------------------------------------------------------------------
>> November Webinars for C, C++, Fortran Developers
>> Accelerate application performance with scalable programming models.
>> Explore
>> techniques for threading, error checking, porting, and tuning. Get the
>> most
>> from the latest Intel processors and coprocessors. See abstracts and
>> register
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Factor-talk mailing list
>> Factor-talk@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/factor-talk
>>
>>
>


-- 
*~ Memento Amori*
------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to