Guest User

albumbler.ignore_playlists.patch

a guest
Apr 30th, 2011
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.59 KB | None | 0 0
  1. --- albumbler   2011-04-29 00:45:09.363948970 -0500
  2. +++ albumbler.ignore_playlists  2011-04-29 01:45:18.090617318 -0500
  3. @@ -14,7 +14,8 @@
  4.      'max_playlist': 1000,
  5.      'min_playlist': 3,
  6.      'notify': 'console',
  7. -    'player': 'mocp'}
  8. +    'player': 'mocp',
  9. +    'ignoreplaylists': False}
  10.  
  11.  """
  12.  playlist is a cached list of all directories/playlists.
  13. @@ -61,7 +62,8 @@
  14.  def dir_tree(dir_root):
  15.      tree = list(os.walk(dir_root))
  16.      dirs = [t[0] for t in tree]
  17. -    playlists = [os.path.join(t[0],f) for t in tree for f in t[2] if os.path.splitext(f)[1] in playlist_exts]
  18. +    if conf['ignoreplaylists'] == False: playlists = [os.path.join(t[0],f) for t in tree for f in t[2] if os.path.splitext(f)[1] in playlist_exts]
  19. +    else: playlists = []
  20.      return dirs + playlists
  21.  
  22.  def reasonable_dir(path):
  23. @@ -167,6 +169,7 @@
  24.          cp.set('Settings', 'MinPlaylist', str(conf['min_playlist']))
  25.          cp.set('Settings', 'Notify', str(conf['notify']))
  26.          cp.set('Settings', 'Player', str(conf['player']))
  27. +        cp.set('Settings', 'IgnorePlaylists', str(conf['ignoreplaylists']))
  28.          cp.write(open(config_path, 'wb'))
  29.      cp = ConfigParser.RawConfigParser()
  30.      cp.read(config_path)
  31. @@ -175,6 +178,7 @@
  32.      conf['max_playlist'] = cp.getint('Settings', 'MaxPlaylist')
  33.      conf['notify'] = cp.get('Settings', 'Notify')
  34.      conf['player'] = cp.get('Settings', 'Player')
  35. +    conf['ignoreplaylists'] = cp.get('Settings', 'IgnorePlaylists')
  36.      try:  # ewww, hacky
  37.          conf['min_playlist'] = cp.getint('Settings', 'MinPlaylist')
  38.      except ConfigParser.NoOptionError:
Advertisement
Add Comment
Please, Sign In to add comment