Beispiel #1
0
        sleep_mode_sleeping = False
        number_of_sheep_counted = 0
       
        # see if there is new data to display
        if current_track == previous_track_name:  #check if the track name is same as what we displayed last time
            print ("no change to data - not refreshing")
        else:
            print ("new data found from api - refreshing screen")
            previous_track_name = current_track

            # demaster the track name if set to do so
            if sonos_settings.demaster == True:
                current_track = demaster.strip_name (current_track)

            #print to the ink
            ink_printer.print_text_to_ink (current_track, current_artist, current_album)

            # keep a record of the previous track name to see if it changes next time
    else:
        # nothing is playing right now

        # ... but check whether this is just a momentary pause
        if number_of_sheep_counted <= sleep_mode_sheep_to_count:
            # not enough sleep counted yet to go to sleep - add one
            number_of_sheep_counted = number_of_sheep_counted + 1
            print ("Counting " + str(number_of_sheep_counted) + " sheep")
        
        else:
            # if enough sheep have been counted then put into sleep mode
        
            # check if the screen is already blank, if not make it blank
Beispiel #2
0
        if display_stats == True:
            # find more info
            played_all_time = lastfm_user_data.playcount(
                requested_username, "") + " all time"
            played_this_year = lastfm_user_data.playcount(
                requested_username, "this_year") + " this year"
            played_this_month = lastfm_user_data.playcount(
                requested_username, "this_month") + " this month"
            played_this_week = lastfm_user_data.playcount(
                requested_username, "this_week") + " this week"
            played_today = lastfm_user_data.playcount(requested_username,
                                                      "today") + " today"

        if display_stats == True:
            # print to the ink
            ink_printer.print_text_to_ink(lastplayed_track, lastplayed_artist,
                                          lastplayed_album, played_all_time,
                                          played_this_year, played_this_month,
                                          played_this_week, played_today)

        if display_stats == False:
            #print to the ink
            ink_printer.print_text_to_ink(lastplayed_track, lastplayed_artist,
                                          lastplayed_album)

        # keep a record of the previous track name to see if it changes next time
        previous_track_name = lastplayed_track

    print("Waiting " + str(frequency) + " seconds")
    time.sleep(frequency)