Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support of external paths like SMB and NFS for image cache location #1205

Merged
merged 1 commit into from
May 10, 2024

Conversation

GalacticWave
Copy link
Contributor

More details provided in issue #1203
When using external paths like SMB or NFS in image cache location, pillow module fails to read the files. Using xbmcvfs instead to read files from remote paths seems to work fine.

@jurialmunkey
Copy link
Owner

Hi, thanks for this! I'll test later today but it looks like it should work and I can't think of any scenarios it might cause an issue.

One question -- I'm wondering if you've tried simply translating the path via xbmcvfs before passing to _imageopen instead of updating the _imageopen function? I'm assuming it won't work but worth checking first just in case it is that simple.

i.e. change this line:

to:

img = _imageopen(xbmcvfs.translatePath(targetfile))

@GalacticWave
Copy link
Contributor Author

Yes. I did try that and it didn't work. It goes back to PIL trying to open smb:// and generating errors like the following:
Image error: Could not get image for https://assets.fanart.tv/fanart/movies/940721/hdmovielogo/godzilla-minus-one-654ad2f25a730.png (try 1) -> [Errno 22] Invalid argument: 'smb://username:password@nas540/Kodi/Cache/Thumbnails/crop_v2/temp_cropped-6bc5a12a65fc272690a51d797e6ca737.png'

So, I tried to figure out alternatives and the only way it worked for me was to open the files with xbmcvfs. I did test this with other scenarios like local storage and also pathsubtitution and it seemed to work in all cases. :)

@jurialmunkey
Copy link
Owner

No worries. I expected it wouldn't work anyway -- I think translatePath likely only translates special:// type protocols and probably wouldn't give access to an smb path setup inside Kodi -- but always good to test the simple solution first!

I can't see any reason why your change wouldn't work but I'm always a bit nervy when it comes to changes related to pillow because it feels a bit fragile like the smallest change will cause some issue on some obscure system!

It appears to be working for me, so I'll merge for next update and I guess I'll find out quick enough if it causes issues for someone.

If there is an issue, I guess the alternative would be to copy the temp file to the local userdata folder to work on, then copy back to the smb path via xbmcvfs and the delete the local temp -- that's much less elegant than your change in this PR though, so I'm hoping we can keep your solution!

@jurialmunkey jurialmunkey merged commit 8421944 into jurialmunkey:nexus May 10, 2024
@GalacticWave
Copy link
Contributor Author

If there is an issue, I guess the alternative would be to copy the temp file to the local userdata folder to work on, then copy back to the smb path via xbmcvfs and the delete the local temp -- that's much less elegant than your change in this PR though, so I'm hoping we can keep your solution!

You know, I initially thought about doing exactly that and it was becoming a bit messy. So, Keeping my fingers crossed that no one faces any problems with this update. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants