Kodi Community Forum
Library Scan of Movie/Show Runtime Duration - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: OS independent / Other (https://forum.kodi.tv/forumdisplay.php?fid=228)
+---- Thread: Library Scan of Movie/Show Runtime Duration (/showthread.php?tid=226778)

Pages: 1 2


RE: Library Scan of Movie/Show Runtime Duration - MasterCATZ - 2022-11-25

Thank You Greatly Appreciate it, lets's see what I can break Big Grin
looks like I am already off to a bad start my nightly sql backups seemed to have stopped 1 week ago
*sigh* wonder what system update broke that
and now confused because Nautalis shows the 18th and every other program said 25th as the time stamp, going to assume I do have a backup and am ready to test nightly without losing data

Kodi nightly 6:20.0+git20221123.0301-0e150116aa-0~jammy 
installed your "context.show.runtime-main.zip"

just not too sure when / where / how it's meant to pop up? 

I used to use "skin.confluence" and it is still my fav skin from back in xbmc days but trying to migrate to the newer default kodi skins but some key features I am used too just no longer exist 
and knowing the runtime is one of them
the other is knowing when sound is going through passthrough with no volume adjustment


RE: Library Scan of Movie/Show Runtime Duration - jbinkley60 - 2022-11-25

(2022-11-25, 00:38)MasterCATZ Wrote: Thank You Greatly Appreciate it, lets's see what I can break Big Grin
looks like I am already off to a bad start my nightly sql backups seemed to have stopped 1 week ago
*sigh* wonder what system update broke that
and now confused because Nautalis shows the 18th and every other program said 25th as the time stamp, going to assume I do have a backup and am ready to test nightly without losing data

Good luck and let me know how the updated addon works for you.  Sorry I can't help with your SQL issue.  I run a very different solution for managing and maintaining my Kodi clients' databases.  It's all pretty much automatic.


Jeff


RE: Library Scan of Movie/Show Runtime Duration - MasterCATZ - 2022-11-25

well I found a section I can access the info from bottom of a menu when pressing C in a title section 

but it is not a window it just flashes a notification pop up 

also wish it did not convert things into days but left them in Hours with a eta of finish time , but it is definitely a helpful start


RE: Library Scan of Movie/Show Runtime Duration - jbinkley60 - 2022-11-25

(2022-11-25, 08:21)MasterCATZ Wrote: well I found a section I can access the info from bottom of a menu when pressing C in a title section 

but it is not a window it just flashes a notification pop up 

also wish it did not convert things into days but left them in Hours with a eta of finish time , but it is definitely a helpful start

I did not change the notification formats.  There are two options, notification format (default) and an Ok dialog box (if you change the addon setting to details).  None of this code changed from the prior release.   Try changing the addon setting by enabling Detailed RuntimeDialog Info and see if that is more of what you are looking for.   Once you try that I can work on any day / time formatting.


Jeff


RE: Library Scan of Movie/Show Runtime Duration - MasterCATZ - 2022-11-25

I have no configure options ? greyed out tried with both skins and different profiles 
Image

also this seems to lag the drop down menu loading press C and it must then try doing the calculations before selecting "Show Run Time" ie ) a 1000 ep series can take a good minute before menu will load any idea how to make it only calculate stuff when "Show Runtime is selected"

ImageImage[/url]
Image 

also noticed anything added since 09/07/2021 says  0 min remaining  so at some stage meta data it must use stopped being scraped into my database 

also the code seems to still have a lot of xbmc mentions 

I removed the days no idea if its correct but it seemed to work , main reason being no ones going to spend every hour of a week watching 300+ ep show  and actually finishing within the days it says
traktv + steam keeps track of the days of my life wasted Tongue

python:

def convert_time(runtime):
    return '{0} days {1} hours {2} minutes'.format(int(runtime/24/60), int(runtime/60%24), f'{runtime%60:.2f}')
would that mean something like 
python:

def convert_time(runtime):
    return '{0} hours {1} minutes'.format(int(runtime/60), int(runtime/60%24), f'{runtime%60:.2f}')



RE: Library Scan of Movie/Show Runtime Duration - jbinkley60 - 2022-11-25

(2022-11-25, 14:03)MasterCATZ Wrote: I have no configure options ? greyed out tried with both skins and different profiles 


also this seems to lag the drop down menu loading press C and it must then try doing the calculations before selecting "Show Run Time" ie ) a 1000 ep series can take a good minute before menu will load any idea how to make it only calculate stuff when "Show Runtime is selected"

[/url]
 

also noticed anything added since 09/07/2021 says  0 min remaining  so at some stage meta data it must use stopped being scraped into my database 

also the code seems to still have a lot of xbmc mentions 

I removed the days no idea if its correct but it seemed to work , main reason being no ones going to spend every hour of a week watching 300+ ep show  and actually finishing within the days it says
traktv + steam keeps track of the days of my life wasted Tongue

python:

def convert_time(runtime):
    return '{0} days {1} hours {2} minutes'.format(int(runtime/24/60), int(runtime/60%24), f'{runtime%60:.2f}')
would that mean something like 
python:

def convert_time(runtime):
    return '{0} hours {1} minutes'.format(int(runtime/60), int(runtime/60%24), f'{runtime%60:.2f}')

Sorry about the settings not working.  I have uploaded v1.0.99d which fixes the issue.  I had run the settings through the Kodi provided script which converts to the new format but didn't test afterwards.  The default value wasn't being set properly, which caused the settings not to appear. 

The lag is due to the size of the TV show and the speed of your device (including storage speed) since it is reading from the Kodi database. 

The XBMC calls in the code are still required by Kodi.  Not all XBMC references have been removed from Kodi code.

Yes, the code change you have will remove days.  I can also add a setting which you can set to include or not include days.  It is an easy code update.  Just let me know.


Thanks,

Jeff


RE: Library Scan of Movie/Show Runtime Duration - jbinkley60 - 2022-11-26

@MasterCATZ 

I went ahead and added a setting to disable the day calculation.  You can test the new 1.0.99e version and let me know if it works for you.


Jeff


RE: Library Scan of Movie/Show Runtime Duration - MasterCATZ - 2022-11-26

Looking good and thanks for the day switch 

Image



yes I understand the time needed to add up the time but why is it doing this calculation while loading up the drop down menu before selecting show runtime ?
I can not select basic tasks from the dropdown menu quickly because this script is being run in the background 
any idea how to move its calculations until it is actually selected ?


also any idea how to get it to show in the dropdown menu for the season ? 

Image


also I could not find a donation link on your github ?


RE: Library Scan of Movie/Show Runtime Duration - jbinkley60 - 2022-11-26

(2022-11-26, 06:29)MasterCATZ Wrote: Looking good and thanks for the day switch 


yes I understand the time needed to add up the time but why is it doing this calculation while loading up the drop down menu before selecting show runtime ?
I can not select basic tasks from the dropdown menu quickly because this script is being run in the background 
any idea how to move its calculations until it is actually selected ?


also any idea how to get it to show in the dropdown menu for the season ? 




also I could not find a donation link on your github ?

For the calculations question I will need to do some testing but typically context menu items don't do anything until selected so it shouldn't be doing any calculations until you select it.  Can you check to see if this is happening across various skins ?  It is possible some skins operate differently but I wouldn't think so.  I'll let you know what I find.

Yes, I can add this to TV seasons.  I'll do that in the next release. 

No donations needed but the thought is appreciated. 


Thanks,

Jeff


RE: Library Scan of Movie/Show Runtime Duration - MasterCATZ - 2022-11-26

yes it does this with all the skins I have many large series that take ages to load up the drop down menu for testing with 

I spent this arvo finally adding in a finish time, I like watching full seasons in 1 hit so pick them based on bed time eta
I am sure you can come up with a better method then what I coded in but this seemed to work for me
now I just have to work out why meta data is not being collected anymore I had a feeling it was something kodi recently dropped by default 
it just is not reading the run times from anything added into my mariadb this year 

