예제 #1
0
파일: to_m3u.py 프로젝트: ekimekim/awp
def main(playlist, src, dest, scale=None, url=False):
	"""Writes the playlist in m3u format to stdout, using repetition for weight.
	src and dest args are for path rewriting - any paths under src will be rewritten
	to be under dest instead."""
	playlist = Playlist(playlist)
	flattened = playlist.to_repeated_list(scale)
	src = '{}/'.format(src.rstrip('/'))
	for path in flattened:
		if path.startswith(src):
			path = os.path.join(dest, os.path.relpath(path, src))
		print 'file://{}'.format(path) if url else path