示例#1
0
 def list_available_nested_dict(self):
     d = None
     for directory in self.dirs:
         try:
             for entry in os.listdir(directory):
                 try:
                     if entry.rsplit(".", 1)[1] in ["url", "m3u"] + config.supported_extensions:
                         path = os.path.split(directory)[1]
                         fullname = "/".join([path, entry])
                         if d is None:
                             d = Nestedict("all", 1)
                         d.add_node("all/" + fullname, 1)
                 except IndexError:  # files without extensions should not break this
                     pass
         except OSError:  # missing directories are not a problem
             pass
     return d
示例#2
0
 def list_available_nested_dict(self):
     d = None
     for directory in self.dirs:
         try:
             for entry in os.listdir(directory):
                 try:
                     if entry.rsplit(
                             ".", 1)[1] in ["url", "m3u"
                                            ] + config.supported_extensions:
                         path = os.path.split(directory)[1]
                         fullname = "/".join([path, entry])
                         if d is None:
                             d = Nestedict("all", 1)
                         d.add_node("all/" + fullname, 1)
                 except IndexError:  #files without extensions should not break this
                     pass
         except OSError:  #missing directories are not a problem
             pass
     return d
示例#3
0
def stage_json():
    ndict = Nestedict("Playing Queue", 1)
    for entry in stage.array:
        ndict.add_node("Playing Queue/" + unicode(entry), 1)
    return jsonify(dict(ndict))