-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
executable file
·56 lines (44 loc) · 1.68 KB
/
main.py
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
from devices import MTPDevice
from playlists import Playlist
from settings import Settings
print("Starting PY JAMZ!")
try:
device = MTPDevice.get_mtp_device(device_name=Settings.MTP_DEVICE_NAME)
print("Using device `{}` based on your settings.".format(device.name))
except Exception as e:
print('Checking for USB connected devices...')
devices = MTPDevice.get_mtp_devices()
while len(devices) == 0:
prompt = "Please connect a USB device and hit ENTER...\n"
input(prompt)
devices = MTPDevice.get_mtp_devices()
prompt = "Please enter the number of the MTP device to sync:\n"
for i, device in enumerate(devices):
prompt += "{}. {}\n".format(i, device)
device = devices[int(input(prompt))]
print("You chose {}".format(device))
try:
device.is_mounted()
except FileNotFoundError:
device.prompt_mount()
prompt = "Please enter the number of the MTP device root path:\n"
mtp_root_paths = device.list_mtp_device_root_paths()
for i, path in enumerate(mtp_root_paths):
prompt += "{}. {}\n".format(i, path)
mtp_root_path = mtp_root_paths[int(input(prompt))]
print("You chose {}".format(mtp_root_path))
device._set_mtp_device_root_path(mtp_root_path)
if Settings.MTP_DEVICE_MUSIC_DIR:
device.set_device_music_dir(Settings.MTP_DEVICE_MUSIC_DIR)
print('Using device music dir `{}` based on your settings'.format(Settings.MTP_DEVICE_MUSIC_DIR))
else:
device.choose_music_dir()
prompt = "Export playlists from Rhthymbox? y/n\n"
export = input(prompt)
export = True if 'y' in export else False
Playlist.jamz(
Settings.LOCAL_PLAYLISTS_DIR,
device.jamz_dir,
device.playlist_dir,
export_rb=export)
print("DONEZO FUNZO")