Skip to content

Commit

Permalink
The cluster module works correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
meuse committed May 16, 2013
1 parent 403bcfd commit e138eb9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Binary file modified .cluster_module.py.swp
Binary file not shown.
11 changes: 7 additions & 4 deletions cluster_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ def cluster(self, dataset):
#edit the dataset so that it contains only artist name and not
#artist popularity
artistdataset = dataset['data']

newartistdataset = []
for i in range(0, len(artistdataset)):
newartistdataset.append(artistdataset[i][0][0])
if (len(artistdataset[i]) != 0):
newartistdataset.append(artistdataset[i][0][0])

print "clustering " + str(len(artistdataset)) + " artists"

Expand Down Expand Up @@ -108,8 +110,6 @@ def getPlayingStations(self, artist):

#gets the set of currently playing stations
playingStationSet = sr.getStationPlayingArtist(artist)

print playingStationSet

#gets the set of historically played stations
historicalStationSet = db.getStationTuplesForArtist(artist)
Expand All @@ -125,6 +125,7 @@ def getPlayingStations(self, artist):

mergedict[itemId] = itemcount
mergelist.append((itemId, itemName, False))
#mergelist.append(item)
itemcount = itemcount + 1

#add only the unique stations from now playing
Expand All @@ -139,10 +140,12 @@ def getPlayingStations(self, artist):
if (mergedict.has_key(itemId)):
itemnumber = mergedict[itemId]
mergelist[itemnumber] = item

#else append the station to the top of the list
#and add the station to the db
else:
mergelist.insert(0, (itemId, itemName, True, itemCT))
#mergelist.insert(0, (itemId, itemName, True, itemCT))
mergelist.insert(0, item)
db.addStationForArtist(artist, (itemName, itemId, itemLC))

#get set of artists for each station
Expand Down
Binary file modified cluster_module.pyc
Binary file not shown.

0 comments on commit e138eb9

Please sign in to comment.