Skip to content

Commit

Permalink
LB-1503: popularity key in recordings.musicbrainz (#132)
Browse files Browse the repository at this point in the history
* LB-1503: popularity key in recordings.musicbrainz

Work in progress, to be tested later

* %3f to %.3f for float

* d to f typo
  • Loading branch information
geetikavadali authored Feb 24, 2024
1 parent c0c1427 commit 9218887
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions troi/print_recording.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def __init__(self):
self.print_genre = False
self.print_latest_listened_at = False
self.print_ranking = False
self.print_popularity = False

def _examine_recording_for_headers(self, recording):
# Look at the first item and decide which columns to show
Expand All @@ -40,6 +41,9 @@ def _examine_recording_for_headers(self, recording):

if recording.ranking:
self.print_ranking = True

if "popularity" in recording.musicbrainz:
self.print_popularity = True

def _print_recording(self, recording, year=False, listen_count=False, bpm=False, moods=False, genre=False):
""" Print out a recording, formatting it nicely to fit in a reasonably sized window.
Expand Down Expand Up @@ -79,6 +83,8 @@ def _print_recording(self, recording, year=False, listen_count=False, bpm=False,
print(" %4d" % recording.listenbrainz['listen_count'], end='')
if self.print_bpm or bpm:
print(" %3d" % recording.acousticbrainz['bpm'], end='')
if self.popularity or popularity:
print(" %.3f" % recording.musicbrainz['popularity'], end='')
if self.print_latest_listened_at:
if recording.listenbrainz["latest_listened_at"] is None:
print(" never ", end="")
Expand Down

0 comments on commit 9218887

Please sign in to comment.