In this commit there is an internal util used for adding a slash at the end.
https://github.com/xbmc/xbmc/commit/9a5f...42262c00bc
Is this also available for add-ons (python)?
add slash at end
Martijn
Team-XBMC Joined: Jul 2011 Reputation: 114 Location: Dawn of time |
2011-11-22 22:43
Post: #1
Always read the XBMC online-manual, FAQ and search the forums before posting. Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules. For troubleshooting and bug reporting, make sure you read this first For your mediacenter artwork go to ![]() |
| find quote |
spiff
Grumpy Bastard Developer Joined: Nov 2003 Reputation: 82 |
2011-11-22 23:07
Post: #2
nope. but python has its own.
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. |
| find quote |
Martijn
Team-XBMC Joined: Jul 2011 Reputation: 114 Location: Dawn of time |
2011-11-22 23:44
Post: #3
spiff Wrote:nope. but python has its own. and could you by any chance enlighten me on that
Always read the XBMC online-manual, FAQ and search the forums before posting. Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules. For troubleshooting and bug reporting, make sure you read this first For your mediacenter artwork go to ![]() |
| find quote |
giftie
Skilled Python Coder Posts: 2,035 Joined: Mar 2010 Reputation: 35 |
2011-11-23 06:32
Post: #4
Machine-Sanctum Wrote:and could you by any chance enlighten me on that you can always use, os.path.join( path, "" ) will add the proper file slash based on the OS. ![]() For troubleshooting and bug reporting please make sure you read this first you can also use XBMC Log Uploader Script. Cinema Experience Cinema Experience Wiki cdART Manager fanart.tv |
| find quote |
paddycarey
Senior Member Joined: Sep 2009 Reputation: 8 |
2011-11-24 17:01
Post: #5
giftie Wrote:you can always use, os.path.join( path, "" ) will add the proper file slash based on the OS. os.path.join works for the most part but where it falls down is when trying to work with smb:// or nfs:// paths on windows. It detects the OS as Windows and so uses \ when / would be correct for the path. At the moment we have to test if the path contains :// and if it does set the separator to /. Not pretty but it works. Add-ons: Artwork Downloader, MMA Browser, MMAFighting.com, The Joe Rogan Experience, FightCasts, Deathsquad.tv, Vice.com |
| find quote |
giftie
Skilled Python Coder Posts: 2,035 Joined: Mar 2010 Reputation: 35 |
2011-11-25 02:47
Post: #6
paddycarey Wrote:os.path.join works for the most part but where it falls down is when trying to work with smb:// or nfs:// paths on windows. It detects the OS as Windows and so uses \ when / would be correct for the path. I know python autocorrects the separators and I thought XBMC also does(I could be wrong, but the source code it does look like it does) With that being said, it is easy to correct the slashes after an os.path.join(). Code: if ( len( path ) > 1 and path[1] == ":" ) or ( len( path ) > 1 and path[0] == "\\" and path[1] == "\\" ): # tests to see if is a DOS path or a windows sharethis is python version of what I found in the XBMC source code(URIUtils.cpp) ![]() For troubleshooting and bug reporting please make sure you read this first you can also use XBMC Log Uploader Script. Cinema Experience Cinema Experience Wiki cdART Manager fanart.tv
(This post was last modified: 2011-11-25 03:17 by giftie.)
|
| find quote |
FrostBox
Skilled Python Coder Joined: Nov 2005 Reputation: 6 Location: Quebec City |
2011-11-25 15:13
Post: #7
Hi,
I use this in my all add-ons and work perfectly ![]() PHP Code: # normalize the path (win32 support / as path separators) and make sure endswith by / |
| find quote |
Martijn
Team-XBMC Joined: Jul 2011 Reputation: 114 Location: Dawn of time |
2011-11-26 22:37
Post: #8
The problem is not in copy/deleting of files but in the caching of images and the way skins formulate the path. They always use '/' at the end of a path. So this will present a problem with win32 folder structures because the last slash of a movie path must be a '/' (and some skinners even create a '//'at the end).
So this path: Code: Z:\Films\Algemeen\Batman Begins (2005)Code: Z:\Films\Algemeen\Batman Begins (2005)/fanart.jpgor some one must know an easier way to overcome the caching problem like discussed in: http://forum.xbmc.org/showthread.php?tid=104857 Always read the XBMC online-manual, FAQ and search the forums before posting. Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules. For troubleshooting and bug reporting, make sure you read this first For your mediacenter artwork go to ![]()
(This post was last modified: 2011-11-26 23:14 by Martijn.)
|
| find quote |
FrostBox
Skilled Python Coder Joined: Nov 2005 Reputation: 6 Location: Quebec City |
2011-11-26 23:54
Post: #9
Maybe with this
http://passion-xbmc.org/gros_fichiers/XB...lidatePath PHP Code: validatePath(...) |
| find quote |
Martijn
Team-XBMC Joined: Jul 2011 Reputation: 114 Location: Dawn of time |
2011-11-27 00:05
Post: #10
FrostBox Wrote:Maybe with thisYeah I also tried that. The real problem is that skinners cannot always have a universal way of using paths and they are not all doing it the same way. So at the moment we have to anticipate that to replace the cached version of an image with a new one. Or else it won't be visible at once. Did find something although i'm not really sure what it does: http://passion-xbmc.org/addons/?Page=Vie...mageCacher and http://mirrors.xbmc.org/addons/eden-pre/...gin.cache/ Always read the XBMC online-manual, FAQ and search the forums before posting. Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules. For troubleshooting and bug reporting, make sure you read this first For your mediacenter artwork go to ![]()
(This post was last modified: 2011-11-27 00:10 by Martijn.)
|
| find quote |


![[Image: fanarttv.png]](http://trakt.us/images/thanks/fanarttv.png)
![[Image: e4f63e45ba34fe4695b3bb08eb2499d8e4ee484e...4c076g.jpg]](http://www.mediafire.com/conv/e4f63e45ba34fe4695b3bb08eb2499d8e4ee484e4d2fe70f903275f93e5e4c076g.jpg)

Search
Help