-
Notifications
You must be signed in to change notification settings - Fork 3
/
sync.py
29 lines (22 loc) · 866 Bytes
/
sync.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
import os
class Sync(object):
def __init__(self, artist, title):
self.artist = artist
self.title = title
self.init_sync()
def init_sync(self):
if not os.path.exists('./synced'):
os.makedirs('./synced')
def save_synced_lyrics(self, synced_lyrics):
if not os.path.exists('./synced/' + self.artist):
os.makedirs('./synced/' + self.artist)
file = open('./synced/' + self.artist + '/' + self.title + '.sync', 'w')
file.write(synced_lyrics)
file.close()
def is_synced(self):
return os.path.isfile('./synced/' + self.artist + '/' + self.title + '.sync')
def get_synced_lyrics(self):
file = open('./synced/' + self.artist + '/' + self.title + '.sync', 'r')
synced_lyrics = file.read()
file.close()
return synced_lyrics