Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

quick change to the selection algorithm

realized that i'd be missing all those singles that I downloaded just
because I liked just that song.

now if track is the only one in a given album, so long as it beats the
delimiter (instead of the avg + the delimiter), it also gets included.
  • Loading branch information...
commit 12c6b1153747f9b53d1ac813eb2ff49b07ef6b91 1 parent abd6602
@plukevdh authored
Showing with 5 additions and 3 deletions.
  1. +2 −0  README.md
  2. +3 −3 counter.rb
View
2  README.md
@@ -1,3 +1,5 @@
+> "It's like a better genius playlist generator because it makes you the genius"
+
Based on this tweet: https://twitter.com/joshaber/status/175230633033994240
__For realz.__
View
6 counter.rb
@@ -28,12 +28,12 @@ def [](value)
# get counts and reject minmax
counts = tracks.map &:playedCount
- counts -= counts.minmax unless counts.count < 2
+ counts -= counts.minmax unless counts.count < 3
- next if counts.empty? || counts == 0
+ next if counts.empty?
avg = ( counts.inject(0,&:+) / counts.count )
- tracks.select { |track| track.playedCount > (avg + DELIMITER) }
+ tracks.select { |track| track.playedCount >= (avg + DELIMITER) || ( counts.count == 1 && track.playedCount > DELIMITER ) }
end
itunes.add top_tracks.compact.map(&:location), to: itunes.sources["Library"].playlists[PLAYLIST]
Please sign in to comment.
Something went wrong with that request. Please try again.