rework input to string
This commit is contained in:
parent
67ef8209f4
commit
6eb668510b
8
main.py
8
main.py
@ -25,7 +25,6 @@ if len(sys.argv) > 1:
|
|||||||
# Get the JSON argument from the command line
|
# Get the JSON argument from the command line
|
||||||
input_str = sys.argv[1]
|
input_str = sys.argv[1]
|
||||||
|
|
||||||
try:
|
|
||||||
# Convert the JSON string into a dictionary
|
# Convert the JSON string into a dictionary
|
||||||
disc_data = input_str.split(":")
|
disc_data = input_str.split(":")
|
||||||
if disc_data[0] == "ytmusic":
|
if disc_data[0] == "ytmusic":
|
||||||
@ -42,8 +41,7 @@ if len(sys.argv) > 1:
|
|||||||
# Pass the parsed data to the update_disc function
|
# Pass the parsed data to the update_disc function
|
||||||
control_player(client, "PLAY")
|
control_player(client, "PLAY")
|
||||||
update_disc(client, disc_data)
|
update_disc(client, disc_data)
|
||||||
except json.JSONDecodeError as e:
|
else:
|
||||||
try:
|
|
||||||
if input_str == "EJECT":
|
if input_str == "EJECT":
|
||||||
# PAUSE the current playing item
|
# PAUSE the current playing item
|
||||||
control_player(client, "PAUSE")
|
control_player(client, "PAUSE")
|
||||||
@ -55,7 +53,3 @@ if len(sys.argv) > 1:
|
|||||||
control_player(client, "PAUSE")
|
control_player(client, "PAUSE")
|
||||||
else:
|
else:
|
||||||
print(f"Can't process {input_str}")
|
print(f"Can't process {input_str}")
|
||||||
except Exception:
|
|
||||||
print(f"Invalid JSON format: {e}")
|
|
||||||
else:
|
|
||||||
print("No Command or Track Info Passed")
|
|
Loading…
x
Reference in New Issue
Block a user