45 lines
1.2 KiB
Python
45 lines
1.2 KiB
Python
#!/usr/bin/python3
|
|
|
|
import os
|
|
import sys
|
|
import argparse
|
|
|
|
|
|
def main():
|
|
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()
|
|
|
|
from .main import Wobuzz
|
|
|
|
app = Wobuzz()
|
|
|
|
if arguments.playlist:
|
|
app.library.temporary_playlist.clear()
|
|
app.library.temporary_playlist.view.clear()
|
|
app.library.temporary_playlist.load_from_m3u(arguments.playlist)
|
|
app.library.temporary_playlist.view.load_tracks()
|
|
|
|
if arguments.track:
|
|
app.library.temporary_playlist.clear()
|
|
app.library.temporary_playlist.view.clear()
|
|
|
|
# make track paths absolute
|
|
tracks = []
|
|
|
|
for track in arguments.track:
|
|
tracks.append(os.path.abspath(track))
|
|
|
|
app.library.temporary_playlist.load_from_paths(tracks)
|
|
app.library.temporary_playlist.view.load_tracks()
|
|
|
|
sys.exit(app.qt_app.exec())
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|