Overwrite track file with unique tracks

This commit is contained in:
Ritiek Malhotra
2018-10-02 12:36:55 +05:30
parent 667477a4be
commit e076d11a19
3 changed files with 60 additions and 9 deletions

View File

@@ -158,6 +158,23 @@ def get_splits(url):
return splits
def get_unique_tracks(text_file):
"""
Returns a list of unique tracks given a path to a
file containing tracks.
"""
with open(text_file, 'r') as listed:
# Read tracks into a list and remove any duplicates
lines = listed.read().splitlines()
# Remove blank and strip whitespaces from lines (if any)
lines = [line.strip() for line in lines if line.strip()]
lines = remove_duplicates(lines)
return lines
# a hacky way to user's localized music directory
# (thanks @linusg, issue #203)
def get_music_dir():