Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accommodated Deprecation Warning: 'The readPlist function is deprecat… #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions playlist/playlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
import plistlib
import numpy as np

def getPlist(fileName):
with open(fileName, 'rb') as fp:
plist = plistlib.load(fp)
return plist

def findCommonTracks(fileNames):
"""
Expand All @@ -25,8 +29,11 @@ def findCommonTracks(fileNames):
for fileName in fileNames:
# create a new set
trackNames = set()
# line below throws warning: deprecated in 3.4 load recommended
# plist = plistlib.readPlist(fileName)
# readPlist called multiple times so getPlist(fileName) added
# read in playlist
plist = plistlib.readPlist(fileName)
plist = getPlist(fileName)
# get the tracks
tracks = plist['Tracks']
# iterate through tracks
Expand Down Expand Up @@ -57,8 +64,11 @@ def plotStats(fileName):
"""
Plot some statistics by readin track information from playlist.
"""
# line below throws warning: deprecated in 3.4 load recommended
# plist = plistlib.readPlist(fileName)
# readPlist called multiple times so getPlist(fileName) added
# read in playlist
plist = plistlib.readPlist(fileName)
plist = getPlist(fileName)
# get the tracks
tracks = plist['Tracks']
# create lists of ratings and duration
Expand Down Expand Up @@ -104,8 +114,12 @@ def findDuplicates(fileName):
Find duplicate tracks in given playlist.
"""
print('Finding duplicate tracks in %s...' % fileName)
# line below throws warning: deprecated in 3.4 load recommended
# plist = plistlib.readPlist(fileName)
# readPlist called multiple times so getPlist(fileName) added
# read in playlist
plist = plistlib.readPlist(fileName)
plist = getPlist(fileName)

# get the tracks
tracks = plist['Tracks']
# create a track name dict
Expand Down