-
Notifications
You must be signed in to change notification settings - Fork 3
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
Clear strms #15
base: master
Are you sure you want to change the base?
Clear strms #15
Conversation
Ok, not good for merge yet. I need to keep the initial folders and not just delete them. Or the library does not like it :) Will update 👍 |
There, this works fine and is much cleaner 👍 |
My concern originally with cleaning the directories is related to someone not knowing any better, selecting a directory that contains other files (shared folder) and thus cleaning would clean everything. |
I also was going to look at using the xbmcvfs module entirely, including for the file write operations. I've looked at it before, and sometime around XBMC v11, they stopped supporting writing to binary files. I was playing around with it for caching video files and realized this fact. It's one of the reasons why I didn't bother using it (xbmcvfs.file) and went with os.file instead. But since STRM files will always be text based, and xbmcvfs.file should work for text files, I'm going to relook at using it to see if it provides actual benefits. In theory, special://, nfs:// and smb:// should work with it -- that is, XBMC paths. os.file won't work for these XBMC paths as it only works off what's mounted at the OS level. There will be users who will quickly report not able to generate their .STRM files when they select a NAS path, etc. I prevented users from selecting these paths by asking them at generation time to select a path (and the default is to exclude these). But when it was added to settings, users can select any path, including those special paths. Any experience with xbmcvfs.file vs os.file? |
Right on, good points... import os
import glob
files = glob.glob('/YOUR/PATH/*')
for f in files:
os.remove(f) Shameless copy/paste from stackoverflow, but maybe we could do a '/YOUR/PATH/*.strm' ? So it would only remove those. I'll keep working on it if I figure something out for a more general use case 👍 |
What I had thought up for the cache file path issue, where files are What I noticed with newer versions of XBMC, when I export library, it On Wed, Jan 7, 2015 at 11:52 PM, OJ notifications@github.com wrote:
|
Fixed a typo in default.py and proposing a clear strms option.
I tried using xbmcvfs.exists() but for some weird reason it would not work, so I just did a try: except: case on the rmtrees ... Weird... You might want to rework it, up to you :)
Tested it on OS X and it worked fine, will test on more platforms