Need a bit of help for Kodi service to share bookmarks among many Kodi devices


Aug 31, 2017

I'm trying to write a Kodi service that will scan all the bookmarks.db from a kodi device and store all their contents into a common structure, the goal is to make a super bookmarks.db and store it on a shared local drive

So all my kodi device will have access to it.

Eventually it mean that any of my kodi device can resume a movie or a tv show where left viewing
My local share drive can be mapped through Samba like : smb://

So far here my code.. I have issue with the opening SQL section and processing the SQL

Note the trick to use a Mysql does not work at my end with Kodi Leia

Thanks for your suggestion

Here is my latest code:

import time
import xbmc
import shutil
import os
import glob
import sys
import urllib
import xbmcaddon
import xbmcgui
import xbmcplugin
import xbmcvfs

#addonInfo = xbmcaddon.Addon().getAddonInfo
#dataPath = xbmc.translatePath(addonInfo('profile')).decode('utf-8')
#bookmarksFile = os.path.join(dataPath, 'bookmarks.db')

from sqlite3 import dbapi2 as database
from pysqlite2 import dbapi2 as database
if __name__ == '__main__':
monitor = xbmc.Monitor()
dataPath= xbmc.translatePath('special://userdata/')

while not monitor.abortRequested():
# Sleep/wait for abort for 10 seconds
if monitor.waitForAbort(120):
# Abort was requested while waiting. We should exit


for root, dirs, files in os.walk(dataPath):
for file in files:
if file == "bookmarks.db":
#bookmarksFile = os.path.join(userdata_folder, 'bookmarks.db')
xbmc.log("hello addon! %s %s" % (time.time() ,os.path.join(root, file)), level=xbmc.LOGNOTICE)

# addonInfo = xbmcaddon.Addon().getAddonInfo
#dataPath = xbmc.translatePath(addonInfo('profile')).decode('utf-8')
#bookmarksFile = os.path.join(dataPath, 'bookmarks.db')

bookmarkFile = os.path.join(root, file).decode('utf-8')
bookmarkFile = bookmarkFile.replace('/Users/someuser/Library/Application Support/Kodi/userdata/', '')
bookmarkFile = os.path.join(dataPath, bookmarkFile)
#/Users/regismaltais65/Library/Application Support/Kodi/userdata/addon_data/

#os.chdir(os.path.join(root, file))
dbcon = database.connect(bookmarkFile)
dbcur = dbcon.cursor()

dbcur.execute('SELECT * FROM bookmark')

results = dbcur.fetchall()

for row in results:
xbmc.log("******** hello addon SQL ! %s %s" % (row[0] ,row[1]), level=xbmc.LOGNOTICE)

# pass
  • Like
Reactions: capslock
Thread starter Similar threads Forum Replies Date
D Random Topics 1
D Addon Development 2