def id3_to_track (filepath): sFktname = "id3_to_track" tag = stagger.read_tag(filepath) track_new = track() track_new["artist"] = tag.artist track_new["title"] = tag.title track_new["tn"] = tag.track return track_new
def getReleaseInfo(self, rel): sFktname = "getReleaseInfo" source = getWebAsStr(rel.infopage) # create a parser, we use minidom p = html5lib.HTMLParser(tree=treebuilders.getTreeBuilder("dom")) dom_tree = p.parse(source) walker = treewalkers.getTreeWalker("dom") stream = walker(dom_tree) # get catid rel.catid = self.fetch_Catid(stream) # get tunelist l_tuneList = self.fetch_TuneInfo(stream) # build release tune list for tune in l_tuneList: temp = track() temp.link = tune[0] temp.artist = tune[1] temp.title = tune[2] temp.key = tune[3] rel.tunes.append(temp) # build links p = "" for tune in rel.tunes: # downloading file there links are in try: f = urllib.request.urlopen(self.baseUrl + tune.link).read() p = "/tmp/pymyrel-tmpinfo" except: print(" --> chemical.getReleaseInfo: An Error occured, while downloading linkfile") if p != "": output = open(p ,'wb') output.write(f) output.close() linkfile = open(p, 'r') for line in linkfile: if line.startswith("http://") == True: tune.link = line.strip("\n") if len(rel.tunes) > 0: print(rel) return rel
def main (): sFktname = "main" track_new = track() track_new.artist = "Inside Info" track_new.title = "Awkward" res = search_clever(track_new) print(res) track_new.artist = "Futurebound camo krooked" track_new.title = "chic" res = search_clever(track_new) print(res)
def id3_to_track (filepath): sFktname = "id3_to_track" p = subprocess.Popen(["id3ed", "-i", filepath], stdout = subprocess.PIPE) output = p.communicate()[0].decode().splitlines() p.wait() track_new = track() for item in output: if item.startswith("artist: ") == True: track_new["artist"] = item.lstrip("artist: ").strip() elif item.startswith("songname: ") == True: track_new["title"] = item.lstrip("songname: ").strip() elif item.startswith("tracknum: ") == True: track_new["tn"] = item.lstrip("tracknum: ").strip() return track_new