-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsMusicClient
executable file
·62 lines (54 loc) · 1.86 KB
/
sMusicClient
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/python2
# -*- coding: utf-8 -*-
"""
Bardzo minimalny testowy klient TCP
"""
import time
from smusicclient import __version__
from smusicclient import download_controller
from smusicclient import gaps_controller as gaps
from smusicclient import logs
from smusicclient import player
from smusicclient.protocol_functions import binder
from smusicclient.protocol_utils import ConnectionThread
binds = {}
was_interrupted = False
thread_conn = None
thread_gap = None
def start_connection():
global thread_conn
binder.set_gaps_controller(gaps)
binder.set_library(library)
binder.set_player(p)
thread_conn = ConnectionThread(binder)
thread_conn.start()
def init_gaps():
global thread_gap
gaps.load_gaps()
thread_gap = gaps.GapThread(p)
thread_gap.start()
if __name__ == "__main__":
logs.setup_logging()
logs.print_info("\n+---------------------------------------------+\n|" +
("sMusic-core v{}".format(__version__).center(45, " ")) + "|\n|" +
"https://github.com/mRokita/sMusic-core".center(45, " ") +
"|\n+---------------------------------------------+\n")
p = player.Player(gaps)
init_gaps()
library = player.get_musiclibrary()
download_controller.init(library)
logs.print_info("Zakończono analizowanie biblioteki")
logs.print_info("Ładowanie przerw...")
start_connection()
logs.print_warning("Klient sMusic gotowy")
try:
while True:
time.sleep(100)
except (KeyboardInterrupt, SystemExit):
logs.print_info("Zatrzymywanie kontroli przerw...")
thread_gap.stop()
logs.print_info("Zatrzymano kontrolę przerw!")
logs.print_info("Rozłączanie z serwerem...")
thread_conn.stop()
logs.print_info("Rozłączono z serwerem!")
logs.print_warning("Zakończono pracę klienta")