music-duplicates: python3 compatibility

Open files in binary mode instead of text mode.
This commit is contained in:
Mike Swanson 2019-09-04 18:28:01 -07:00
parent 60cf1dee6e
commit 140f01f39a

View file

@ -20,7 +20,7 @@ def get_music_tracks():
result = {}
musics_path = os.path.join(os.path.dirname(sys.argv[0]), '../musics')
for mus in glob('%s/*.mid' % musics_path):
with open(mus) as f:
with open(mus, 'rb') as f:
contents = f.read()
m = hashlib.sha1()
m.update(contents)
@ -81,4 +81,3 @@ print_report('Phase 1 tracks:', phase1_tracks)
print_report('Phase 2 tracks:', phase2_tracks)
print_report('FreeDM tracks:', freedm_tracks)
print_report('Other tracks:', other_tracks)