Merge lp://staging/~samuel-buffet/entertainer/bug_311275 into lp://staging/entertainer
Proposed by
Samuel Buffet
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | not available | ||||
Proposed branch: | lp://staging/~samuel-buffet/entertainer/bug_311275 | ||||
Merge into: | lp://staging/entertainer | ||||
To merge this branch: | bzr merge lp://staging/~samuel-buffet/entertainer/bug_311275 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Paul Hummer | Approve | ||
Review via email: mp+2675@code.staging.launchpad.net |
To post a comment you must log in.
Small bug, small diff:
=== modified file 'entertainerlib /utils/ configuration. py' utils/configura tion.py 2008-12-17 19:25:09 +0000 utils/configura tion.py 2009-01-06 21:11:15 +0000
@return: String Array DIR/cache/ * to be in those folders config. get("Videos" , "folders") list.split( ';') config. get("Videos" , "folders") valid_media_ folder( video_list. split(' ;')) DIR/cache/ * to be in those folders
music_ list = self.content_ config. get("Music" , "folders") split(' ;') DIR/cache/ * to be in those folders
image_ list = self.content_ config. get("Images" , "folders") split(' ;') valid_media_ folder( image_list. split(' ;'))
--- entertainerlib/
+++ entertainerlib/
@@ -265,11 +265,9 @@
Get list of video folders
"""
- #FIXME: We should prevent ENTERTAINER_
- # This can lead to recursivnes: make thumbs of thumbs of thumbs...
try:
- folder_list = self.content_
- result = folder_
+ video_list = self.content_
+ result = self._is_
except (NoSectionError, NoOptionError):
return []
return result
@@ -279,8 +277,6 @@
Get list of music folders
@return: String Array
"""
- #FIXME: We should prevent ENTERTAINER_
- # This can lead to recursivnes: make thumbs of thumbs of thumbs...
try:
result = music_list.
@@ -293,11 +289,9 @@
Get list of image folders
@return: String Array
"""
- #FIXME: We should prevent ENTERTAINER_
- # This can lead to recursivnes: make thumbs of thumbs of thumbs...
try:
- result = image_list.
+ result = self._is_
except (NoSectionError, NoOptionError):
return []
return result
@@ -491,3 +485,16 @@
else:
print "Trying to set non-existent configuration directory"
+ def _is_valid_ media_folder( self, folder_list): commonprefix( [cache_ dir, folder]) list.append( folder)
+ """Return a folder list where eventual cache folders are removed"""
+ cache_dir = os.path.join( self.get_cfg_dir(), 'cache')
+ valid_folder_list = []
+
+ for folder in folder_list:
+ common_prefix = os.path.
+ if common_prefix != cache_dir:
+ # folder is not a subfolder of cache_dir we accept it
+ valid_folder_
+
+ return valid_folder_list
+