Changes to paths: What it means for scripts and plugins

Posted By: Team XBMC on Feb 10, 2009 in Site News

As a follow up to my last post, scripters and plugin writers should be aware of the best practises for accessing files under python:

1.  Don’t use the old Q:, P:, T:, U:, Z: paths. Replace these with their special:// counterparts below.

2.  Use xbmc.translatePath() to translate any path to it’s true path if/when you need to read or write from the filesystem.

Note that xbmc.translatePath() will take care of number 1 for you in the meantime, but this functionality is not guaranteed to be available forever.

So what should you use?

1.  Use special://home/ if you need to read or write to the writeable version of the xbmc install folder.

2.  Use special://profile/ if you need to read or write to the current users userdata folder.

3.  Use special://temp/ if you need to read or write to a temporary location.

If you absolutely have to, you can also:

4.  Use special://xbmc/ to read from the xbmc install folder itself.

5.  Use special://masterprofile/ to read from the master users’ userdata folder.

These should not be needed by the majority of scripts, however, so if you find yourself needing to do either of 4 or 5, please contact me so that I know why, and can see whether there’s a better way to do things.

Share on reddit
Share on StumbleUpon


Discussion - 9 Comments

  • Scott Feb 14, 2009 

    I Think Apple Movie Trailers will use special://masterprofile/ as it shares the .cache folder among users. This use to be T:\\.

    Only the DB is per user. special://profile/

  • jmarshall Feb 14, 2009 

    That makes alot of sense Scott – good call. Anything shared across all users by a script (cache files as you point out) should certainly be kept in there. I guess the key is that you shouldn’t be reading and writing stuff there without thinking about it carefully. In particular, you shouldn’t be interfering with the files and folders that XBMC places in those directories.

  • Scott Feb 14, 2009 

    would it make sense to have a special://allusers/ folder just for this, like windows?

  • jmarshall Feb 14, 2009 

    I guess that’s effectively what special://masterprofile/ is in some respects, though you could place the cached info into special://home/ as well if you wanted to (once win32 gets fixed up at least!)

  • Dan Dar3 Feb 24, 2009 

    Any plans for a new release to support the new paths?

    Thanks,
    Dan

  • jmarshall Feb 24, 2009 

    @Dan: The usual XBMC release schedule applies. The next official stable release is scheduled for April 2009, and ofcourse community releases on windows + OS X, and SVN PPA releases on linux are available in the meantime.

  • Dan Dar3 Feb 25, 2009 

    Thanks J, looking forward to the new release.

  • Pingback: XBMC for Mac OS X, Windows and Linux

  • Pingback: XBMC for Mac OS X, Windows and Linux

About Kodi

Kodi is a free and open source media player application developed by the XBMC Foundation, a non-profit technology consortium. Kodi is available for multiple operating-systems and hardware platforms, featuring a 10-foot user interface for use with televisions and remote controls. It allows users to play and view most videos, music, podcasts, and other digital media files from local and network storage media and the internet.