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
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.
Revision history for this message
Samuel Buffet (samuel-buffet) wrote :

Small bug, small diff:

=== modified file 'entertainerlib/utils/configuration.py'
--- entertainerlib/utils/configuration.py 2008-12-17 19:25:09 +0000
+++ entertainerlib/utils/configuration.py 2009-01-06 21:11:15 +0000
@@ -265,11 +265,9 @@
         Get list of video folders
         @return:String Array
         """
- #FIXME: We should prevent ENTERTAINER_DIR/cache/* to be in those folders
- # This can lead to recursivnes: make thumbs of thumbs of thumbs...
         try:
- folder_list = self.content_config.get("Videos", "folders")
- result = folder_list.split(';')
+ video_list = self.content_config.get("Videos", "folders")
+ result = self._is_valid_media_folder(video_list.split(';'))
         except (NoSectionError, NoOptionError):
             return []
         return result
@@ -279,8 +277,6 @@
         Get list of music folders
         @return: String Array
         """
- #FIXME: We should prevent ENTERTAINER_DIR/cache/* to be in those folders
- # This can lead to recursivnes: make thumbs of thumbs of thumbs...
         try:
             music_list = self.content_config.get("Music", "folders")
             result = music_list.split(';')
@@ -293,11 +289,9 @@
         Get list of image folders
         @return: String Array
         """
- #FIXME: We should prevent ENTERTAINER_DIR/cache/* to be in those folders
- # This can lead to recursivnes: make thumbs of thumbs of thumbs...
         try:
             image_list = self.content_config.get("Images", "folders")
- result = image_list.split(';')
+ result = self._is_valid_media_folder(image_list.split(';'))
         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):
+ """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.commonprefix([cache_dir, folder])
+ if common_prefix != cache_dir:
+ # folder is not a subfolder of cache_dir we accept it
+ valid_folder_list.append(folder)
+
+ return valid_folder_list
+

332. By Samuel Buffet

remove a useless space

Revision history for this message
Paul Hummer (rockstar) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ah, great resolution to that one!

 vote approve

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAklj42wACgkQHE2KxYYv8I9xTgCfXwL5IBN5SsO+uiU60x6pnswq
ZQYAnAtmdDBZN/mAnRBNsE8VLGRHSkVQ
=Ytlr
-----END PGP SIGNATURE-----

review: Approve
333. By Samuel Buffet

merged vs trunk

Subscribers

People subscribed via source and target branches