Need a bit of help for Kodi service to share bookmarks among many Kodi devices
#1
Hi,

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://192.168.1.1/kodi

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

Thanks for your suggestion 

python:
import time
import xbmc
import shutil
import os
import glob

try:
from sqlite3 import dbapi2 as database
except:
from pysqlite2 import dbapi2 as database


if __name__ == '__main__':
monitor = xbmc.Monitor()
userdata_folder = 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
break

os.chdir(userdata_folder)

for root, dirs, files in os.walk(userdata_folder):
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)

try:
bookmarksFile = os.path.join(dataPath, 'bookmarks.db')

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

dbcur.execute('SELECT * FROM bookmark')

results = cursor.fetchall()

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

dbcon,close

except:
pass
Reply


Messages In This Thread
Need a bit of help for Kodi service to share bookmarks among many Kodi devices - by regismaltais33 - 2019-10-03, 11:37
Logout Mark Read Team Forum Stats Members Help
Need a bit of help for Kodi service to share bookmarks among many Kodi devices0