Kodi Community Forum
Add keyboard shortcut for refresh current listing - 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: Add keyboard shortcut for refresh current listing (/showthread.php?tid=367814)



Add keyboard shortcut for refresh current listing - kevn57 - 2022-04-09

Right now I hit I for info then scroll over to the refresh key, I'd love to just have a keyboard shortcut that opens the refresh listing.

Does anyone have an idea on how to add a shortcut key, I already tried

<b>Refresh</b>

<b>Container.Refresh</b>

but I couldn't get it to work


RE: Add keyboard shortcut for refresh current listing - Klojum - 2022-04-09

How about refreshing the whole skin? Not sure if it will stick to the same page your on, or that you can target specific objects.
xml:
<keymap>
<global>
<keyboard>
<F5>ReloadSkin()</F5>
</keyboard>
</global>
</keymap>



RE: Add keyboard shortcut for refresh current listing - kevn57 - 2022-04-09

Thanks but that's not really what I was looking for. The reason I want the shortcut is I often want to update the video library by rereading the nfo file after I make changes. Right now I have to hit I for the info screen then click on the refresh button, then I get an option to refresh from local nfo or from the internet.


RE: Add keyboard shortcut for refresh current listing - Klojum - 2022-04-09

Refreshing a listing will not refresh all movies/tvshows/episodes in a listing. There is no such global function.
Also, when refreshing a listing of movies/tvshows, you will loose all watched statuses and resume states in your library. There are workarounds for that, but by default, you will lose those settings.


RE: Add keyboard shortcut for refresh current listing - kevn57 - 2022-04-09

I don't want it to refresh all movies.

When you hit i on a movie playlist an info screen appears, where you can refresh the info, choose art, set your rating etc. on the movie that is selected

I want to refresh the videodb from my movie nfo file after I make changes to that movies nfo file. It would be great if I could do that with a keyboard shortcut.


RE: Add keyboard shortcut for refresh current listing - kevn57 - 2022-04-09

I just figured out a way but not sure if it's the best way or not

added <b>SendClick(6)</b> to keyboard.xml

1. tap i for the info screen
2. tap b to refresh

this works just fine, but is there a way to make it just one shortcut key?


RE: Add keyboard shortcut for refresh current listing - Klojum - 2022-04-09

(2022-04-09, 21:13)kevn57 Wrote: I don't want it to refresh all movies.

Okay, my bad. Since you mentioned 'refreshing the listing' I thought you meant all entries.
A shortcut option is not readily available AFAICT, but perhaps some clever person has an alternate solution.


RE: Add keyboard shortcut for refresh current listing - scott967 - 2022-04-16

I suggest a script addon that uses the JSON refresh methods.  Try this:
python:
try:
    import simplejson as json
except ImportError:
    import json
import xbmc
import xbmcgui
dialog = xbmcgui.Dialog()
if xbmc.getInfoLabel('ListItem.DBType') in ['movie', 'episode', 'musicvideo', 'tvshow']:
    refreshtype = xbmc.getInfoLabel('ListItem.DBType')
    dbid = int(xbmc.getInfoLabel('ListItem.DBID'))
    json_call = ('{{"jsonrpc": "2.0", '
                    '"method": "VideoLibrary.Refresh{0}", '
                    '"params" : {{"{0}id": {1}, "ignorenfo": false}}, '
                    '"id": 1}}'.format(refreshtype, dbid))
    json_result = xbmc.executeJSONRPC(json_call)
    json_result = json.loads(json_result)
    if  ('result', 'OK') in json_result.items():
        dialog.notification('{} refresh'.format(refreshtype), 'success', xbmcgui.NOTIFICATION_INFO, 2000)
    else:
        dialog.notification('{} refresh'.format(refreshtype), 'fail', xbmcgui.NOTIFICATION_WARNING, 2000)
else:
    dialog.notification('refresh', 'fail -- must use on a video list item', xbmcgui.NOTIFICATION_WARNING, 2000)

create a folder script.refreshvideo
save this file as default.py
then create an addon.xml file as
xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.refreshvideo" name="Refresh a video from nfo file" version="0.0.1" provider-name="scott967">
    <requires>
        <import addon="xbmc.python" version="3.0.0"/>
        <import addon="xbmc.json" version="12.0.0"/>
        <import addon="script.module.simplejson" version="3.17.0+matrix.2"/>
    </requires>
    <extension point="xbmc.python.script" library="default.py">
        <provides>executable</provides>
    </extension>
    <extension point="xbmc.addon.metadata">
        <summary lang="en">Refresh video info script</summary>
        <description lang="en">Script to refresh video library items from nfo files.  Bind to key as builtin Runscript(script.refreshvideo).</description>
        <platform>all</platform>
        <license>GNU GENERAL PUBLIC LICENSE. Version 2, June 1991</license>
        <website></website>
        <source></source>
        <forum></forum>
        <email></email>
    </extension>
</addon>

With those 2 files, zip up the folder and install addon from zip in Kodi.  Add a keymap to run builtin
 
Code:
RunScript(script.refreshvideo)

Focus a video in a library container view and use the assigned key.

scott s.
.


RE: Add keyboard shortcut for refresh current listing - kevn57 - 2022-05-02

Thank you so much for this Scott, I'll give it a try.