示例#1
0
文件: genDB.py 项目: Auzzy/personal
def find_tags(path,list_of_tags = []):
	for fold in listdir(path):
		try:
			tag = get_tag(path + "/" + fold)
			if tag is not None:
				list_of_tags.append(tag)
		except IOError, mess:
			if mess[0]==13:
				print fold
				find_tags(path + "/" + fold,list_of_tags)
			else:
				raise
示例#2
0
def _find_tags(path):
	list_of_tags = []
	for fold in listdir(path):
		fold_path = path_join(path,fold)
		if isdir(fold_path):
			print "folder: {0}".format(fold)
			list_of_tags.extend(_find_tags(fold_path))
		else:
			try:
				tag = get_tag(fold_path)
				if tag is not None:
					list_of_tags.append(tag)
			except TagError:
				pass
			except TypeError:
				pass
	return list_of_tags
示例#3
0
文件: master.py 项目: Auzzy/personal
def createBandList(root):
	fullTrackList = []
	foldTracks = []
	print "current folder:"
	for fold in os.listdir(root):
		print fold
		foldTrackList = []
		for track in os.listdir(root + "/" + fold):
			trackInfo = get_tag(root + "/" + fold + "/" + track)
			try: foldTrackList.insert(0,trackInfo["artist"].lower())
			except AttributeError: pass
		foldTracks.insert(0,foldTrackList)
	for foldList in foldTracks:
		for track in foldList:
			fullTrackList.insert(0,track)
	sortedList = list(set(fullTrackList)) #set removes duplicates, and converting it back to a list allows me to sort the results easily
	sortedList.sort()
	return sortedList
示例#4
0
文件: master.py 项目: Auzzy/personal
ie "%%a/%%r/%%t - %%s." would indicate to create a folder named the same as the artist, inside that, a folder named for the album, and inside that, name the track staring with the track number, then a dash (-), followed by the track name

string: """ % illegalStr)
	
	#performs the copy with all selected options
	global skipped
	skipped = []
	startTime = time.time()
	folderList = os.listdir(root)
	print "current folder:"
	for folder in folderList:
		print folder
		trackList = os.listdir(root + "/" + folder)
		for track in trackList:
			try:
				tagInfo = get_tag(root + "/" + folder + "/" + track)
			except TypeError, mess:
				print str(mess) + " It will be skipped."
				tagInfo = None
			
			if tagInfo!=None:
				if shouldCopy(tagInfo["artist"],copyBands,bandsToCopy):
					if sort:
						executeFormatString(songString,tagInfo,illegal,root + "/" + folder + "/" + track,save,track)
					else:
						copier(root + "/" + folder + "/" + track,save + "/" + tagInfo["artist"] + " - " + tagInfo["title"] + "." + track[track.rfind(".")+1:].lower(),save,track)
	
	#prints out a list of all files that were skipped
	if len(skipped)!=0:
		print "Unfortunately, the following files failed to copy for some reason or another:"
		for song in skipped: