Esempio n. 1
0
        # 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
            if sleep_mode_sleeping == False:
                # set the screen depending on settings
                if sleep_mode_output == "logo":
                    ink_printer.show_image('/home/pi/music-screen-api/sonos-black-small.png')
                else:
                    ink_printer.blank_screen()
            
            # if going to sleep is enabled then put it into sleep mode
            if sleep_mode_enabled == True:
                sleep_mode_sleeping = True
                previous_track_name = ""
                print ("Nothing playing, sleep mode")

    if sleep_mode_sleeping == False:
        time.sleep (frequency)
        print ("Waiting " + str(frequency) + " seconds")
    else:
        time.sleep (sleep_mode_frequency)
        print ("Waiting " + str(frequency) + " seconds as in sleep mode")
Esempio n. 2
0
        # 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
            if sleep_mode_sleeping == False:
                # set the screen depending on settings
                if sleep_mode_output == "logo":
                    ink_printer.show_image(
                        '/home/pi/music-screen-api/sonos-inky.png')
                else:
                    ink_printer.blank_screen()

            # if going to sleep is enabled then put it into sleep mode
            if sleep_mode_enabled == True:
                sleep_mode_sleeping = True
                previous_track_name = ""
                print("Nothing playing, sleep mode")

    if sleep_mode_sleeping == False:
        time.sleep(frequency)
        print("Waiting " + str(frequency) + " seconds")
    else:
        time.sleep(sleep_mode_frequency)
        print("Waiting " + str(frequency) + " seconds as in sleep mode")