Kodi Community Forum

Full Version: Shortcut creating bookmarks?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
How can I create a shortcut for bookmarks (or go to top / bottom etc. of the files lists)? Or is there an add on the let's you easily create / edit bookmarks?
Bring up the contextual menu (c on a keyboard. I think "menu" on some remotes) and select "add to favorites".
Thank you, Ned,

Sorry, I am not quite sure, how can I set a bookmark that way or go up / down?
What do you mean by "bookmark" and "top / bottom etc. of the file lists"? Please explain the scenario of what you're trying to do in detail. Thanks.
Well, the option in XBMC to remember / save a position on a video / DVD so you can jump to directly to another time, when you continue watching this video.

When you open "Videos" in XBMC, then click "Files" you will come - if you have set the paths accordingly before, if I see right - to one or more folders, you can store e.g. videos in, the content of such a folder is shown as a file list, so you can see, what you have stored in these folders. The top of a file list, is where the first file of a list is shown, so if you have sorted alphabetically on top of the list will be file names starting with a number or "A". And vice versa, the bottom of a files list, at its end showing files with e.g. "Z" starting.

E.g. I would like to create a bookmark, e.g. while watching a video by a shortcut, instead of doing it with the mouse (clicking on the symbol near the "Speaker" icon at the bottom on the right side on the screen), so press a key or more (shortcut) and create a bookmark by doing this

In the file lists I would like to get to the bottom or top of the list by pressing a key or more (shortcut), instead of scrolling with the mouse or click the scroll bars. In many programs you can use the key "Pos" (the key "7") to get to the top or "Down" (key "1") to the bottom or the arrow keys.
OK, if I understand you correctly, you have two different requirements:
  • A keyboard shortcut to access video bookmarks
  • A keyboard shortcut to more quickly navigate a list of files
Keyboard shortcut to access video bookmarks: Create a keyboard.xml (wiki) file in your userdata (wiki)/keymaps/ directory with the following contents:
Code:
<keymap>
  <FullscreenVideo>
    <keyboard>
      <some-key>ActivateWindow(VideoBookmarks)</some-key>
    </keyboard>
  </FullscreenVideo>
  <VideoOSD>
    <keyboard>
      <some-key>ActivateWindow(VideoBookmarks)</some-key>
    </keyboard>
  </VideoOSD>
