Resuming STRM Files
#16
(2020-11-10, 23:42)SEIKT Wrote:
(2020-11-10, 19:38)trixeo Wrote:
(2020-11-10, 09:58)SEIKT Wrote: If you want to try your luck, test this code change to actions.py found in jellfin_kodi\objects. Refer to lines 68, 75, 81.

https://paste.kodi.tv/okuqejumuh

I didn't add the code to prompt a resume menu but I added the code that should play the video at the resume point if there is one. Let me know if it does.
Thank you for trying but that did not change anything :/ The episode gets marked as watched 10 seconds after I stop it, no matter where in the ep I stop it. Before those 10 seconds come to pass, it shows the resume symbol on it, _and_, here's a strange thing; it shows the real name of the file instead of the scraped information, and on the 11:th second it gets marked as watched and get the scraped name back. And IF I start the ep before those 10 seconds have passed, during which time it shows the real name of the mkv-file, I get the option to resume the ep, and it works! But I checked, that is also the exact same behavior as without the mod on lines 68, 75 and 81. I guess this is a clue for someone knowing what is happening during those 10 seconds.
The if statement on line 445 may be causing interference. In the code block are setproperty commands that modify the videos start time/resume time. I commented out the code that may interfere.

https://paste.kodi.tv/awifemukiq

After updating your code, when you've played a video can you refer to your Kodi log file and search for the following text:
SEIKT 1
SEIKT 2
SEIKT 3
SEIKT 4
SEIKT 5
SEIKT 6

It would help me understand which code is being executed if any.

Nothing in logs with SEIKT, so I guess it's not using that code when this happens. What I can see though in the logs is that u'Played' is mentioned twice in this line:
NOTICE: JELLYFIN.entrypoint.service -> INFO::jellyfin_kodi\entrypoint\service.py:252 [ UserDataChanged ] {u'UserId': u'4ebc62ee11d248b8b044c2a7c0030466', u'UserDataList': [{u'ItemId': u'6fa6a5ac3a6e9c9ecd8caaf810a951a4', u'Rating': None, u'IsFavorite': False, u'Played': True, u'PlayedPercentage': None, u'UnplayedItemCount': None, u'LastPlayedDate': u'2020-11-11T11:47:04.210526Z', u'Likes': None, u'Key': u'368643001004', u'PlayCount': 1, u'PlaybackPositionTicks': 0}, {u'ItemId': u'46bdfea1a9c7bd528a659a38a2309896', u'Rating': None, u'IsFavorite': False, u'Played': False, u'PlayedPercentage': None, u'UnplayedItemCount': 5, u'LastPlayedDate': None, u'Likes': None, u'Key': u'368643', u'PlayCount': 0, u'PlaybackPositionTicks': 0}]}
Reply
#17
(2020-11-10, 21:49)LongMan Wrote: @trixeo,
If you can, could you give MediaImport a go and report if it has a similar problem. Instructions are here.

Can you explain what MediaImport is? An alternative to the Jellyfin plugin for Kodi?
Reply
#18
Yes it is. Emby for Kodi and Jellyfin Kodi are both outshoot of the project. It took a while to implement properly so one the addon developers made Emby for Kodi. Unlike those implementation, MediaImport is Kodi core Kodi feature. It has not been merged into the mainline yet but it is quite functional. It is a separate build rignt now. The one I linked to is Kodi v19 Matrix Alpha 2 + MediaImport.

We would love your feedback. If you can please give it a spin.
Reply
#19
(2020-11-11, 18:19)LongMan Wrote: Yes it is. Emby for Kodi and Jellyfin Kodi are both outshoot of the project. It took a while to implement properly so one the addon developers made Emby for Kodi. Unlike those implementation, MediaImport is Kodi core Kodi feature. It has not been merged into the mainline yet but it is quite functional. It is a separate build rignt now. The one I linked to is Kodi v19 Matrix Alpha 2 + MediaImport.

We would love your feedback. If you can please give it a spin.
Hi, I've tested your build of Kodi with MediaImport. The issue is a little bit different now, there is still the issue that the "real" filename of the mkv will be shown in the list after I stop the ep after a few seconds, however it will not change back to the scraped name, nor is it set as watched after only watching a few secs. If I go out of the TV shows entry and then back, the episode is now changed back to the scraped name. In both cases it will be properly marked with a resume point icon if it's been watched long enough for that to be set. However, even if set in media settings to default select action: choose, no offer will be shown to resume; probably what SEIKT is talking about in post 1 in this thread, and something that can be fixed with his pull req.
Other than that, the MediaImport plugin works really nice and feels stable. Keep up the good work!
Reply
#20
@trixeo,
Thanks for the feedback. The forum is here in case you want to give more details of that hiccup. I am using Emby and I am not seeing it. However Emby had added an endpoint to update playback data at the request of the Developer so Kodi stores the info and then update the server. That endpoint has not been added to Jellyfin so the playback update is via a legacy method that was not meant for that.

Thanks again.
Reply
#21
(2020-11-08, 03:54)SEIKT Wrote:
(2020-11-08, 01:57)Karellen Wrote: @SEIKT

Can you comment on your findings in that PR. It may bring it back to the attention of the developers.
Will do. And if anyone's interested in a workaround for the time being, this is what I came up with.

python:

dbID = xbmc.getInfoLabel('Container.ListItem.DBID')
videoType = xbmc.getInfoLabel('Container.ListItem.DBTYPE')

if videoType == 'movie':
    jsonQuery = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovieDetails", "params": {"movieid": %s, "properties": ["resume"]}, "id": "1"}' % dbID)
    jsonKey = 'moviedetails'
elif videoType == 'episode':
    jsonQuery = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodeDetails", "params": {"episodeid": %s, "properties": ["resume"]}, "id": "1"}' % dbID)
    jsonKey = 'episodedetails'

jsonQuery = unicode(jsonQuery, 'utf-8', errors='ignore')
jsonQuery = json.loads(jsonQuery)

resumePosition = jsonQuery['result'][jsonKey]['resume']['position']
resume = False

if resumePosition > 0:
    options = []
    options.append('Resume from ' + str(time.strftime("%H:%M:%S", time.gmtime(resumePosition))))
    options.append('Play from beginning')

    selection = xbmcgui.Dialog().contextmenu(options)

    if selection == 0:
        resume = True
    elif selection == -1:
        xbmcplugin.endOfDirectory(self.plugin_handle)
        return

item = xbmcgui.ListItem(path='http://localhost:' + str(service.settings.streamPort) + '/play')

if resume:
    item.setProperty('totaltime', '1')
else:
    item.setProperty('StartPercent', '0')

xbmcplugin.setResolvedUrl(self.plugin_handle, True, item)
First of all thanks for the workaround.
Cound't get to xbmc.getInfoLabel('Container.ListItem.DBID') to return the id for me, i was going to replace xbmc.getInfoLabel('ListItem.FolderPath'), but the funny thing is it returns a value if opened by the movies library, but doesn't return anything if opened by the main screen widget, tried on kodi 18 and 19.
Maybe its realted with something in the skin?
Reply
#22
(2021-03-31, 14:43)Rick987 Wrote:
(2020-11-08, 03:54)SEIKT Wrote:
(2020-11-08, 01:57)Karellen Wrote: @SEIKT

Can you comment on your findings in that PR. It may bring it back to the attention of the developers.
Will do. And if anyone's interested in a workaround for the time being, this is what I came up with.

python:

dbID = xbmc.getInfoLabel('Container.ListItem.DBID')
videoType = xbmc.getInfoLabel('Container.ListItem.DBTYPE')

if videoType == 'movie':
    jsonQuery = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovieDetails", "params": {"movieid": %s, "properties": ["resume"]}, "id": "1"}' % dbID)
    jsonKey = 'moviedetails'
elif videoType == 'episode':
    jsonQuery = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodeDetails", "params": {"episodeid": %s, "properties": ["resume"]}, "id": "1"}' % dbID)
    jsonKey = 'episodedetails'

jsonQuery = unicode(jsonQuery, 'utf-8', errors='ignore')
jsonQuery = json.loads(jsonQuery)

resumePosition = jsonQuery['result'][jsonKey]['resume']['position']
resume = False

if resumePosition > 0:
    options = []
    options.append('Resume from ' + str(time.strftime("%H:%M:%S", time.gmtime(resumePosition))))
    options.append('Play from beginning')

    selection = xbmcgui.Dialog().contextmenu(options)

    if selection == 0:
        resume = True
    elif selection == -1:
        xbmcplugin.endOfDirectory(self.plugin_handle)
        return

item = xbmcgui.ListItem(path='http://localhost:' + str(service.settings.streamPort) + '/play')

if resume:
    item.setProperty('totaltime', '1')
else:
    item.setProperty('StartPercent', '0')

xbmcplugin.setResolvedUrl(self.plugin_handle, True, item)
First of all thanks for the workaround.
Cound't get to xbmc.getInfoLabel('Container.ListItem.DBID') to return the id for me, i was going to replace xbmc.getInfoLabel('ListItem.FolderPath'), but the funny thing is it returns a value if opened by the movies library, but doesn't return anything if opened by the main screen widget, tried on kodi 18 and 19.
Maybe its realted with something in the skin?

I had this issue too buddy, the solution is strange but it does fix this issue. You have to place xbmc.getInfoLabel('Container.ListItem.DBID') at the top of the first file of your addon that is executed by Kodi, in my case it is default.py.

https://github.com/JDRIVO/gDrive-for-Kod...default.py

Review this file from line 415 onwards:
https://github.com/JDRIVO/gDrive-for-Kod...ne.py#L415
Reply
#23
(2021-03-31, 15:20)SEIKT Wrote:
(2021-03-31, 14:43)Rick987 Wrote:
(2020-11-08, 03:54)SEIKT Wrote: Will do. And if anyone's interested in a workaround for the time being, this is what I came up with.

python:

dbID = xbmc.getInfoLabel('Container.ListItem.DBID')
videoType = xbmc.getInfoLabel('Container.ListItem.DBTYPE')

if videoType == 'movie':
    jsonQuery = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovieDetails", "params": {"movieid": %s, "properties": ["resume"]}, "id": "1"}' % dbID)
    jsonKey = 'moviedetails'
elif videoType == 'episode':
    jsonQuery = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodeDetails", "params": {"episodeid": %s, "properties": ["resume"]}, "id": "1"}' % dbID)
    jsonKey = 'episodedetails'

jsonQuery = unicode(jsonQuery, 'utf-8', errors='ignore')
jsonQuery = json.loads(jsonQuery)

resumePosition = jsonQuery['result'][jsonKey]['resume']['position']
resume = False

if resumePosition > 0:
    options = []
    options.append('Resume from ' + str(time.strftime("%H:%M:%S", time.gmtime(resumePosition))))
    options.append('Play from beginning')

    selection = xbmcgui.Dialog().contextmenu(options)

    if selection == 0:
        resume = True
    elif selection == -1:
        xbmcplugin.endOfDirectory(self.plugin_handle)
        return

item = xbmcgui.ListItem(path='http://localhost:' + str(service.settings.streamPort) + '/play')

if resume:
    item.setProperty('totaltime', '1')
else:
    item.setProperty('StartPercent', '0')

xbmcplugin.setResolvedUrl(self.plugin_handle, True, item)
First of all thanks for the workaround.
Cound't get to xbmc.getInfoLabel('Container.ListItem.DBID') to return the id for me, i was going to replace xbmc.getInfoLabel('ListItem.FolderPath'), but the funny thing is it returns a value if opened by the movies library, but doesn't return anything if opened by the main screen widget, tried on kodi 18 and 19.
Maybe its realted with something in the skin?

I had this issue too buddy, the solution is strange but it does fix this issue. You have to place xbmc.getInfoLabel('Container.ListItem.DBID') at the top of the first file of your addon that is executed by Kodi, in my case it is default.py.

