This forum has been archived. All content is frozen. Please use KDE Discuss instead.

D-bus Nepomuk Tag

Tags: None
(comma "," separated)
kain
Registered Member
Posts
5
Karma
0

D-bus Nepomuk Tag

Fri Jun 26, 2009 10:10 am
Hi.
How can i tag files by command line ?
Thx
User avatar
dpalacio
Registered Member
Posts
240
Karma
2
OS

RE: D-bus Nepomuk Tag

Fri Jun 26, 2009 12:17 pm
I do not know :P but I have done it from ruby scripts with the Nepomuk bindings.


connect(post, SIGNAL(readSignature()), qapp, SLOT(quit()));
kain
Registered Member
Posts
5
Karma
0

RE: D-bus Nepomuk Tag

Fri Jun 26, 2009 12:36 pm
dpalacio wrote:I do not know :P but I have done it from ruby scripts with the Nepomuk bindings.


can you share this script ?
User avatar
dpalacio
Registered Member
Posts
240
Karma
2
OS

RE: D-bus Nepomuk Tag

Fri Jun 26, 2009 5:34 pm
# Basically, require korundum and nepomuk
require 'korundum4'
require 'nepomuk'

tag = Nepomuk::Tag.new( 'vacations' )
# for each file(resource):
resource = Nepomuk::Resource.new( path )
resource.add_tag tag

# See the API for more Resource handling.


connect(post, SIGNAL(readSignature()), qapp, SLOT(quit()));
kain
Registered Member
Posts
5
Karma
0

RE: D-bus Nepomuk Tag

Fri Jun 26, 2009 7:32 pm
i don't know ruby and this code gives me an error:
"Segmentation fault"
User avatar
dpalacio
Registered Member
Posts
240
Karma
2
OS

RE: D-bus Nepomuk Tag

Sat Jun 27, 2009 1:33 am
If you actually would post more helpful output, what exactly did you run and which packages/software you installed to get it working.


connect(post, SIGNAL(readSignature()), qapp, SLOT(quit()));
kain
Registered Member
Posts
5
Karma
0

Re: D-bus Nepomuk Tag

Sun Jun 28, 2009 1:27 pm
Code:
Code: Select all
require 'korundum4'
require 'nepomuk'
tag = Nepomuk::Tag.new( 'test' )
resource = Nepomuk::Resource.new( '/tmp/test' )
resource.add_tag tag

Output:
Code: Select all
ruby -v -d ~/.bin/nepo
ruby 1.8.7 (2009-06-08 patchlevel 173) [i686-linux]
Exception `NameError' at /usr/lib/ruby/site_ruby/1.8/Qt4.rb:2 - uninitialized constant Qt
/home/kain/.bin/nepo:5: [BUG] Segmentation fault
ruby 1.8.7 (2009-06-08 patchlevel 173) [i686-linux]

[1]    17510 abort      ruby -v -d ~/.bin/nepo


Installed:
Code: Select all
kdemod-unstable/kdemod-kdebindings-ruby 4.2.87-1
User avatar
dpalacio
Registered Member
Posts
240
Karma
2
OS

Re: D-bus Nepomuk Tag

Sun Jun 28, 2009 3:47 pm
What's wrong with your Ruby or Qt4.rb file? That NameError should be handled just fine.

Is your Qt4.rb like this:?
Code: Select all
begin
  version = Qt::version
  raise LoadError.new("Qt3 already loaded") unless version =~ /^4/
rescue NameError
  require 'qtruby4'
end
kain
Registered Member
Posts
5
Karma
0

Re: D-bus Nepomuk Tag

Sun Jun 28, 2009 4:09 pm
cat /usr/lib/ruby/site_ruby/1.8/Qt4.rb
Code: Select all
begin
  version = Qt::version
  raise LoadError.new("Qt3 already loaded") unless version =~ /^4/
rescue NameError
  require 'qtruby4'
end
User avatar
dpalacio
Registered Member
Posts
240
Karma
2
OS

Re: D-bus Nepomuk Tag

Sun Jun 28, 2009 4:47 pm
Workaround: Make your Qt4.rb file like this
Code: Select all
require 'qtruby4'


I can not do more. It seems your Ruby has a bug. Please report it to your distro, including this thread information or link.


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], rblackwell