def pub_downloadTo(self, mf_path, mf_really, fileStr, fileStrEnd): if mf_really : self.m_filename = public_functions.f_getPath(mf_path, fileStr) myTrackFile = open(self.m_filename+fileStrEnd, 'wb') myTrackFile.write(public_functions.f_urlToStringData(self.m_url)) myTrackFile.close() else: print("{0} -> {1}/{2}".format(self.m_url, mf_path, fileStr))
def pub_downloadTo(self, mf_path, mf_really): # download json-file fileStr = public_functions.f_getOSFilenameStr("{}_-_{}_-_".format(self.getartist_name(), self.getalbum_name())) myfileName = os.path.normpath("{0}/{1}00.json".format(mf_path, fileStr)) myfile = open(myfileName, 'w') myfile.write(self.m_albumjsonFormattedStr) myfile.close() # kopiere Cover myCoverName = os.path.normpath("{0}/{1}00.jpg".format(mf_path, fileStr)) myCover = open(myCoverName, 'wb') myCover.write(public_functions.f_urlToStringData(self.getalbum_thumbnail())) myCover.close() for mytrack in self._queueOfTrack: trackfileStr = public_functions.f_getOSFilenameStr(fileStr + "{:0>2}_-_{}".format(mytrack.pub_get_tracknr(), mytrack.pub_get_tracktitle())) mytrack.pub_downloadTo(mf_path, mf_really, trackfileStr, ".flv"); if (public_functions.f_transcode(mf_path, trackfileStr, ".flv", ".mp3")==0): print("remove") public_functions.f_removeFile(mf_path, trackfileStr + ".flv") mytrack.pub_tag()
def loadImageFromNet(self, mf_url, mf_imagePathAndName): ImageFile = open(mf_imagePathAndName, 'wb') ImageFile.write(public_functions.f_urlToStringData(mf_url)) ImageFile.close()