forked from Wobbl/Wobuzz
Added command_line.py to control the player via command line.
This commit is contained in:
parent
94269fdae4
commit
10c36b37a1
5 changed files with 32 additions and 16 deletions
28
wobuzz/command_line.py
Normal file
28
wobuzz/command_line.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import sys
|
||||
import argparse
|
||||
from main import Wobuzz
|
||||
|
||||
|
||||
description = "A music player made by The Wobbler."
|
||||
|
||||
parser = argparse.ArgumentParser(description=description)
|
||||
|
||||
parser.add_argument("track", nargs="*", help="Plays audio files the from given paths.", metavar="TRACKS")
|
||||
parser.add_argument("-p", "--playlist", help="Imports a playlist from the given path.", metavar="PLAYLIST_PATH")
|
||||
|
||||
arguments = parser.parse_args()
|
||||
|
||||
app = Wobuzz()
|
||||
|
||||
if arguments.playlist:
|
||||
print(arguments.playlist)
|
||||
app.player.current_playlist.load_from_m3u(arguments.playlist)
|
||||
|
||||
if arguments.track:
|
||||
print(arguments.track)
|
||||
app.player.current_playlist.load_from_paths(arguments.track)
|
||||
|
||||
sys.exit(app.qt_app.exec())
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue