-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsubimporter.py
31 lines (28 loc) · 1.01 KB
/
subimporter.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
# Migration imports
from subhost import Subhost
from migrater import Migrater
import logging
logger = logging.getLogger(__name__)
def createClient(hostConfig):
return Subhost(
hostConfig['host'],
hostConfig['username'],
hostConfig['password'],
hostConfig['port'],
hostConfig['legacy'],
hostConfig['version'])
def run(config):
# Get clients for the source and targer servers
source = createClient(config.source)
target = createClient(config.target)
logger.info(f"Migrating from {source} to {target}")
# Init migrater
migrater = Migrater(source, target, mock=config.mockMigration)
# Migrate playlists if required
logger.info(f"Migrate playlists? {config.migratePlaylists}")
if config.migratePlaylists:
migrater.migratePlaylists(interactive=config.migratePlaylistsInteractive)
# Migrate starred songs
logger.info(f"Migrate starred items? {config.migrateStarred}")
if config.migrateStarred:
migrater.migrateStarred()