def __init__ (self, music_list, hints, insert=None, app=None): operations.Operation.__init__ (self) self.hints = hints self.music_list = music_list self.insert = insert # We normalize the paths by default hints["location"] = urlutil.normalize(hints["location"]) self.app = app
def unique_music_id(self, uri): """ Provides a way of uniquely identifying URI's, in case of user sends: file:///foo%20bar file:///foo bar /foo bar Returns always a URL, even if the string was a file path. """ return urlutil.normalize(uri)
def add_files (self, filenames): to_hint = lambda filename: {"location": urlutil.normalize(filename)} return self.add_hints(map(to_hint, filenames))
def normalize_hints(hints): hints["location"] = urlutil.normalize(hints["location"])