albumcutter

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

ac (830B)


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python2
import pyperclip
from albumcutter import AlbumCutter
from optparse import OptionParser

def main():
	options, args = parsearg()
	if len(args) == 0:
		print("Missing URL.")
		return
	t = get_tracklist()

	AlbumCutter(args[0], t, options.dir, resume=options.resume)

def parsearg():
	parser = OptionParser()

	parser.add_option("-d", dest="dir", default="album",
	                  help="Destination album", metavar="<dir>")

	parser.add_option("-r", "--resume", dest="resume", action="store_true",
	                  default=False, help="assumes file is already downloaded")

	return parser.parse_args()

def get_tracklist():
	while 1:
		print("Using tracklist in clipboard:")
		print(pyperclip.paste())
		if raw_input("\n[y/n]:") != 'n': break

	return pyperclip.paste()

if __name__ == "__main__":
	main()