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

Clear strms #15

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Clear strms #15

wants to merge 3 commits into from

Conversation

nekwebdev
Copy link

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

@nekwebdev
Copy link
Author

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 👍

@nekwebdev
Copy link
Author

There, this works fine and is much cleaner 👍

@ddurdle
Copy link
Owner

ddurdle commented Jan 8, 2015

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.

@ddurdle
Copy link
Owner

ddurdle commented Jan 8, 2015

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?

@nekwebdev
Copy link
Author

Right on, good points...
Maybe something along those lines?

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.
Or have the user know that he needs to use specific folders for his cloud movies/tv shows and not mix them with other content?
Of course the code above works perfectly fine for my use case as the strms are in local folders and in folders dedicated to them, so I am a best case scenario...

I'll keep working on it if I figure something out for a more general use case 👍

@ddurdle
Copy link
Owner

ddurdle commented Jan 8, 2015

What I had thought up for the cache file path issue, where files are
downloaded to a user specified folder, I would create a cache folder under
it and store the files under there. Then I would purge everything under
cache (and if the user stored anything under there, then it's all fair game
to be removed). I don't expect users to dig around cache folders. But I
do expect them to dig around the .STRM folders.

What I noticed with newer versions of XBMC, when I export library, it
actually exports the NFO and images directly back to the STRM folder.
Previous versions would export them to a xbmc.date folder in the user's
home directory.

On Wed, Jan 7, 2015 at 11:52 PM, OJ notifications@github.com wrote:

Right on, good points...
Maybe something along those lines?

import osimport 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.
Or have the user know that he needs to use specific folders for his cloud
movies/tv shows and not mix them with other content?
Of course the code above works perfectly fine for my use case as the strms
are in local folders and in folders dedicated to them, so I am a best case
scenario...

I'll keep working on it if I figure something out for a more general use
case [image: 👍]


Reply to this email directly or view it on GitHub
#15 (comment).

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.

None yet

2 participants