Image

https://github.com/MasterCATZ/context.show.runtime/blob/main/addon.py


RE: Library Scan of Movie/Show Runtime Duration - jbinkley60 - 2022-11-26

(2022-11-26, 15:27)MasterCATZ Wrote: yes it does this with all the skins I have many large series that take ages to load up the drop down menu for testing with 

I spent this arvo finally adding in a finish time, I like watching full seasons in 1 hit so pick them based on bed time eta
I am sure you can come up with a better method then what I coded in but this seemed to work for me
now I just have to work out why meta data is not being collected anymore I had a feeling it was something kodi recently dropped by default 
it just is not reading the run times from anything added into my mariadb this year 



https://github.com/MasterCATZ/context.show.runtime/blob/main/addon.py

I did some testing and confirmed that the addon is only doing the calculations via a JSON RPC call when you click on the context menu item.  So this leads me to believe the issue is adding the context menu your library items.  That's an internal Kodi thing and we may need some help from Team Kodi.  Do you have other context menu addons that are adding a number of context menu options ?  I've made a change to how the addon detects TV shows and I've added seasons.  I changed from a dbtype check to a container type check.  This may be faster but I am not sure.  You can give it a try with version 1.0.99f.

I added your finish time item and I suspect seasons will not work for you.  Give it a try.  if it doesn't work I may need to make an adjustment wither in the JSON RPC call or season filter to get it to work properly.  I am pretty sure it will require a "VideoLibrary.GetSeasons" vs. a "VideoLibrary.GetTVShows" and some additional filtering on the response


Thanks,

Jeff


RE: Library Scan of Movie/Show Runtime Duration - MasterCATZ - 2022-11-27

Thanks showed up in the season menu , now to work out how to get it to look through it, will see if I can get it working with your hints  

I know I did have some custom menu's at some stage but "Library Node Editor" stopped working a while ago "ModuleNotFoundError: No module named 'unidecode'"
"Library Node Editor was used to alter "Recently Added" subtab settings" and to get it showing back into my Confluence skin
maybe some other things or at least that's all google showed with my name tag from 2017  to freshen my memory 

few bits of code missing for the finish time integration 

python:

import sys
import xbmc
import xbmcaddon
import xbmcgui
import json
#
from datetime import datetime, timedelta, time
#
#
def get_end_time(current_time_finish):
    current_time_finish = datetime.now() + timedelta(seconds=finish_runtime)
    return (current_time_finish)
#

if __name__ == '__main__':
    addon = xbmcaddon.Addon()
#
    remaining_runtime, finish_runtime, total_runtime = 0,0, 0
#
    query = {"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": { "filter": { "field": "title", "operator": "is", "value": "" }, "limits": { "start": 0, "end": 1}, "properties": [ "title", "originaltitle", "playcount", "episode", "episodeguide", "watchedepisodes", "season"], "sort": { "order": "ascending", "method": "label"} }, "id": "libTvShows"}
    query = json.loads(json.dumps(query))
    query['params']['filter']['value'] = sys.listitem.getLabel()
    response = json.loads(xbmc.executeJSONRPC(json.dumps(query)))


        for episode in response['result']['episodes']:
            if episode['playcount'] == 0:
                remaining_runtime += episode['runtime'] / 60
#
                finish_runtime += episode['runtime']
#  
          total_runtime += episode['runtime'] / 60

        remaining_runtime = convert_time(remaining_runtime)
#
        finish_runtime = get_end_time(finish_runtime)
#
        total_runtime = convert_time(total_runtime)


 


pretty sure most of the things I use are no longer running as they were from back in xbmc days and never really got upgraded support 


Kodi Global addons
~~~
context.show.runtime
game.controller.default
game.controller.snes
metadata.album.universal
metadata.anidb.net
metadata.artists.theaudiodb.com
metadata.artists.universal
metadata.common.allmusic.com
metadata.common.fanart.tv
metadata.common.imdb.com
metadata.common.impa.com
metadata.common.movieposterdb.com
metadata.common.musicbrainz.org
metadata.common.ofdb.de
metadata.common.omdbapi.com
metadata.common.port.hu
metadata.common.theaudiodb.com
metadata.common.themoviedb.org
metadata.common.youtubetrailers
metadata.imdb.com
metadata.movie.animenewsnetwork.com
metadata.musicvideos.last.fm
metadata.musicvideos.theaudiodb.com
metadata.themoviedb.org
metadata.themoviedb.org.python
metadata.tvdb.comaddons.txt
metadata.tvshows.animenewsnetwork.com
metadata.tvshows.themoviedb.org
metadata.tvshows.themoviedb.org.python
metadata.universal
packages
plugin.audio.icecast
plugin.image.mypicsdb
plugin.library.node.editor
plugin.video.fantasticc
plugin.video.hubwizard
repository.xbmc.org
resource.images.recordlabels.white
resource.images.studios.white
script.artwork.downloader
script.artworkorganizer
script.cdartmanager
script.common.plugin.cache
script.database.cleaner
script.games.rom.collection.browser
script.module.addon.common
script.module.arrow
script.module.beautifulsoup
script.module.certifi
script.module.chardet
script.module.dateutil
script.module.future
script.module.idna
script.module.mechanize
script.module.requests
script.module.routing
script.module.simplejson
script.module.six
script.module.trakt
script.module.typing_extensions
script.module.urllib3
script.module.urlresolver
script.obd2
script.plex
script.toolbox
script.trakt
script.transmission
script.video.F4mProxy
script.xbmc.audio.mixer
script.xbmc.subtitles
service.library.data.provider
service.rom.collection.browser
service.subtitles.opensubtitles
service.xbmc.versioncheck
skin.confluence
temp
weather.wunderground
~~~

Anime Profile addons 
~~~
animeaddons.txt
context.show.runtime
plugin.audio.di.fm
plugin.video.youtube
screensaver.xbmc.builtin.slideshow
script.artwork.downloader
script.artworkorganizer
script.cdartmanager
script.common.plugin.cache
script.grab.fanart
script.service.xbmal
script.trakt
service.subtitles.opensubtitles
service.xbmc.versioncheck
skin.confluence
skin.estuary
visualization.glspectrum
visualization.projectm
weather.ozweather
weather.wunderground
xbmc.debug
~~~


RE: Library Scan of Movie/Show Runtime Duration - Karellen - 2022-11-27

You have a couple of Banned Add-ons (wiki) in that list. They don't work anyway, but best you delete them, or start a fresh install to clear out all the stale addons.


RE: Library Scan of Movie/Show Runtime Duration - MasterCATZ - 2022-11-27

only reason I never done a fresh install is "skin.confluence" and my "alsa audio passthrough" breaks every time I have tried

I also could not see any on that list ? which ones ?


RE: Library Scan of Movie/Show Runtime Duration - jbinkley60 - 2022-11-27

(2022-11-27, 00:12)MasterCATZ Wrote: Thanks showed up in the season menu , now to work out how to get it to look through it, will see if I can get it working with your hints  

I know I did have some custom menu's at some stage but "Library Node Editor" stopped working a while ago "ModuleNotFoundError: No module named 'unidecode'"
"Library Node Editor was used to alter "Recently Added" subtab settings" and to get it showing back into my Confluence skin
maybe some other things or at least that's all google showed with my name tag from 2017  to freshen my memory 

few bits of code missing for the finish time integration 

Looks like I posted the wrong addon.py file which didn't have all of your changes in it.  I've posted version 1.0.99g now which has the finish time.  If you want to take a crack at the seasons JSON RPC call and filter, as well as the conditional logic for delineating seasons from tvshows, feel free.  Otherwise I'll have time later this week to get to it.


Thanks,

Jeff