PDA

View Full Version : How to use label2 and own context menus for listitems in video plugin


doze
2008-11-03, 15:35
Hi,

I'm creating this video plug-in and currently I have set the listitem info type to "Video", so that I get the label2 and sortings working. But I would like to do my own context menu selections for my list items and not to show the ones that are there by default for video type of items. Is that possible? more like setcontextmenuitems() in place of addcontextmenuitem()

Or is there any "Custom" list item type what I could use and have the label2 visible, some sorting types and an empty context menu for me to fill my self?

Nuka1195
2008-11-04, 00:33
no, the default items will always show.

maybe it might be a nice option to have. can you give a good argument for only wanting your items.

doze
2008-11-04, 13:55
Ok, here's the issues that I have been having with video plugins (sorry for the lengthy post, bare with me). I have posted some of these in different posts already, but I'd like to iterate them now that I got your attention. :) Please correct me if I have gotten something wrong, because this is the first plugin that I am doing to XBMC and first time that I use Python too. I have been creating a video plugin to use XBMC as a IPTV receiver for the service that is offered by my ISP. The video plugin parses the HTML portal that they offer and creates views to XBMC.

1. Issue with context menu

The video plugin has these features (first level describes the views, second it's context menus):

list recordings

information (opens a dialog showing information about selected item)
rename recording / folder
move recording / folder
delete recording / folder
create folder
settings (opens plugin settings, not working..)

list scheduled recordings

information
delete schedule
make recurring schedule
settings

view live tv

information
settings

view epg

information
record program
make recurring schedule
settings



So you can see that there's many context menu items for example in recordings view. If I add them to the existing ones, the context menu becomes huge. Also I don't really need / want the default movie context items there to clutter the UI of my plugin. Specifically, I don't need atleast these: switch media, go to root, (video) settings, manually add to library, movie information (doesn't work in my case).

So it would be good if there would be an option where we could set the context menu items by our self and add (some of the) default ones too if we like.

2. Label 2 / Label 3 (?) / Sorting issue

I am forced to use a specific media type if I want to get label 2 showing with sorting. So I have decided to use the Video type, as it is closest to what I'm listing in my virtual folders. But when doing this, I am forced to use the existing info fields. I have the following info that I'd like to display for the items (and be able to sort by):

For recordings:

date & time (weekday dd.mm.yyyy hh:ss)

I cannot use the date field that video types have, because it does not support time

Runtime duration

Works ok with the existing duration field

Channel where program aired

No field for this, I have chosen to use the Genre field, see below.

Title

Works ok with the existing title field

Plot

Works ok with the existing plot field, kind of. But I have chosen to use the Genre field, see below.

Size

Works ok with the existing size field



So basically what I'm missing is the "datetime" type of field. Also, I would like to have an option where I could say that what text is shown in the list as the label 3 (?) what is currently the contents of Genre field. What I'd like to show in the list are the title, channel, plot and datetime at the same time for the items. So I have put the datetime to the Studio field (as it can be just string) and channel + plot to the Genre field as they are shown in the Label 3. You can see the result from the picture below. But as I said, if there would be a "custom" list type item where we could define our own context menus, label 3 field (I'd use channel + plot) and a datetime field would be added, the first and second issues would be ok.

http://img145.imageshack.us/img145/1787/recordingsox4.th.jpg (http://img145.imageshack.us/my.php?image=recordingsox4.jpg)http://img145.imageshack.us/images/thpix.gif (http://g.imageshack.us/thpix.php)

3. Not able to control where ".." item goes from a virtual folder

When doing the EPG "view", I have done it like this:

(These are all virtual folders that points back to my plugin with url parameters)
EPG
|
|-Channel 1
| |
| |-Next day (virtual folder that creates next day's program listing)
| |-Previous day (same as above but for previous day)
| |-Program 1
| |-Program 2
| |- .........
|
|-Channel 2
|-.........

So if I go to view the programs from Channel 1 and select the next day for couple times and / or go back to previous day, when I want to come back to the channel listing, I need to, of course, select back (..) multiple times as I have been going through multiple virtual folders and it steps all them back one by one.

What I'd like to do is any of these:
* To be able to say how many folders back the ".." should go eg. same as javascript:history.go(-n) for internet browsers. I can easily count in my plugin how many steps it needs to go back.
* To be able to set the url for the ".." item temporarily, so that it would always return to the channel listing when browsing programs.
* To be able to temporarily disable the system that tracks where ".." should go from a virtual folder and it would use the latest know position.

4. Programmatically open plugin settings

I'd like to open the plugin settings automatically on first run, because users need to setup their accounts for the IPTV service before they can run the plugin. Now I have just made it to show a dialog that says this and they need to find out a way to open the plugin settings by them self. But I'd also like to do a item to my main virtual folder what could be used to open the plugin settings. This would give better usability to my plugin for not so techy users. But as far as I know, there's no way to open plugin settings programmatically.

That's it for the issues for now.. :) I know that I could solve all these by implementing this as a Script instead of a Plugin, but I really don't like to do the UI and skins.. Video plugins are a great way of doing this kind of things, the framework is just a little bit too rigid currently.

Any thoughts?

Nuka1195
2008-11-04, 15:47
1. agree may be nice. i have an idea on how to make that work. a very simple way so i'll discuss with a developer.

2. i think all the sort items are taken. the code would need updating to add new ones, not a simple task. but custom sort methods would be nice.

3. in the endOfDirectory() call, play with the updateListing=True/False and see if that works for you

4. not sure if it's worth having or not.

doze
2008-11-04, 16:53
1. agree may be nice. i have an idea on how to make that work. a very simple way so i'll discuss with a developer.
Great, looking forward to it!

2. i think all the sort items are taken. the code would need updating to add new ones, not a simple task. but custom sort methods would be nice.
Yes, would be great. I did another video plugin today that accesses the Yle Areena (Finnish TV portal) and I would need datetime field there also. There can be several videos for the same day but with different times, so no way to sort them (other than using the Studio field or something that can be string, but then you also need to use fixed date format, so that the month is first).

Do you have any comments to the point that developers could define what info is shown as the label 3 (under the title, it's Genre at least in PMIII skin). Or does skin developers choose what they want? How does that work?

3. in the endOfDirectory() call, play with the updateListing=True/False and see if that works for you
That actually worked very nicely, thanks alot! Did just what I wanted (disabled the system what follows where ".." goes, now it goes back to the last known folder). Great!

4. not sure if it's worth having or not.
Hmm.. why not? what it would hurt to have this possibility? :) Sounds like an easy thing to implement.. And if context menus can be overridden, plugin settings will disappear from there.. although it can be added back from the default ones if developer want's so. But still, why wouldn't it be good to have it as a public function to open the plugin settings dialog?