Fix indentation
This commit is contained in:
parent
182129b695
commit
cdb9708b63
115
git-sound.py
115
git-sound.py
@ -326,84 +326,83 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
if args.scale is None and args.program != 'list':
|
if args.scale is None and args.program != 'list':
|
||||||
print("Please specify a scale!")
|
print("Please specify a scale!")
|
||||||
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if args.program is None and args.scale != 'list':
|
if args.program is None and args.scale != 'list':
|
||||||
print("Please specify a program!")
|
print("Please specify a program!")
|
||||||
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if args.scale == 'list':
|
if args.scale == 'list':
|
||||||
for scale in scales.keys():
|
for scale in scales.keys():
|
||||||
print(scale)
|
print(scale)
|
||||||
|
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
if args.program == 'list':
|
if args.program == 'list':
|
||||||
for program in programs.keys():
|
for program in programs.keys():
|
||||||
print(program)
|
print(program)
|
||||||
|
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
if args.scale not in scales:
|
if args.scale not in scales:
|
||||||
print("{} is an unknown scale. Use 'list' to list the available scales." \
|
print("{} is an unknown scale.".format(args.scale))
|
||||||
.format(args.scale))
|
print("Use 'list' to list the available scales.")
|
||||||
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if args.program not in programs:
|
if args.program not in programs:
|
||||||
print(("{} is an unknown program. " +
|
print("{} is an unknown program.".format(args.program))
|
||||||
"Use 'list' to list the available programs.") \
|
print("Use 'list' to list the available programs.")
|
||||||
.format(args.program))
|
|
||||||
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
repo_midi = GitMIDI(repository=args.repository,
|
repo_midi = GitMIDI(repository=args.repository,
|
||||||
branch=args.branch,
|
branch=args.branch,
|
||||||
verbose=args.verbose,
|
verbose=args.verbose,
|
||||||
scale=scales[args.scale],
|
scale=scales[args.scale],
|
||||||
program=programs[args.program],
|
program=programs[args.program],
|
||||||
volume_range=args.volume_range)
|
volume_range=args.volume_range)
|
||||||
|
|
||||||
except InvalidGitRepositoryError:
|
except InvalidGitRepositoryError:
|
||||||
print("{} is not a valid Git repository".format(
|
print("{} is not a valid Git repository" \
|
||||||
os.path.abspath(args.repository)))
|
.format(os.path.abspath(args.repository)))
|
||||||
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
except IndexError:
|
except IndexError:
|
||||||
print("Branch '{}' does not exist in this repo".format(args.branch))
|
print("Branch '{}' does not exist in this repo".format(args.branch))
|
||||||
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
repo_midi.gen_repo_data()
|
repo_midi.gen_repo_data()
|
||||||
repo_midi.generate_midi()
|
repo_midi.generate_midi()
|
||||||
repo_midi.write_mem()
|
repo_midi.write_mem()
|
||||||
|
|
||||||
if args.file:
|
if args.file:
|
||||||
if args.verbose:
|
if args.verbose:
|
||||||
print("Saving file to {}".format(args.file))
|
print("Saving file to {}".format(args.file))
|
||||||
|
|
||||||
repo_midi.export_file(args.file)
|
repo_midi.export_file(args.file)
|
||||||
|
|
||||||
if args.play:
|
if args.play:
|
||||||
if args.verbose:
|
if args.verbose:
|
||||||
print("Playing!")
|
print("Playing!")
|
||||||
|
|
||||||
# Import pygame stuff here
|
# Import pygame stuff here
|
||||||
import pygame
|
import pygame
|
||||||
import pygame.mixer
|
import pygame.mixer
|
||||||
|
|
||||||
# PLAYBACK
|
# PLAYBACK
|
||||||
pygame.init()
|
pygame.init()
|
||||||
pygame.mixer.init()
|
pygame.mixer.init()
|
||||||
repo_midi.mem_file.seek(0)
|
repo_midi.mem_file.seek(0)
|
||||||
pygame.mixer.music.load(repo_midi.mem_file)
|
pygame.mixer.music.load(repo_midi.mem_file)
|
||||||
pygame.mixer.music.play()
|
pygame.mixer.music.play()
|
||||||
|
|
||||||
while pygame.mixer.music.get_busy():
|
while pygame.mixer.music.get_busy():
|
||||||
sleep(1)
|
sleep(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user