script.module.urlresolver development - Printable Version
+- XBMC Community Forum (http://forum.xbmc.org)
+-- Forum: Development (/forumdisplay.php?fid=32)
+--- Forum: Python Add-on Development (/forumdisplay.php?fid=26)
+--- Thread: script.module.urlresolver development (/showthread.php?tid=105707)
- t0mm0 - 2011-09-01 20:55
this url works for me... maybe there was a problem with the site at the time or something?
- t0mm0 - 2011-09-01 21:12
DragonWin Wrote:Hi t0mm0
from what i can tell from the python docs the only difference is that you can't subclass Pickler and Unpickler (which we are not doing). cPickle is a lot faster, but i guess will only be available when using a system python in newer xbmc versions anyway? still if it is a problem i can change it back?
- t0mm0 - 2011-09-01 21:31
DragonWin Wrote:MyContextObject = create_contextmenu(menuname, scriptargs, mode=True/False, [contextobject]):
i'm not sure i understand the mode bit, or what XBMC.Container.Update() is for.
from the docs for xbmcgui, a ListItem has a method addContextMenuItems() which already lets you add context menu items as a list of tuples. couldn't we just add an extra kwarg to the add_item() methods to pass that through to the ListItem? what does the above do that makes it easier?
(i am probably missing something with this a i haven't really played with xbmc context menus before )
- DragonWin - 2011-09-02 08:01
t0mm0 Wrote:this url works for me... maybe there was a problem with the site at the time or something?
hmm strange it still does not work for me. It works when I try it in my browser, but not when I put the link in the t0mm0 test addon.
Guess I'll have to try and look into it another time, I would like to get on with the contextmenu setup.
- DragonWin - 2011-09-02 08:03
t0mm0 Wrote:from what i can tell from the python docs the only difference is that you can't subclass Pickler and Unpickler (which we are not doing). cPickle is a lot faster, but i guess will only be available when using a system python in newer xbmc versions anyway? still if it is a problem i can change it back?
Hmm, I might have been confused about that then, as I were also looking at marshall, json and a few others to see what would give the most options.
Lets leave it in and see if any it there is an issue at all.
- DragonWin - 2011-09-02 08:30
t0mm0 Wrote:i'm not sure i understand the mode bit, or what XBMC.Container.Update() is for.
This function helps create the tuples, let me try and explain
It took me quite a bit of digging to figure this one out, let me see if I can explain myself better. The reason why I opted to put this function in, is because I found quite a few posts when searching on how to do this, from people with similar issue, but no resolution to there problem. With this function they don't need to know about RunPlugin or Container.Update, they just need to know, do I present a new list of items or not (True/False).
mode should properly be called newlist=True/False
Lets say that I want to add 2 context menu's to some movies. The first menu option is "Go to startup screen" which presents the catagories (mode=main), and the second menu option is "Add to favorites", which stays on the same screen (same dir) but just saves the url.
If I used this on both
If I used this on both
So the user would create there menu items and receive the contextmenu obj, which would then be passed to add_item, add_video_item, add_music_item, for each item the menu should be on, and they would have there menu up and running.
It was purely thought of as a way for the addon coder to have an easy way to add/del favorites, and also a fast way to jump to favorites. If they want to do more elaborate stuff they would have to mix in there own tuples and pass that to add_item etc.
t0mm0 Wrote:(i am probably missing something with this a i haven't really played with xbmc context menus before )
Hehe as I said took me quite a bit of digging around, and I made my post early in the morning before work, I might not have been fully awake ;-)
I hope this explanation is a bit better, sorry if my first post were a bit confusing
- DragonWin - 2011-09-02 09:45
I have been messing a bit around with it now, from the addon creators point of view, it would look some thing like this:
Create my 2 menu's and add them.
of cause in the 2nd arg you can always add more info like url to save, what to do on loading it again etc.
End result: Save Favorite hits mode=favorite, but stays on the current screen, and Go to Main screen resets the list, and shows the mode=main initial directory.
- t0mm0 - 2011-09-02 20:00
DragonWin Wrote:Hi t0mm0
ah yeah i think i understand what you mean now! sorry for being a bit slow
looks good to me so far - more building blocks for favourites....
- DragonWin - 2011-09-02 20:54
I have been busy today
I have been able to create the "add favorite", and also to show them, and play them. Only movie links so far, I have not tested directories yet. It still needs a lot of work, but it's starting to look like some thing.
As it's not possible to call a module function directly, the user has to create 3 modes in the addon: savefavorite, deletefavorite, showfavorites
So far when they want to add the "Add favorite" context they then call this. I'll explain the tuple more when I have decided on a structure, but callback 'play' means add_item, it could also be a mode that is to be called.
To display the favorites
I hope this can be a useful addition to common.addon, if nothing else shown a way Not to do it
I'll give it some more attention tomorrow, right now dinner is almost done ;-)
Ps. I'm prob. going to need you to make the code more sturdy, and clean it up, like you did with the other commit, I hope you don't mind.
- t0mm0 - 2011-09-02 22:39
DragonWin Wrote:Hey t0mm0,cool - looks like it's coming on nicely!
think i will get a chance to write some more code myself too this weekend.
DragonWin Wrote:Ps. I'm prob. going to need you to make the code more sturdy, and clean it up, like you did with the other commit, I hope you don't mind.
i'm happy to take a look when you're ready (but of course i may just make it worse )