Re: Beagle plugins in scripting languages



Hi
Just for fun, I created a beagle filter using Boo (a python like
scripting language generating .Net assembly). I was initially using
IronPython but the recent versions of IronPython uses .Net framework
2.0 using generics; so IronPython wont build with current mono.

Note that, you need beagle installed on your machine for this to work
(duh!). Use the correct path to beagle dlls while compiling (on my
machine its /usr/lib/beagle)

The code is pretty small, so I am pasting below. Note, the filter does
absolutely nothing useful - I couldnt figure out what to do! (Its a
python like syntax, so beware of all the tabs and whitespaces if you
are copy-pasting)

------------------ >8 ----------------------------------
# compile using
# LANG=C mono booc.exe -t:library
-r:/usr/lib/beagle/BeagleDaemonPlugins.dll
-r:/usr/lib/beagle/Beagle.dll -out:FilterRPM.dll FilterRPM.boo
# copy FilterRPM.dll to /usr/lib/beagle/Filters/
# enjoy the "extracted text" from rpm files

namespace Beagle.Filters

import System
import System.IO
import Beagle.Daemon

class FilterRPM(Beagle.Daemon.Filter):
        private filename as string
        def constructor():
                Console.WriteLine ("Constructing...")
                AddSupportedFlavor (FilterFlavor.NewFromMimeType      
               ("application/x-rpm"))

        override def DoOpen(info as FileInfo):
                Console.WriteLine ("DoOpen")
                filename = info.Name

        override def DoPull():
                Console.WriteLine ("DoPull")
                AppendText ("Nothing found")
                Finished ()

        override def DoPullProperties():
                Console.WriteLine ("DoPull")
                AddProperty (Beagle.Property.NewKeyword ("fixme:name",
filename))
                                                                   
24,1-8        Bot
------------------ >8 ----------------------------------

[1] Boo: http://boo.codehaus.org/Home

On 11/21/05, Jon Trowbridge <trow novell com> wrote:
> On Thu, 2005-11-17 at 13:39 +0100, Leen Toelen wrote:
> > If Beagle can handle scripted plugins it needs some more marketing.
>
> In theory, it should be possible to do a backend in any .NET language...
> we've just never tried it.  I'm sure that there would be some technical
> kinks that would have to be overcome, but it would be very cool if it
> worked.
>
> If anyone has time to play around with this, please let us know how it
> turns out.  A good way to start would be to try to write a very simple
> backend that just returns one canned hit for every query.  Once that
> works, the rest should be easy.
>
> -J
>
> _______________________________________________
> Dashboard-hackers mailing list
> Dashboard-hackers gnome org
> http://mail.gnome.org/mailman/listinfo/dashboard-hackers
>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]