EDIT: Kompletten Text dieses Posts geändert!
Hallo ^^
Der User "raf_kig" im archlinux.org Forum war so nett ein Python Script zu schreiben, welches die Firefox Bookmarks aus der places.sqlite ausliest und in ein Pipemenü "umwandelt".
#!/usr/bin/env python
import sqlite3
from xml.sax.saxutils import quoteattr
import shutil
import tempfile
browser = 'firefox'
ffsqlite= '/home/user/.mozilla/firefox/profilename/places.sqlite'
def print_label(title,url):
print '<item label=%s>' % (quoteattr(title.encode('utf-8')))
print '<action name="Execute">'
print '<command>%s %s</command>' % (browser,quoteattr(url.encode('utf-8')))
print '</action>'
print '</item>'
def build_tree(conn):
c = conn.cursor()
c.execute('select id,parent,title from moz_bookmarks where type = 2 and parent=2;')
for id,parent,title in c:
rbuild_tree(id,title, conn)
c.execute('select b.title,p.title,p.url from moz_bookmarks b, moz_places p where b.fk = p.id and b.type=1 and parent=2;')
for btitle, ptitle, url in c:
if url == None or url.startswith("place"):
continue
if btitle != None:
print_label(btitle,url)
else:
print_label(btitle,url)
def rbuild_tree(id, title, conn):
print '<menu id="%s" label=%s>' % (id, quoteattr(title.encode('utf-8')))
c2 = conn.cursor()
c2.execute('select id,title,type from moz_bookmarks b where parent=? and type=2;',(id,))
for sid,stitle,type in c2:
rbuild_tree(sid,stitle,conn)
c2.execute('select b.title,p.title,p.url from moz_bookmarks b, moz_places p where b.fk = p.id and b.type=1 and parent=?;',(id,))
for btitle, ptitle, url in c2:
if url == None or url.startswith("place"):
continue
if btitle != None:
print_label(btitle,url)
else:
print_label(btitle,url)
print "</menu>"
def main():
tf = tempfile.NamedTemporaryFile('r', suffix='.sqlite')
shutil.copyfile(ffsqlite, tf.name)
conn = sqlite3.connect(tf.name)
print '<openbox_pipe_menu>'
build_tree(conn)
print '</openbox_pipe_menu>'
conn.close()
tf.close()
if __name__ == '__main__':
main()
raf_kig schrieb
Save it as somefile.py, change ffsqlite to match your username and profile, set it executable and use it as command in your pipe menu.
Funktioniert prima!
Hier noch der Link zum Original-Beitrag:
http://bbs.archlinux.org/viewtopic.php?pid=595270#p595270
MfG Christian