reading remote directories
#1
So i have wrote my script on a windows pc using os.isdir() to verify infact a folder exists.. now i have added the same folder as a smb:// folder through kodi and it can not be read. i actually get error does not exsist when in fact it does. also having the same proble on the nvidia shield i know the folder is there and can view it through the folder select screen but my script cant see it? any ideas? its only on smb
Shield TV | Windows 10 | Mariadb | Mii Box
Evolve Ecosystem Repo | TV Melodies | Madnox Holiday Mod
Reply
#2
Python's build-in os module does not support network paths. Use Kodi's xbmcvfs module.
Raspberry PI 2 + LibreELEC 8 (Kodi 17)
Samsung Galaxy Tab A 10.1 + Kodi 17 for Android
Reply
#3
(2019-07-01, 18:51)Roman_V_M Wrote: Python's build-in os module does not support network paths. Use Kodi's xbmcvfs module.

That will convert the path for me?
Shield TV | Windows 10 | Mariadb | Mii Box
Evolve Ecosystem Repo | TV Melodies | Madnox Holiday Mod
Reply
#4
(2019-07-01, 21:02)smitchell6879 Wrote: That will convert the path for me?
What do you mean by "convert path"?
Raspberry PI 2 + LibreELEC 8 (Kodi 17)
Samsung Galaxy Tab A 10.1 + Kodi 17 for Android
Reply
#5
(2019-07-02, 06:53)Roman_V_M Wrote:
(2019-07-01, 21:02)smitchell6879 Wrote: That will convert the path for me?
What do you mean by "convert path"?
Honestly not sure I was running low on sleep. I made a Kodi Verizon of the pysmb module before I implement it do u know if there is already something similar built into Kodi?
Shield TV | Windows 10 | Mariadb | Mii Box
Evolve Ecosystem Repo | TV Melodies | Madnox Holiday Mod
Reply
#6
(2019-07-02, 20:14)smitchell6879 Wrote: do u know if there is already something similar built into Kodi?

I replied to this question in my first post in this topic.
Raspberry PI 2 + LibreELEC 8 (Kodi 17)
Samsung Galaxy Tab A 10.1 + Kodi 17 for Android
Reply
#7
(2019-07-01, 15:55)smitchell6879 Wrote: So i have wrote my script on a windows pc using os.isdir() to verify infact a folder exists.. now i have added the same folder as a smb:// folder through kodi and it can not be read. i actually get error does not exsist when in fact it does. also having the same proble on the nvidia shield i know the folder is there and can view it through the folder select screen but my script cant see it? any ideas? its only on smb

As mentioned, you need to use the virtual file system stuff.

https://codedocs.xyz/xbmc/xbmc/group__py...mcvfs.html

In the addons I maintain, I have a preference that the user needs to set for the "root" directory for whatever files I want to read/write.  That can be anything you can access using Kodi's browse functions (including SMB).  Once that preference is set then I can read files by getting the path from the settings and then using the xbmcvfs calls without having to worry about whether they're local, smb, nfs, etc.
Providing a debug log: Log_file/Easy (wiki)
Leia Estuary mod: 333143 (thread)
Artist Slideshow: Add-on:Artist_Slideshow (wiki)
SpeedFan Information Display: Add-on:SpeedFan_Information_Display (wiki)
Reply
#8
(2019-07-02, 22:23)pkscout Wrote: As mentioned, you need to use the virtual file system stuff.
https://codedocs.xyz/xbmc/xbmc/group__py...mcvfs.html
There is no functionality to read or write files via the vfs system?
Got a Kodi problem? Provide us with a full Debug log (wiki) || Usefull pages: First time user (wiki) || Troubleshooting (wiki) || Free content (wiki) || Forum rules (wiki) || VPN policy (wiki)
Reply
#9
(2019-07-02, 22:29)Klojum Wrote:
(2019-07-02, 22:23)pkscout Wrote: As mentioned, you need to use the virtual file system stuff.
https://codedocs.xyz/xbmc/xbmc/group__py...mcvfs.html
There is no functionality to read or write files via the vfs system?

