So little information and incomplete tutorials
#1
I want to write a simple script and I’m unable. I find the information very little. I have a background in programming and spent the entire day reading the forum, the xbmc wiki and the two tutorials and I am unable to advance even one step. Very frustrating.

To make this easy, how can I add an entry to the context menu?
Just imagine a simple addition on the context menu in file view.

I need a complete script, I have found the addContextMenuItems() but I am unable to use it.
Reply
#2
You can't. You can only add context menu items for a particular plugin that you write (eg if you wrote a plugin for youtube, you could add a particular item to the context menu that only appeared when the user was listing your youtube plugin).

If you actually want to write a plugin then there is a new tutorial written - it's available on trac - take a search through the tickets there.

Cheers,
Jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#3
Oh that's too bad. No I don't want to write a plugin.

I wanted to add an entry to the context menu of the main XBMC available on all files of any kind. This entry would rename the file name and add a .seen extension to the end of the currently selected file.

Someone told me I could do it with scripts, so you say that I can't do it? Sad
Reply
#4
why not used the built-in mark as watched functionality?
Reply
#5
Zodler Wrote:Oh that's too bad. No I don't want to write a plugin.

I wanted to add an entry to the context menu of the main XBMC available on all files of any kind. This entry would rename the file name and add a .seen extension to the end of the currently selected file.

Someone told me I could do it with scripts, so you say that I can't do it? Sad

I'm pretty sure I said it could be done with an add-on / plugin.
Reply
#6
So it can be done? Then great. So please I ask again my first post. Please help how to do it.
Reply
#7
That the problem with open source projects, people are really busy since they are doing that on their spare time and sometimes documentation is not up to date.
My advice to you is to look a example of code. You have plenty of good one in google code.

Zodler Wrote:So it can be done? Then great. So please I ask again my first post. Please help how to do it.
You cannot do it directly but it is possible, except you have to implement it yourselft.
You can create you own context menu, the nice thing with a script is you can do almost everything, but of course it is more more than with a plugin.

A simple way of doing it would be to create a windows with a simple list on it and react on the click event on the item of the list.
You can do either with WindowXML (the nicest way), you can find a class and an XML in the installer Passion XBMC:
- Here is the python code: http://code.google.com/p/passion-xbmc/so...extMenu.py
- The XML: http://passion-xbmc.googlecode.com/svn/t...xtMenu.xml
- and an example how to use it (search for _show_context_menu): http://passion-xbmc.googlecode.com/svn/t...agerGui.py

That's a way, but it could be a little bit complicated for what you need, another way is to do with the old Window API (without XML), here is an example (look at DropDownMenu): http://passion-xbmc.googlecode.com/svn/o...default.py
It will look like that: http://passion-xbmc.org/gallery/3/23_10_...7_17_0.jpg

Forgive the code, it was one of my first script (but it was fun! Big Grin). It is not exactly a context menu but a Drop Down Menu, but the concept is very similar (we go left to right instead of up to down).
Image
_____________________________

Repositories Installer: select and install unofficial repositories / TAC.TV: watch videos on TAC.TV
Installer Passion-XBMC: Download and Install Add-ons (pre-Dharma only)

Image
Reply
#8
This is all too difficult. So I finally did it as an external player that calls a batch file like this:
type NUL >"%~dpn1.seen"
del "%~f1"

My problem is that XBMC asks to click OK when playback is finished. Also it doesn't refresh its menu, so XBMC doesn't know that the item has been deleted.
Reply
#9
Zodler Wrote:This is all too difficult. So I finally did it as an external player that calls a batch file like this:
type NUL >"%~dpn1.seen"
del "%~f1"

My problem is that XBMC asks to click OK when playback is finished. Also it doesn't refresh its menu, so XBMC doesn't know that the item has been deleted.

It is not so difficult, what you are doing know will probably make it more difficult to debug.
You do not need to use a debugger in order to develop a script/plugin (addon) for xbmc, some print (logs) are usually enough.

Concerning your context menu, what you could do is to modify the skin in order to add a shortcut to your script and in your script you run what you want.
Image
_____________________________

Repositories Installer: select and install unofficial repositories / TAC.TV: watch videos on TAC.TV
Installer Passion-XBMC: Download and Install Add-ons (pre-Dharma only)

Image
Reply
#10
Ok, thank you for the hint. I will go into the skin forum and have a look around.
Reply
#11
It was done recently for TVTune with changes in the skin Night I believe, and some time ago for XBMC subtitle before it was integrated to confluence.
Look at this thread, you should find some valuable information showing how to modify the skin: http://forum.xbmc.org/showthread.php?tid=56083
Image
_____________________________

Repositories Installer: select and install unofficial repositories / TAC.TV: watch videos on TAC.TV
Installer Passion-XBMC: Download and Install Add-ons (pre-Dharma only)

Image
Reply
#12
Example of what was done in a skin for TVTUne:

add to custom_SkinSetting:

PHP Code:
<control type="radiobutton" id="1051">
                        <
width>750</width>
                        <
height>40</height>
                        <
font>font13</font>
                        <
label>31553</label>
                        <
textcolor>grey2</textcolor>
                        <
focusedcolor>white</focusedcolor>
                        <
texturefocus>MenuItemFO.png</texturefocus>
                        <
texturenofocus>MenuItemNF.png</texturenofocus>
                        <
onclick>Skin.ToggleSetting(TVTunes)</onclick>
                        <
selected>Skin.HasSetting(TVTunes)</selected>
                    </
control

And to MyvideoNav in order to activate or not the use of TVTUNE
PHP Code:
<control type="button" id="9999">
            <
description>trigger</description>
            <
onfocus>XBMC.RunScript(script.TvTunes,backend=True&amploop=False)</onfocus>
            <
onfocus>SetFocus(50)</onfocus>
            <
texturenofocus>-</texturenofocus>
            <
texturefocus>-</texturefocus>
        <
visible>Skin.HasSetting(TVTunes)</visible>
        </
control
Image
_____________________________

Repositories Installer: select and install unofficial repositories / TAC.TV: watch videos on TAC.TV
Installer Passion-XBMC: Download and Install Add-ons (pre-Dharma only)

Image
Reply
#13
Ok I read the skin forum and I saw in several threads, including this
http://forum.xbmc.org/showpost.php?p=655702&postcount=2

That this is impossible through skinning. I read that the only way to do it is to modify the source files and compile yourself.

So I guess I will go the external player route which is the simplest and cleanest way to do it as I see.
Reply

Logout Mark Read Team Forum Stats Members Help
So little information and incomplete tutorials0