2019-08-27, 16:43
For example
How get idFile (file Id from DB) associated with this listitem ?
python:listitem = sys.listitem
How get idFile (file Id from DB) associated with this listitem ?
python:listitem = sys.listitem
(2019-08-27, 16:43)FreakMurderer Wrote: For example
python:listitem = sys.listitem
How get idFile (file Id from DB) associated with this listitem ?
id = xbmc.getInfoLabel('ListItem.DBID')
listitem.setProperty('FreakMurderer', 'blablabla')
-> xbmc.getInfoLabel('ListItem.Property(FreakMurderer)')
(2019-08-27, 20:04)doko-desuka Wrote: 2) Assuming the URL is a route to your own add-on (a different folder of it etc.), you can access the chosen item's DBID with the function id = xbmc.getInfoLabel('ListItem.DBID')Cannot Get Id. EmptyString.
(2019-08-27, 20:26)Lunatixz Wrote: listitem = sys.listitem
dbid = listitem.getDbid()
AttributeError: 'xbmcgui.ListItem' object has no attribute 'getDbid'
python:
.....
cursor = db.execute('SELECT idPath FROM main.path WHERE strPath=?', (dirPath,))
.....
cursor.execute('SELECT idFile FROM main.files WHERE idPath=? AND strFilename=?', (folderIds[0], os.path.basename(filePath),))
......
python:listitem = sys.listitem
dbid = listitem.getVideoInfoTag().getDbid()
listitem.getVideoInfoTag().getDbId()
should work, by this post: https://forum.kodi.tv/showthread.php?tid=234184
(2019-08-28, 00:47)doko-desuka Wrote: The call listitem.getVideoInfoTag().getDbId()
should work, by this post: https://forum.kodi.tv/showthread.php?tid=234184
listitem.getVideoInfoTag ().GetDbId()
only works with items that have content (movies, tvshows, etc).idFile
from listitem - videofiles without content?listitem.getVideoInfoTag().getDbId()
command returns idMovie
column (if we are talking about items-movies, or idShow
column - if items-tvshows, ..... ) from the database, not the idFile
column that I need.
(strFilename, idFile)
pairs from the 'files' table of MyVideosXXX.db, then matching it with the listitem.getVideoInfoTag().getPath()
work?.getPath()
returns the same filenames as stored the 'strFilename' column.)python:
..........
dbPath = os.path.join(xbmc.translatePath("special://database"), 'MyVideos116.db')
db = sqlite.connect(dbPath)
filePath = li.getPath()
dirPath = os.path.dirname(filePath) + os.sep
cursor = db.execute('SELECT timeInSeconds FROM main.bookmark WHERE idFile=(SELECT idFile FROM main.files WHERE idPath=(SELECT idPath FROM main.path WHERE strPath=?) AND strFilename=?)',(dirPath, os.path.basename(filePath),))
..........