Library mode for Plugin/addon
#1
Hi,

Is there anyway to activate a library view for plugins rather than file view. I'd like to be able to display more infor about the file on screen, rather than having to use the contect menus.

I did find a small write up in the "HOW TO" for plugin installation, but unless i'm doing something wrong I think that's out of date now:

http://wiki.xbmc.org/?title=HOW-TO_insta...ns_in_XBMC
Reply
#2
Have you tried looking at plugins like Apple Movie Trailer Lite Plugin ( http://xbmc-addons.googlecode.com/svn/pa...addons.zip ) ?

Also please read this document for up to date information regarding addon development: http://trac.xbmc.org/raw-attachment/tick...JMEDIT.odt
The normal XBMC log IS NOT a debug log, to enable debug logging you must toggle it on under XBMC Settings - System or in advancedsettings.xml. Use XBMC Debug Log Addon to retrieve it.
Reply
#3
Maybe have a look at Container.SetViewMode(id) from http://wiki.xbmc.org/?title=List_of_Built_In_Functions.
Reply
#4
In your addon if you specify the type of content you should have any of the library viewtypes your skin makes available for that type of content.
Reply
#5
I dont this by specifying the view id and then only makeing that view available when a certain addon is present.

Code:
<visible>substring(container.folderpath,plugin://plugin.video.xbmcflicks)</visible>

Code:
<onclick>XBMC.ActivateWindow(Programs,Addons,Container.SetViewMode(56),return)</onclick>
Image
To learn more, click here.
Reply
#6
aaronb Wrote:In your addon if you specify the type of content you should have any of the library viewtypes your skin makes available for that type of content.

Ah-ha... I was setting the content type to videos and could only see a few options (list and thumbs). Setting it to movies has given me in the extra ones (such as media info 2, which is what I was after)..

Thanks
Reply
#7
I got more interested in doing this now that my plugin will provide actual movie and tvshow scraper data. So I hacked together code to put my plugin into library mode when a user first goes into my plugin and then put them back where they were before when they back out.

I had to do hacky stuff with getInfoLabel's because my plugin's endOfDirectory must return succeeded=True otherwise the error dialog will appear. So my initial index is actually run even though I switch to library mode with ActivateWindow and try to end the plugin. Thus the need to keep track of what the previous window was when backing out. Would love to know a better way to deal with this.

Code:
xbmcplugin.setContent(int(sys.argv[1]), 'movies')

....

Code:
# addon_path is this plugins path. i.e. plugin://plugin.video.myplugin/
def switchToLibraryMode(addon_path):
    # are we in library mode yet?
    if xbmc.getCondVisibility("[Window.IsActive(videolibrary)]") == 0:
        # on first call the Container.FolderPath will contain the previous windows path. i.e. addons://sources/video/
        # on second call it will contain this plugins id path. i.e. plugin://plugin.video.myplugin/
        container_folder_path = xbmc.getInfoLabel('Container.FolderPath')
        if not addon_path in container_folder_path:
            # first time in so switch to library mode.
            # save previous folder path for when user backs out of our plugin
            __settings__.setSetting('previous_folder_path', container_folder_path)
            doLog("SWITCHING TO LIBRARY MODE")
            xbmc.executebuiltin("XBMC.ActivateWindow(VideoLibrary,%s,return)" % addon_path)
        else:
            # user trying to back out of our plugin so return to previous window
            xbmc.executebuiltin("Container.Update(%s,replace)" % __settings__.getSetting('previous_folder_path'))

        # do not cacheToDisc cuz we want this code rerun
        xbmcplugin.endOfDirectory( myhandle, succeeded=True, updateListing=False, cacheToDisc=False )
    else:
        doLog("ALREADY IN LIBRARY MODE")
        # continue about our way

I call switchToLibraryMode the first time into my plugin (when displaying the first index). i.e.
Code:
if mode==None or url==None or len(url)<1:
    showBaseIndex()

Code:
ADDON_ID = 'plugin.video.greader.ddl.video'

def showBaseIndex():
    switchToLibraryMode('plugin://%s/' % ADDON_ID)

    #....rest of my showBaseIndex() code
Reply
#8
Cheers - looks good and the sort of thing that might stop novice users complaining that they can't see x/y/z......

I'll have a test over the weekend, but have you seen whether this will activate a library view even on systems that don't have a library (i.e. there is no scanned media). At the moment I have to scan in a dummy 0 byte file to activate library..
Reply
#9
hippojay Wrote:Cheers - looks good and the sort of thing that might stop novice users complaining that they can't see x/y/z......

I'll have a test over the weekend, but have you seen whether this will activate a library view even on systems that don't have a library (i.e. there is no scanned media). At the moment I have to scan in a dummy 0 byte file to activate library..

you don't need to have a library scanned. the way I set it in the addon worked without scanning anything in.
Reply
#10
harley hooligan; care to share?
Reply
#11
Turns out I was wrong. Though I had it working, but not so much
Reply
#12
Given that I'm removing files mode completely, this whole issue will go away.

Ofcourse, that's not a solution for the current stable release, but IMO you should just rely on skinners responding to the Container.Content(movies) etc. and providing the necessary views by default. I believe Confluence does this just fine, right?

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
#13
the removing of files mode is possibly the only feature removal in any app i've ever been excited about.
Reply
#14
Heh - I guess it's not really removed, rather moved. I'll probably "accidentally" drop a couple of features on the way though, and hope noone notices :p

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

Logout Mark Read Team Forum Stats Members Help
Library mode for Plugin/addon0