https://github.com/JDRIVO/gDrive-for-Kod...default.py

Review this file from line 415 onwards:
https://github.com/JDRIVO/gDrive-for-Kod...ne.py#L415
Well its weird, but it just worked, xbmc.getInfoLabel('ListItem.DBID') after the import xmb, worked for the widget menu
Thanks very much pal, the method i used to store the % of watched movies was very messy
Reply
#24
(2021-03-31, 15:32)Rick987 Wrote:
(2021-03-31, 15:20)SEIKT Wrote:
(2021-03-31, 14:43)Rick987 Wrote: First of all thanks for the workaround.
Cound't get to xbmc.getInfoLabel('Container.ListItem.DBID') to return the id for me, i was going to replace xbmc.getInfoLabel('ListItem.FolderPath'), but the funny thing is it returns a value if opened by the movies library, but doesn't return anything if opened by the main screen widget, tried on kodi 18 and 19.
Maybe its realted with something in the skin?

I had this issue too buddy, the solution is strange but it does fix this issue. You have to place xbmc.getInfoLabel('Container.ListItem.DBID') at the top of the first file of your addon that is executed by Kodi, in my case it is default.py.

https://github.com/JDRIVO/gDrive-for-Kod...default.py

Review this file from line 415 onwards:
https://github.com/JDRIVO/gDrive-for-Kod...ne.py#L415
Well its weird, but it just worked, xbmc.getInfoLabel('ListItem.DBID') after the import xmb, worked for the widget menu
Thanks very much pal, the method i used to store the % of watched movies was very messy

Glad to hear. It doesn't completely fix the bug, it will work 99% of the time, but on occasion the DB ID will return empty and you will have to reclick the video, the second attempt always works. It took a look of hair pulling to figure out such a simple fix. No one on this forum could help me, I ended up caching the video/resume data into a pickle file until I figured out this solution.

https://forum.kodi.tv/showthread.php?tid=358097
Reply
#25
(2021-03-31, 16:27)SEIKT Wrote:
(2021-03-31, 15:32)Rick987 Wrote:
(2021-03-31, 15:20)SEIKT Wrote: I had this issue too buddy, the solution is strange but it does fix this issue. You have to place xbmc.getInfoLabel('Container.ListItem.DBID') at the top of the first file of your addon that is executed by Kodi, in my case it is default.py.

https://github.com/JDRIVO/gDrive-for-Kod...default.py

Review this file from line 415 onwards:
https://github.com/JDRIVO/gDrive-for-Kod...ne.py#L415
Well its weird, but it just worked, xbmc.getInfoLabel('ListItem.DBID') after the import xmb, worked for the widget menu
Thanks very much pal, the method i used to store the % of watched movies was very messy

Glad to hear. It doesn't completely fix the bug, it will work 99% of the time, but on occasion the DB ID will return empty and you will have to reclick the video, the second attempt always works. It took a look of hair pulling to figure out such a simple fix. No one on this forum could help me, I ended up caching the video/resume data into a pickle file until I figured out this solution.

https://forum.kodi.tv/showthread.php?tid=358097

Im really glad that i could find this, this is sad that after all this time kodi didnt implemented strm files to resume, as they save it.
Even not 100% this is very helpful, i always thought if trakt could set all the resume we could get it somehow, but my knowledge is pretty basic
Reply
#26
(2021-03-31, 16:27)SEIKT Wrote:
(2021-03-31, 15:32)Rick987 Wrote:
(2021-03-31, 15:20)SEIKT Wrote: I had this issue too buddy, the solution is strange but it does fix this issue. You have to place xbmc.getInfoLabel('Container.ListItem.DBID') at the top of the first file of your addon that is executed by Kodi, in my case it is default.py.

https://github.com/JDRIVO/gDrive-for-Kod...default.py