</keymap>
(EDIT 01-24-2013: Corrected errors in sample code above)
While wathcing a video, press the assigned key and the Bookmarks window will pop-up. Click the "Create Bookmark" button and the current playback position is bookmarked. If you have existing bookmarks, click the desired one and playback will go to that previously saved position. Obviously, replace <some-key> with the name of your desired key (one that isn't currently being used for an existing XBMC function).

Keyboard shortcut to more quickly navigate a list of files: Press the END key to go to the bottom of a list of items; press HOME key to return to the top of the list. Press PGDN (Page Down) to scroll down to the next page of items in the list; press PGUP (PageUp) to go up one page. Press SHIFT+(A-Z) to go to the first item in the list that begins with the selected letter of the alphabet (e.g., Shift+C goes to the first item that begins with "C").

Many thanks, artrafael.

I cannot get it to work, I have now keyboard.xml here: C:\Users\Dirk\AppData\Roaming\XBMC\userdata\keyboard.xml

With this code:

Code:
<keymap>
  <keyboard>
    <FullscreenVideo>
      <b>ActivateWindow(VideoBookmarks)</b>
    </FullscreenVideo>
    <VideoOSD>
      <b>ActivateWindow(VideoBookmarks)</b>
    </VideoOSD>
  </keyboard>
</keymap>

Is it possible to create a shortcut which creates a bookmark without opening a menu, so just to press "b" and the bookmark is created? And jumping to the last bookmark in the movie, is it possible to create one that can do it?

Quote:Keyboard shortcut to more quickly navigate a list of files: Press the END key to go to the bottom of a list of items; press HOME key to return to the top of the list. Press PGDN (Page Down) to scroll down to the next page of items in the list; press PGUP (PageUp) to go up one page
These keys do not work for me, the others.

Quote: Press SHIFT+(A-Z) to go to the first item in the list that begins with the select letter of the alphabet (e.g., Shift+C goes to the first item that begins with "C").
They work.

Many thanks again.
To set a bookmark with one key you can use a script like this I found in the forums:

Code:
import xbmc, xbmcgui

xbmc.executebuiltin('xbmc.ActivateWindow(videobookmarks)')
xbmc.executebuiltin('SendClick(10125,2)')
xbmc.executebuiltin('xbmc.action(previousmenu)')

Save the script as "setbookmark.py" and edit your keyboard.xml

<b>RunScript(/PATH/TO/SCRIPT/setbookmark.py)</b>

To go to the top/bottom of a list use FirstPage and LastPage and map them to a key of your choice

e.g

<f1>FirstPage</f1> and <f2>LastPage</f2>

That should do what you want.

Be sure your file is really named keyboard.xml rather than keyboard.xml.txt (choose the option to show file extension in your OS file manager).

You can also enable debug log (wiki)ging in XBMC, press the "b" button several times while watching a video, exit XBMC and then examine your debug log (wiki) (xbmc.log) to see what action, if any, XBMC performed in response to your key presses. This will help diagnose why the key mapping doesn't work. Do likewise for the Home, End, PgUp, and PgDn key presses (however, these keys should have been working out-of-the-box).
Thank you zepo,

Quote:Save the script as "setbookmark.py"
I did, saved here: C:\Users\Dirk\AppData\Roaming\XBMC\userdata\keyboard.xml

My keyboard.xml now looks:

Code:
<b>RunScript(/PATH/TO/SCRIPT/setbookmark.py)</b>
<keymap>
  <keyboard>
    <FullscreenVideo>
      <b>ActivateWindow(VideoBookmarks)</b>
    </FullscreenVideo>
    <VideoOSD>
      <b>ActivateWindow(VideoBookmarks)</b>
    </VideoOSD>
  </keyboard>
</keymap>

It doesn't work.

Quote:Be sure your file is really named keyboard.xml rather than keyboard.xml.txt (choose the option to show file extension in your OS file manager).
Yes, all like it should be.

Quote:You can also enable debug logging in XBMC, press the "b" button several times while watching a video, exit XBMC and then examine your debug log (xbmc.log) to see what action, if any, XBMC performed in response to your key presses. This will help diagnose why the key mapping doesn't work.
OK, may be we can find out then also, why deleting in the file lists does not work properly (when you after watching a video want to delete the video you first has to open another video, then go back to the video before and delete it).
(2013-01-22, 20:06)Dirki Wrote: [ -> ]My keyboard.xml now looks:

Code:
<b>RunScript(/PATH/TO/SCRIPT/setbookmark.py)</b>
<keymap>
  <keyboard>
    <FullscreenVideo>
      <b>ActivateWindow(VideoBookmarks)</b>
    </FullscreenVideo>
    <VideoOSD>
      <b>ActivateWindow(VideoBookmarks)</b>
    </VideoOSD>
  </keyboard>
</keymap>

It doesn't work

That is incorrect. The statement posted by zepo needs to replace the ones in my previous example:
Code:
<keymap>
  <FullscreenVideo>
    <keyboard>
      <b>RunScript(/PATH/TO/SCRIPT/setbookmark.py)</b>
    </keyboard>
  </FullscreenVideo>
  <VideoOSD>
    <keyboard>
      <b>RunScript(/PATH/TO/SCRIPT/setbookmark.py)</b>
    </keyboard>
  </VideoOSD>
</keymap>
(EDIT 01-24-2103: Corrected errors in sample code above)
Also, I'm assuming you are using the *actual* path to your script and not the literal term "/PATH/TO/SCRIPT/"?
I recommend trying it with my original keyboard.xml and looking in your debug log for the problem first. Once you get this working, then add in the script by zepo.
I am not suprised it is not working.
For starters the keyboard.xml should be inside a folder called keymaps not directly in the userdata folder.

You must also replace "/PATH/TO/SCRIPT/" with the path to the script on your drive.


e.g
If you put the script inside your userdata folder. The path will be:
C:\Users\Dirk\AppData\Roaming\XBMC\userdata\setbookmark.py

Then replace <b>ActivateWindow(VideoBookmarks)</b> with <b>RunScript(C:\Users\Dirk\AppData\Roaming\XBMC\userdata\setbookmark.py)</b>

It must be under fullscreenvideo in the keyboard.xml. You should read a bit about keymapping, it will make it easier for you.
Quote:Also, I'm assuming you are using the *actual* path to your script and not the literal term "/PATH/TO/SCRIPT/"?
Ah, sorry, stupid...

Quote:I recommend trying it with my original keyboard.xml and looking in your debug log for the problem first. Once you get this working, then add in the script by zepo.
Yes, OK.

Quote:For starters the keyboard.xml should be inside a folder called keymaps not directly in the userdata folder.
But there already is the default XBMC keyboard.xml, or am I wrong?

Quote:If you put the script inside your userdata folder. The path will be:
C:\Users\Dirk\AppData\Roaming\XBMC\userdata\setbookmark.py
Thank you, I have changed that.

Quote:Then replace <b>ActivateWindow(VideoBookmarks)</b> with <b>RunScript(C:\Users\Dirk\AppData\Roaming\XBMC\userdata\setbookmark.py)</b>
Thanks to artrafael it is done.

Quote:It must be under fullscreenvideo in the keyboard.xml. You should read a bit about keymapping, it will make it easier for you.
OK, I understand.

I didn't get it to work, so I will try to use the debug mode...
As zepo said, your custom keyboard.xml file needs to go in the keymaps subfolder of your userdata (wiki) folder; otherwise, it won't get read. If you already have a custom keyboard.xml there, then just add the relevant statements to the appropriate sections of the file. Read this wiki article before proceeding: keyboard.xml (wiki)
Sorry again for the senseless doing.

Now it should be right:

The artrafael's keyboard.xml:
C:\Users\Dirk\AppData\Roaming\XBMC\userdata\keymaps\keyboard.xml
Content:

Code:
<keymap>
  <keyboard>
    <FullscreenVideo>
      <b>ActivateWindow(VideoBookmarks)</b>
    </FullscreenVideo>
    <VideoOSD>
      <b>ActivateWindow(VideoBookmarks)</b>
    </VideoOSD>
  </keyboard>
</keymap>

Zepo's keyboard.xml (renamed to test artrafael's keyboard.xml)
C:\Users\Dirk\AppData\Roaming\XBMC\userdata\keymaps\keyboard.xml zepo

Content:

Code:
<keymap>
  <keyboard>
    <FullscreenVideo>
      <b>RunScript(C:\Users\Dirk\AppData\Roaming\XBMC\userdata\setbookmark.py)</b>
    </FullscreenVideo>
    <VideoOSD>
      <b>RunScript(C:\Users\Dirk\AppData\Roaming\XBMC\userdata\setbookmark.py)</b>
    </VideoOSD>
  </keyboard>
</keymap>

zepo's py file:
C:\Users\Dirk\AppData\Roaming\XBMC\userdata\setbookmark.py

Content:
Code:
import xbmc, xbmcgui

xbmc.executebuiltin('xbmc.ActivateWindow(videobookmarks)')
xbmc.executebuiltin('SendClick(10125,2)')
xbmc.executebuiltin('xbmc.action(previousmenu)')

I could not get it working, so I will XBMC do a debug (if all I did is correct now)

Pages: 1 2