Alright so in my add-on I have the user select a download folder. I the user want to use my network windows share so I selected it. Kodi gives me a link smb:// server/ folder. . now I with my add-on have at link and I want to join that link to a subfolder and mkdir if not exist or if it does I want to listdir. How would I do this with vfs my testing so far has failed. So I was going to result to pysmb as a last ditch hope to use my windows share.
Shield TV | Windows 10 | Mariadb | Mii Box
Evolve Ecosystem Repo | TV Melodies | Madnox Holiday Mod
Reply
#10
(2019-07-02, 22:57)smitchell6879 Wrote: Alright so in my add-on I have the user select a download folder. I the user want to use my network windows share so I selected it. Kodi gives me a link smb:// server/ folder. . now I with my add-on have at link and I want to join that link to a subfolder and mkdir if not exist or if it does I want to listdir. How would I do this with vfs my testing so far has failed. So I was going to result to pysmb as a last ditch hope to use my windows share. 

I use os.path.join in Artist Slideshow and it works fine.
Code:
os.path.join( self.LOCALARTISTPATH, info_dir, self.FANARTFOLDER )
LOCALARTISTPATH is grabbed from the settings as a string, info_dir is another string, and FANARTFOLDER is a third string.  Doing that I've never had to check and see what method is being used to get to LOCALARTISTPATH.  It's been tested with local file system on Mac, Windows, and Raspberry Pi as well as with SMB and NFS connections from within Kodi.
Providing a debug log: Log_file/Easy (wiki)
Leia Estuary mod: 333143 (thread)
Artist Slideshow: Add-on:Artist_Slideshow (wiki)
SpeedFan Information Display: Add-on:SpeedFan_Information_Display (wiki)
Reply
#11
(2019-07-03, 08:21)pkscout Wrote:
(2019-07-02, 22:57)smitchell6879 Wrote: Alright so in my add-on I have the user select a download folder. I the user want to use my network windows share so I selected it. Kodi gives me a link smb:// server/ folder. . now I with my add-on have at link and I want to join that link to a subfolder and mkdir if not exist or if it does I want to listdir. How would I do this with vfs my testing so far has failed. So I was going to result to pysmb as a last ditch hope to use my windows share. 

I use os.path.join in Artist Slideshow and it works fine.
Code:
os.path.join( self.LOCALARTISTPATH, info_dir, self.FANARTFOLDER )
LOCALARTISTPATH is grabbed from the settings as a string, info_dir is another string, and FANARTFOLDER is a third string.  Doing that I've never had to check and see what method is being used to get to LOCALARTISTPATH.  It's been tested with local file system on Mac, Windows, and Raspberry Pi as well as with SMB and NFS connections from within Kodi.

I must have some other problem then because I am already doing this and it will not work.. I will just have to do some more testing .



Thanks for the help
Shield TV | Windows 10 | Mariadb | Mii Box
Evolve Ecosystem Repo | TV Melodies | Madnox Holiday Mod
Reply
#12
(2019-07-03, 09:38)smitchell6879 Wrote:
(2019-07-03, 08:21)pkscout Wrote:
(2019-07-02, 22:57)smitchell6879 Wrote: Alright so in my add-on I have the user select a download folder. I the user want to use my network windows share so I selected it. Kodi gives me a link smb:// server/ folder. . now I with my add-on have at link and I want to join that link to a subfolder and mkdir if not exist or if it does I want to listdir. How would I do this with vfs my testing so far has failed. So I was going to result to pysmb as a last ditch hope to use my windows share. 

I use os.path.join in Artist Slideshow and it works fine.
Code:
os.path.join( self.LOCALARTISTPATH, info_dir, self.FANARTFOLDER )
LOCALARTISTPATH is grabbed from the settings as a string, info_dir is another string, and FANARTFOLDER is a third string.  Doing that I've never had to check and see what method is being used to get to LOCALARTISTPATH.  It's been tested with local file system on Mac, Windows, and Raspberry Pi as well as with SMB and NFS connections from within Kodi.

I must have some other problem then because I am already doing this and it will not work.. I will just have to do some more testing .



Thanks for the help

I have it working on the PC now. So hopefully tonight I will get time to get it working on the shield.
Shield TV | Windows 10 | Mariadb | Mii Box
Evolve Ecosystem Repo | TV Melodies | Madnox Holiday Mod
Reply
 
Thread Rating:
  • 0 Vote(s) - 0 Average



Logout Mark Read Team Forum Stats Members Help
reading remote directories00