Review this file from line 415 onwards:
https://github.com/JDRIVO/gDrive-for-Kod...ne.py#L415
Well its weird, but it just worked, xbmc.getInfoLabel('ListItem.DBID') after the import xmb, worked for the widget menu
Thanks very much pal, the method i used to store the % of watched movies was very messy

Glad to hear. It doesn't completely fix the bug, it will work 99% of the time, but on occasion the DB ID will return empty and you will have to reclick the video, the second attempt always works. It took a look of hair pulling to figure out such a simple fix. No one on this forum could help me, I ended up caching the video/resume data into a pickle file until I figured out this solution.

https://forum.kodi.tv/showthread.php?tid=358097

Just a feedback here, i tried it on windows and on my android phone and it work almost 100% like you said, but it didnt work in the home widgets on my mibox that runs android tv
Reply
#27
(2021-04-01, 12:08)Rick987 Wrote:
(2021-03-31, 16:27)SEIKT Wrote:
(2021-03-31, 15:32)Rick987 Wrote: Well its weird, but it just worked, xbmc.getInfoLabel('ListItem.DBID') after the import xmb, worked for the widget menu
Thanks very much pal, the method i used to store the % of watched movies was very messy

Glad to hear. It doesn't completely fix the bug, it will work 99% of the time, but on occasion the DB ID will return empty and you will have to reclick the video, the second attempt always works. It took a look of hair pulling to figure out such a simple fix. No one on this forum could help me, I ended up caching the video/resume data into a pickle file until I figured out this solution.

https://forum.kodi.tv/showthread.php?tid=358097

Just a feedback here, i tried it on windows and on my android phone and it work almost 100% like you said, but it didnt work in the home widgets on my mibox that runs android tv

Strange, it works fine on my Google TV Chromecast. If you want to test my addon on your mibox, change the code in default.py to this:

python:

import xbmc

# container = xbmc.getInfoLabel('System.CurrentControlID')
# dbID = xbmc.getInfoLabel('Container(%s).ListItem.DBID' % container)
# dbType = xbmc.getInfoLabel('Container(%s).ListItem.DBTYPE' % container)
# dbType = xbmc.getInfoLabel('Container.ListItem.DBID')
# dbID = xbmc.getInfoLabel('ListItem.FolderPath').split('?')[0].rstrip('/').split('/')[-1]

dbID = xbmc.getInfoLabel('ListItem.DBID')
dbType = xbmc.getInfoLabel('ListItem.DBTYPE')
filePath = xbmc.getInfoLabel('ListItem.FolderPath')

import xbmcgui

if dbID:
    xbmcgui.Dialog().notification('test', 'DB ID Found')
else:
    xbmcgui.Dialog().notification('test', 'DB ID Not Found')
Reply
#28
(2021-04-01, 13:33)SEIKT Wrote:
(2021-04-01, 12:08)Rick987 Wrote:
(2021-03-31, 16:27)SEIKT Wrote: Glad to hear. It doesn't completely fix the bug, it will work 99% of the time, but on occasion the DB ID will return empty and you will have to reclick the video, the second attempt always works. It took a look of hair pulling to figure out such a simple fix. No one on this forum could help me, I ended up caching the video/resume data into a pickle file until I figured out this solution.

https://forum.kodi.tv/showthread.php?tid=358097

Just a feedback here, i tried it on windows and on my android phone and it work almost 100% like you said, but it didnt work in the home widgets on my mibox that runs android tv

Strange, it works fine on my Google TV Chromecast. If you want to test my addon on your mibox, change the code in default.py to this:

python:

import xbmc

# container = xbmc.getInfoLabel('System.CurrentControlID')
# dbID = xbmc.getInfoLabel('Container(%s).ListItem.DBID' % container)
# dbType = xbmc.getInfoLabel('Container(%s).ListItem.DBTYPE' % container)
# dbType = xbmc.getInfoLabel('Container.ListItem.DBID')
# dbID = xbmc.getInfoLabel('ListItem.FolderPath').split('?')[0].rstrip('/').split('/')[-1]

