def filter_location (self, location):
        url = urlutil.UrlParse(location)
        
        if not url.is_local:
            return

        hints_list = []
        p = xspf.Playlist()
        try:
            p.parse (url.path)
        except Exception:
            return
            
        basename = path.basename(url.path)
        
        for t in p.tracks:
            if t.location is None:
                continue
            r = {'location': urlutil.normalize(t.location, basename)}
            if t.title is not None:
                r['title'] = t.title
            if t.creator is not None:
                r['artist'] = t.creator
            hints_list.append(r)
            
        return hints_list
Ejemplo n.º 2
0
    def filter_location(self, location):
        url = urlutil.UrlParse(location)

        if not url.is_local or not path.isdir(url.path):
            return

        files = glob.glob(path.join(url.path, "*"))
        files.sort()

        return [{"location": urlutil.normalize(loc)} for loc in files]
    def filter_location(self, location):
        url = urlutil.UrlParse(location)

        if not url.is_local or not path.isdir(url.path):
            return

        files = glob.glob(path.join(url.path, "*"))
        files.sort()

        return [{"location": urlutil.normalize(loc)} for loc in files]
    def filter_location(self, location):
        url = urlutil.UrlParse(location)
        if not url.is_local or not path.isdir(url.path):
            return

        files = glob(path.join(location, "*"))
        files.sort()

        to_hints = lambda loc: {"location": urlutil.normalize(loc)}
        return map(to_hints, files)
    def filter_location(self, location):
        url = urlutil.UrlParse(location)
        if not url.is_local or not path.isdir(url.path):
            return

        files = glob(path.join(location, "*"))
        files.sort()

        to_hints = lambda loc: {"location": urlutil.normalize(loc)}
        return map(to_hints, files)