Prevent player from adding file to database
#1
How could I prevent Kodi Player to not include any files that are being played inside my plugin to database - they are saved into `files` table with additional `streamdetails`.
Code:
<playcountminimumpercent>101</playcountminimumpercent>
only prevent playcount from being updated and not the file itself.

I would like to disable this. Do I need overwrite player? Or can I delete any entries that have path = plugin.mineplugin ?
Reply
#2
If you add a directory item with isFolder=False but do not touch its 'isPlayble' property (important!), it allows you to execute arbitrary code in a plugin call without raising errors. This includes starting playback with xbmc.Player class. In this case your playable path won't be monitored by the database.
Reply
#3
(2017-08-07, 08:59)Roman_V_M Wrote: If you add a directory item with isFolder=False but do not touch its 'isPlayble' property (important!), it allows you to execute arbitrary code in a plugin call without raising errors. This includes starting playback with xbmc.Player class. In this case your playable path won't be monitored by the database.

Are you sure? because I comment out every isPlayable and change a bit play function because without isPlayable the `setResolvedUrl()` stop playing it.

I do this when someone pick item that I added to execute video:

Code:
file_url="http://127.0.0.1/server/file.mkv"
details = {
        'plot':          xbmc.getInfoLabel('ListItem.Plot'),
        'title':         xbmc.getInfoLabel('ListItem.Title'),
        'sorttitle':     xbmc.getInfoLabel('ListItem.Title'),
        'rating':        xbmc.getInfoLabel('ListItem.Rating'),
        'duration':      xbmc.getInfoLabel('ListItem.Duration'),
        'mpaa':          xbmc.getInfoLabel('ListItem.Mpaa'),
        'year':          xbmc.getInfoLabel('ListItem.Year'),
        'tagline':       xbmc.getInfoLabel('ListItem.Tagline'),
        'episode':       xbmc.getInfoLabel('ListItem.Episode'),
        'aired':         xbmc.getInfoLabel('ListItem.Premiered'),
        'tvshowtitle':   xbmc.getInfoLabel('ListItem.TVShowTitle'),
        'votes':         xbmc.getInfoLabel('ListItem.Votes'),
        'originaltitle': xbmc.getInfoLabel('ListItem.OriginalTitle'),
        'size':          xbmc.getInfoLabel('ListItem.Size'),
        'season':        xbmc.getInfoLabel('ListItem.Season'),
    }
item = xbmcgui.ListItem(details.get('title', 'Unknown'), thumbnailImage=xbmc.getInfoLabel('ListItem.Thumb'), path=file_url)
item.setInfo(type='Video', infoLabels=details)
player = xbmc.Player()
player.play(item=file_url, listitem=item)

But still I end up having row added to database:
Code:
idFile=1, idPath=1, strFilename=file.mkv, playCount='', lastPlayed=2017-08-09, dateAdded=''

after playing given file (both in Kodi 17.3 and Leia).
Reply
#4
OK, I admit that I've never looked into the database. But with xbmc.Player Kodi does not create "in progress"/"watched" marks, unlike with setResolvedUrl. Isn't it what you need?
Reply
#5
(2017-08-09, 22:29)Roman_V_M Wrote: OK, I admit that I've never looked into the database. But with xbmc.Player Kodi does not create "in progress"/"watched" marks, unlike with setResolvedUrl. Isn't it what you need?

Yes and no.
Yes - Its same as using ignorepercent but it does create StreamDetails, so my data get overwriten while drawing ListItem by Kodi (and data from DB for that file) after playing file.

But the countplay was my main problem. To bad I cannot prevent Kodi from including those new rows in path/files tables.

Maybe there is so Call I could make to ask Player what ID this file have in db and then somehow force kodi to remove file with given ID ?
Reply

Logout Mark Read Team Forum Stats Members Help
Prevent player from adding file to database0