dbID = xbmc.getInfoLabel('ListItem.DBID')
dbType = xbmc.getInfoLabel('ListItem.DBTYPE')
filePath = xbmc.getInfoLabel('ListItem.FolderPath')

import xbmcgui

if dbID:
    xbmcgui.Dialog().notification('test', 'DB ID Found')
else:
    xbmcgui.Dialog().notification('test', 'DB ID Not Found')
Yea, i'm gonna run some tests and i'll be back with the feedback, thanks for sharing and thanks for your time
Reply
#29
(2021-04-01, 14:26)Rick987 Wrote:
(2021-04-01, 13:33)SEIKT Wrote:
(2021-04-01, 12:08)Rick987 Wrote: Just a feedback here, i tried it on windows and on my android phone and it work almost 100% like you said, but it didnt work in the home widgets on my mibox that runs android tv

Strange, it works fine on my Google TV Chromecast. If you want to test my addon on your mibox, change the code in default.py to this:

python:

import xbmc

# container = xbmc.getInfoLabel('System.CurrentControlID')
# dbID = xbmc.getInfoLabel('Container(%s).ListItem.DBID' % container)
# dbType = xbmc.getInfoLabel('Container(%s).ListItem.DBTYPE' % container)
# dbType = xbmc.getInfoLabel('Container.ListItem.DBID')
# dbID = xbmc.getInfoLabel('ListItem.FolderPath').split('?')[0].rstrip('/').split('/')[-1]

dbID = xbmc.getInfoLabel('ListItem.DBID')
dbType = xbmc.getInfoLabel('ListItem.DBTYPE')
filePath = xbmc.getInfoLabel('ListItem.FolderPath')

import xbmcgui

if dbID:
    xbmcgui.Dialog().notification('test', 'DB ID Found')
else:
    xbmcgui.Dialog().notification('test', 'DB ID Not Found')
Yea, i'm gonna run some tests and i'll be back with the feedback, thanks for sharing and thanks for your time

I made a simple addon to test in the mibox and it returned the ID, so i decided to use this addon as a "bridge" to call my main addon, it work for a moment and then it stopped. It does work on my phone and on windows so I don't know whats going on with my mibox, i have two more miboxes in my parents house and ill try there when I can.
It seems some other addon is interfering in this behavior.
I'll be back if I can find any answer
Reply
#30
(2021-04-02, 04:48)Rick987 Wrote:
(2021-04-01, 14:26)Rick987 Wrote:
(2021-04-01, 13:33)SEIKT Wrote: Strange, it works fine on my Google TV Chromecast. If you want to test my addon on your mibox, change the code in default.py to this:

python:

import xbmc

# container = xbmc.getInfoLabel('System.CurrentControlID')
# dbID = xbmc.getInfoLabel('Container(%s).ListItem.DBID' % container)
# dbType = xbmc.getInfoLabel('Container(%s).ListItem.DBTYPE' % container)
# dbType = xbmc.getInfoLabel('Container.ListItem.DBID')
# dbID = xbmc.getInfoLabel('ListItem.FolderPath').split('?')[0].rstrip('/').split('/')[-1]

dbID = xbmc.getInfoLabel('ListItem.DBID')
dbType = xbmc.getInfoLabel('ListItem.DBTYPE')
filePath = xbmc.getInfoLabel('ListItem.FolderPath')

import xbmcgui

if dbID:
    xbmcgui.Dialog().notification('test', 'DB ID Found')
else:
    xbmcgui.Dialog().notification('test', 'DB ID Not Found')
Yea, i'm gonna run some tests and i'll be back with the feedback, thanks for sharing and thanks for your time

I made a simple addon to test in the mibox and it returned the ID, so i decided to use this addon as a "bridge" to call my main addon, it work for a moment and then it stopped. It does work on my phone and on windows so I don't know whats going on with my mibox, i have two more miboxes in my parents house and ill try there when I can.
It seems some other addon is interfering in this behavior.
I'll be back if I can find any answer
Hmm, maybe try a clean install of Kodi.
Reply

Logout Mark Read Team Forum Stats Members Help
Resuming STRM Files0