Example #1
0
    def load(self, songPath):
        # Load projectiles
        self._laser = Laser(self._windowWidth * 1.5)

        # Load player
        self._playerSpawnPos = (self._windowWidth / 2, self._windowHeight / 2)
        self._player = Player(ContentManager.load_image('media/actors/player.png'), self._laser, self._playerSpawnPos)
        self._playerGroup.add(self._player)

        # Load HUD
        fontPath = 'media/fonts/freesansbold.ttf'
        self._font = ContentManager.load_font(fontPath, 36)
        self._scoreSprite = TextSprite(self._font, pygame.Color('white'), (30, 30))
        self._livesSprite = TextSprite(self._font, pygame.Color('white'), (30, 70))
        self._livesSprite.updateText('Lives: ' + str(self._lives))
        self._hudGroup.add(self._scoreSprite, self._livesSprite)

        # Load music configuration
        #songPath = 'media/music/battlefield1942'
        #songPath = 'media/music/test'

        # Load game director
        self._gameDirector = GameDirector(self)
        self._gameDirector.load(self._player, songPath)

        # Load music
        self._musicPlayer = MusicPlayer()
        self._musicPlayer.load(songPath + '.mid')
        self._musicPlayer.play()
Example #2
0
 def __init__(self):
     self.neural_network = None
     self.melody = None
     self.music_player = MusicPlayer()
     self.duration = None
     self.data_set = None
     self.unique_events_list = None
Example #3
0
def main():
  """ Initialize radio and play sounds """
  music_directory = 'music'

  global mp
  mp = MusicPlayer(music_directory) # Must create mp before pygame.init()

  pygame.init()
  display = pygame.display.set_mode((800,600),0,32)
  pygame.display.set_caption("radio.py")

  mp.start_random_queue()

  print("Press S to skip the current song.")
  print("Press P to return to the previous song.")

  # Wait for an interrupt
  exit = False
  while (exit == False):
    # Can call non-radio.py application functions in this loop
    if (handle_events() == 'EXIT'):
      exit = True

  # Terminate gracefully
  pygame.quit()
  sys.exit()
 def __init__(self, master, alarm, *args, **kwargs):
     TextWidget.__init__(self, master, Position(0.95, 0.01),
                         "alarm set at: " + alarm.getTime(), *args,
                         **kwargs)
     self.root = master
     self.alarm = alarm
     self.allAlarms = [self.alarm]
     self.musicPlayer = MusicPlayer(alarm.getSound())
     self.alarmLength = 20
     self.startChecker()
def main():
    """
    Controls the games flow.
    Loads menus and game.
    """
    # DEBUG MODE
    # -Shows intercept targets.
    # -Prints spawns to the console.
    # -No player damage
    # -Infinite smg ammunition.
    # -Scores not counted.

    DEBUG = False
    params = (setUpScreen(), FPS, pygame.time.Clock(), MusicPlayer(DEBUG),
              SFXPlayer())
    state = 0

    while True:
        while (state == 0):  # Main menu
            state = MainMenu(params, DEBUG).run()
        while (state == 1):  # Game
            state = Game(params, DEBUG).run()
        while (state == 2):  # Game Over
            state = GameOver(params, DEBUG).run()
        while (state == 3):  # Options
            (state, DEBUG) = OptionsMenu(params, DEBUG).run()
        while (state == 4):  # Scores
            state = HighScores(params, DEBUG).run()
        while (state == 5):
            state = InstructionsMenu(params, DEBUG).run()
Example #6
0
class MusicProcessor(object):

    client_processor = ClientProcessor()
    playlist_processor = PlaylistProcessor()
    music_player = MusicPlayer()

    def play(self, rfid, client_id, play_mode=None):
        try:
            location = self.client_processor.get_location(client_id)
            print("Playing music in location: " + str(location))
            playlist = self.playlist_processor.get_playlist(rfid)
            print("Playing playlist: " + playlist)
            self.music_player.play(playlist, location, play_mode)
        except TypeError:
            print("Issue With Client ID: {}, RF ID: {}".format(
                client_id, rfid))
            new_playlist = input("Playlist Name:")
            if len(new_playlist) > 0:
                result = self.playlist_processor.add_playlist(
                    new_playlist, rfid)
                print(result)

    def command(self, command, client_id):
        location = self.client_processor.get_location(client_id)
        print("Running command in location: " + str(location))
        if command == "volume_up":
            self.music_player.volume_up(location)
        if command == "volume_down":
            self.music_player.volume_down(location)
Example #7
0
async def game(ctx, game):
    global options
    global bah
    if(game.upper() == "AMQ"):
        channel = ctx.channel
        # get info to start game
        await channel.send('State number of rounds\nDefault: 20', delete_after=40)

        def check(m):
            global options
            check_bool = True
            options = m.content
            # if the parameter they passed in isnt an integer then
            # ignore it until they pass one in
            try:
                options = int(options)
            except Exception:
                check_bool = False
            return check_bool and m.channel == channel

        msg = await client.wait_for('message', check=check)

        await channel.send('Starting Game', delete_after=10)
        participants = ctx.guild.voice_client.channel.members
        anime_list = []
        # loop thur all participants and get the animelist username
        for people in participants:
            await bah.setup_profile(ctx.guild.id, people.id)
            if(await bah.get_animelist(ctx.guild.id, people.id) != None):
                anime_list.append(await bah.get_animelist(ctx.guild.id, people.id))
        if(len(anime_list) == 0):
            await channel.send('No one is logged in to anilist. Please log in to one via login command\nPlaying with Default list\nDefault List: https://anilist.co/user/woahs/', delete_after=40)
            current_game = Amq(client, participants,
                               ctx.message.channel, ctx.guild.voice_client,
                               MusicPlayer(client), rounds=options, time_sec=35.0,
                               anilist_wrapper=AnilistWrapper("https://graphql.anilist.co/"))
        else:
            current_game = Amq(client, participants,
                               ctx.message.channel, ctx.guild.voice_client,
                               MusicPlayer(client), rounds=options, time_sec=35.0,
                               anime_list=anime_list,
                               anilist_wrapper=AnilistWrapper("https://graphql.anilist.co/"))
        client.add_cog(current_game)
        await current_game.set_up()
        await current_game.play_game()
Example #8
0
    def __init__(self, sense):
        self.sense = sense
        self.FACE = 1, RobotFace(sense)
        self.RADIO = 2, Radio(sense)
        self.LIFE = 3, Life(sense, 8, 8)
        self.MUSICPLAYER = 4, MusicPlayer(sense)

        self.stateList = (self.FACE, self.RADIO, self.LIFE, self.MUSICPLAYER)

        # Start with some state
        self.current = self.MUSICPLAYER
        self.current[1].select()
Example #9
0
class MusicControlSystem(object):
    pins = [31, 33, 35, 37]
    player = MusicPlayer()
    currentValues = [1, 1, 1, 1]
    wasPlaying = False
    leverController = None
    ambient_pos = 0.0

    def __init__(self):
        self.leverController = LeverInputController(self.handle_change)
        self.player.set_volume(0.4)
        self.player.play_song('/home/pi/bluechz/sound/LabAmbient.ogg', 0.25)

    def handle_change(self, values):
        try:
            print 'Triggered currentValues={}'.format(values)
            play = False
            for i in range(4):
                if values[i] == 0:
                    play = True

            if not self.wasPlaying:
                self.ambient_pos = self.player.get_pos()

            if play:
                volume = 0.99
                self.wasPlaying = True
                if values[0] == 0:
                        self.player.play_song('/home/pi/bluechz/sound/Success! - Blue Sky.ogg', volume)
                elif values[1] == 0:
                        self.player.play_song('/home/pi/bluechz/sound/Failure 3 - Escape Velocity.ogg', volume)
                elif values[2] == 0:
                        self.player.play_song('/home/pi/bluechz/sound/Failure 1 - Time Warp.ogg', volume)
                elif values[3] == 0:
                        self.player.play_song('/home/pi/bluechz/sound/Intro Spiel.ogg', volume)
            else:
                self.player.stop_music()
                self.player.play_song('/home/pi/bluechz/sound/LabAmbient.ogg', 0.35, loops=10)
                self.wasPlaying = False
        except RuntimeError:
            print 'got an error!'
class AlarmWidget(TextWidget):
    def __init__(self, master, alarm, *args, **kwargs):
        TextWidget.__init__(self, master, Position(0.95, 0.01),
                            "alarm set at: " + alarm.getTime(), *args,
                            **kwargs)
        self.root = master
        self.alarm = alarm
        self.allAlarms = [self.alarm]
        self.musicPlayer = MusicPlayer(alarm.getSound())
        self.alarmLength = 20
        self.startChecker()

    def getAlarmLength(self):
        return self.alarmLength

    def setAlarmlength(self, seconds):
        self.alarmLength = seconds

    def setNewAlarm(self, alarm):
        self.allAlarms.append(alarm)

    def notifyNewAlarm(self, alarm):
        self.changeText("Alarm set at" + alarm.getTime())
        self.make()
        self.root.after(3000, self.place_forget)

    def alarmProtocol(self, seconds, alarm, repeats):
        def colourChanger(flag, counter, maxCounter):
            if counter < maxCounter:
                if flag == True:
                    self.root.changeBackground('white')
                    newCounter = counter + 1
                    self.root.after(500, colourChanger, False, newCounter,
                                    maxCounter)
                else:
                    self.root.changeBackground('black')
                    newCounter = counter + 1
                    self.root.after(500, colourChanger, True, newCounter,
                                    maxCounter)
            else:
                self.root.changeBackground('white')
                if repeats > 0:
                    self.root.after(
                        30000, self.alarmProtocol, self.getAlarmLength(),
                        Alarm(alarm.getTime(), alarm.getSound(), True),
                        repeats - 1)

        colourChanger(True, 0, seconds * 2)
        self.musicPlayer.newSong(alarm.getSound)
        self.root.after(seconds * 1000, self.musicPlayer.pause)

    def startChecker(self):
        '''
        Starts Checking the alarm
        '''
        self.__alarmChecker()

    def __alarmChecker(self):
        '''
        starts an infinite loop checking for an alarm
        '''
        stringTime = self.__timeMaker()
        timeToAlarm = {}
        for alarm in self.allAlarms:
            timeToAlarm[alarm.getTime()] = alarm
        if stringTime in timeToAlarm.keys():
            possibleAlarm = timeToAlarm[stringTime]
            if possibleAlarm.getActivity():
                self.alarmProtocol(self.getAlarmLength(),
                                   timeToAlarm[stringTime], 1)
                possibleAlarm.deactivate()
        self.after(6000, self.__alarmChecker)

    def __timeMaker(self):
        currentTime = datetime.datetime.now()
        hour = str(currentTime.hour)
        minute = str(currentTime.minute)
        if int(minute) < 10:
            minute = '0' + minute
        if int(hour) < 10:
            hour = '0' + hour

        return hour + minute

    def stop(self):
        self.destroy()
        self.musicPlayer.shutdown()

    def __str__(self):
        return "AlarmWidget present"
Example #11
0
    def run(self):
        try:
            self.left_win.move(2, 2)
            p = MusicPlayer()
            player_started = False
            while True:
                self.right_win.refresh()
                self.left_win.refresh()
                if player_started:
                    try:
                        position_int = p.position
                        if self.set_progress(position_int):
                            if DEBUG: logging.info("set_progress true")
                            p.stop_song()
                            self.play_next_song(p)
                    except:
                        continue
                self.left_win.refresh()
                rlist, _, _ = select([sys.stdin], [], [], 1)
                if not rlist:
                    continue
                ch = self.left_win.getch()
                if DEBUG: logging.info("getch: %c" %ch)
                cursor_y, cursor_x = self.left_win.getyx()
                if ch == ord('c'):
                    if cursor_x != 2:
                        self.left_win.move(2, 2)
                        continue
                    if player_started:
                        self.stop_and_remove(p, self.current_song_info['url'])
                    player_started = False # Can't leave out this
                    current_channel = self.get_channel_to_play(cursor_y)
                    if current_channel == None:
                        continue
                    self.current_channel = current_channel
                    player_started = True
                    self.dbfm.change_channel(self.current_channel)
                    self.play_next_song(p)
                    self.left_win.move(cursor_y, cursor_x)
                elif ch == ord('n'):
                    if not player_started:
                        continue
                    self.stop_and_remove(p, self.current_song_info['url'])
                    self.play_next_song(p)
                elif ch == ord('r'):
                    if not self.dbfm.is_logined():
                        self.add_console_output('Please log in first! Press "l".')
                        continue
                    if self.current_song_info['like'] == 1:
                        self.add_console_output('Already hearted!')
                        continue
                    if self.dbfm.rate_song(self.current_channel['channel_id'], True)['r'] == 0:
                        self.add_console_output("Hearted %s successfully!" %self.current_song_info['title'])
                        self.current_song_info['like'] = 1
                        self.show_song_info(self.current_song_info)
                    else:
                        self.add_console_output("Hearted %s failure!" %self.current_song_info['title'])
                elif ch == ord('u'):
                    if not self.dbfm.is_logined():
                        self.add_console_output('Please log in first! Press "l".')
                        continue
                    if self.current_song_info['like'] == 0:
                        self.add_console_output("Haven't hearted yet!")
                        continue
                    if self.dbfm.rate_song(self.current_channel['channel_id'], False)['r'] == 0:
                        self.add_console_output("Unhearted %s successfully!" %self.current_song_info['title'])
                        self.current_song_info['like'] = 0
                        self.show_song_info(self.current_song_info)
                    else:
                        self.add_console_output("Unhearted %s failure!" %self.current_song_info['title'])

                elif ch == ord('j') or ch == curses.KEY_DOWN:
                    if cursor_y <= (MAX_CHANNEL + 2) * 2:
                        self.left_win.move(cursor_y + 2, 2)
                    else:
                        continue
                elif ch == ord('k') or ch == curses.KEY_UP:
                    if cursor_y > 2:
                        self.left_win.move(cursor_y - 2, 2)
                    else:
                        continue
                elif ch == ord('p'):
                    p.toggle_paused_song()
                elif ch == ord('l'):
                    if self.dbfm.login(self.user_email, self.user_password):
                        self.add_console_output("Successfully log in!")
                    else:
                        self.add_console_output('Failed to log in!')
                else:
                    self.stop_and_remove(p, self.current_song_info['url'])
                    break
        except Exception, e:
            if player_started and self.current_song_info != None:
                self.stop_and_remove(p, self.current_song_info['url'])
            if DEBUG: logging.info(e)
Example #12
0
def main():
    music_player = MusicPlayer()

    print('Hello! Welcome to Panda Music Player!')
    print('/Panda because I could not figure out another name.../')
    print('Type "list" to show all commads')
    show_commands()
    switchOn = True
    while (switchOn):
        input_command = input('Type command here: ')
        if input_command == "Q":
            music_player.stop_playing_all()
            switchOn = False
            break
        elif input_command == "D":
            directory = input('Write the path to your directory: ')
            music_player.add_songs_from_dir(directory)
        elif input_command == "SM":
            shuffle = bool(input('write True or False'))
            music_player.change_shuffle_mode(shuffle)
        elif input_command == "RM":
            repeat = bool(input('write True or False'))
            music_player.change_shuffle_mode(repeat)
        elif input_command == "P":
            music_player.stop_playing_all()
            music_player.play_next_song()
        elif input_command == "S":
            music_player.stop_playing_all()
        elif input_command == "SP":
            music_player.show_playlist()
        elif input_command == "list":
            show_commands()
        else:
            print('Invalid command!')
Example #13
0
'''main here '''
from MusicPlayer import MusicPlayer
from Song import Song
from Artist import Artist
from Band import Band
from Album import Album
from PlayList import PlayList
from random import randint
import operator


MP = MusicPlayer()
while True:
    print("Welcome To Musicly \n 1. Playlists 2. Artists 3. Albums 4. Library 5. bands")
    choice = input("Enter Choice: ")
    if choice == "1":
        while True:
            choice2 = input("1. add new PlayList 2. Delete PlayList 3. View PlayList"
                            + " 4. View all PlayLists 5. back:\n")
            if choice2 == "1":
                playList = PlayList()
                playList.name = input("Enter PlayList name:")
                playList.description = input("Enter PlayList description:")
                playList.addPlayList()

            if choice2 == "2":
                pID = int(input("Enter # of PlayList:"))
                MP.retrievePlayLists()
                MP.myPlayLists[pID-1].deletePlayList()

            if choice2 == "3":
Example #14
0
        elif len(args) == 2 and args[0] == 'sp':
            url = args[1]
            item = SpotifyQueueItem(url)
            player.add_to_queue(item)
        elif len(args) == 1 and args[0] == 'next':
            player.skip_song()
        elif len(args) == 1 and args[0] == 'list':
            queue = "Items in queue:\r\n"
            queue += player.get_queue_string()
            bot.send_message(channel, queue)
        else:
            print_help(bot, ident.get_nick())

player_options = {}
if len(spotify_user) > 0:
    player_options['spotify_username'] = spotify_user
    player_options['spotify_password'] = spotify_pass
else:
    print("No spotify user found, disabling support")

player = MusicPlayer(player_options)
player.start()

bot = IrcClient(options)
bot.on('connected', on_connect)
bot.on('PRIVMSG', on_message)

bot.connect()
wait_for_connect.wait()
bot.join_channel(config.get('main', 'channel'))
Example #15
0
class GeneratorFacade:
    def __init__(self):
        self.neural_network = None
        self.melody = None
        self.music_player = MusicPlayer()
        self.duration = None
        self.data_set = None
        self.unique_events_list = None

    def is_model_loaded(self):
        if self.neural_network is None:
            return False
        return True

    def is_melody_generated(self):
        if self.melody is None:
            return False
        return True

    def load_model(self, file_path):
        if not file_path:
            return False
        if file_path.lower().endswith(
                RecurrentNeuralNetwork.model_file_format):
            self.neural_network = RecurrentNeuralNetwork.load_model(file_path)
        else:
            raise ValueError()
        return True

    def save_model(self, file_path):
        if file_path is None or self.neural_network is None:
            return
        self.neural_network.save_model(file_path)

    @staticmethod
    def get_model_file_format():
        return RecurrentNeuralNetwork.model_file_format

    def generate_melody(self, duration):
        if self.neural_network is None:
            return
        self.duration = duration
        ticks_per_second = (MidiConverter.ticks_per_beat *
                            MidiConverter.beats_per_minute) / 60
        number_of_ticks = duration * ticks_per_second
        number_of_notes = number_of_ticks / MidiConverter.delta_time_in_ticks
        self.melody = self.neural_network.generate(int(number_of_notes))

    def save_melody(self, file_path):
        if self.melody is None:
            return
        MidiConverter.write_midi_file(file_path, self.melody,
                                      self.neural_network.unique_events_list)

    def play_melody(self):
        file_object = MidiConverter.get_midi_file_object(
            self.melody, self.neural_network.unique_events_list)
        self.music_player.play(file_object)
        print('play melody')

    def stop_melody(self):
        self.music_player.stop()
        print('stop melody')

    def load_data_set(self, file_paths):
        self.data_set = []
        for file_path in file_paths:
            if not file_path.lower().endswith(('.mid', '.midi')):
                self.data_set = None
                raise ValueError()
            self.data_set.append(MidiConverter.convert_midi_file(file_path))
        self.unique_events_list = UniqueEventsList(self.data_set)
        self.unique_events_list.convert_data_set(self.data_set)

    def reset_data_set(self):
        self.data_set = None

    def is_data_set_loaded(self):
        if self.data_set is not None:
            return True
        return False

    def train(self, sequence_length, first_lstm_layer_size,
              second_lstm_layer_size, dropout_rate, number_of_epochs,
              test_sample_ratio, callbacks):
        self.neural_network = RecurrentNeuralNetwork(
            self.data_set, self.unique_events_list, sequence_length,
            first_lstm_layer_size, second_lstm_layer_size, dropout_rate)
        self.neural_network.train(number_of_epochs, test_sample_ratio,
                                  callbacks)
Example #16
0
class GameRound:

    START_LIVES = 3

    def __init__(self, noteWars, windowWidth, windowHeight):
        self._noteWars = noteWars
        self._windowWidth = windowWidth
        self._windowHeight = windowHeight

        self._enemiesGroup = pygame.sprite.Group()
        self._enemyDelaySec = 3.0
        self._enemyElapsedDelaySec = 0.0

        self._playerGroup = pygame.sprite.GroupSingle()
        self._hudGroup = pygame.sprite.Group()

        self._score = 0
        self._lives = self.START_LIVES

    def load(self, songPath):
        # Load projectiles
        self._laser = Laser(self._windowWidth * 1.5)

        # Load player
        self._playerSpawnPos = (self._windowWidth / 2, self._windowHeight / 2)
        self._player = Player(ContentManager.load_image('media/actors/player.png'), self._laser, self._playerSpawnPos)
        self._playerGroup.add(self._player)

        # Load HUD
        fontPath = 'media/fonts/freesansbold.ttf'
        self._font = ContentManager.load_font(fontPath, 36)
        self._scoreSprite = TextSprite(self._font, pygame.Color('white'), (30, 30))
        self._livesSprite = TextSprite(self._font, pygame.Color('white'), (30, 70))
        self._livesSprite.updateText('Lives: ' + str(self._lives))
        self._hudGroup.add(self._scoreSprite, self._livesSprite)

        # Load music configuration
        #songPath = 'media/music/battlefield1942'
        #songPath = 'media/music/test'

        # Load game director
        self._gameDirector = GameDirector(self)
        self._gameDirector.load(self._player, songPath)

        # Load music
        self._musicPlayer = MusicPlayer()
        self._musicPlayer.load(songPath + '.mid')
        self._musicPlayer.play()

    def spawnEnemy(self, enemy):
        spawnSide = int(random.uniform(0, 4))
        spawnDistance = random.random()
        spawnX = 0
        spawnY = 0

        if spawnSide == 0: # Left side
            spawnX = 0
            spawnY = self._windowHeight * spawnDistance
        elif spawnSide == 1: # Top side
            spawnX = self._windowWidth * spawnDistance
            spawnY = 0
        elif spawnSide == 2: # Right side
            spawnX = self._windowWidth
            spawnY = self._windowHeight * spawnDistance
        else: # Bottom side
            spawnX = self._windowWidth * spawnDistance
            spawnY = self._windowHeight

        enemy.setPosition((spawnX, spawnY))
        self._enemiesGroup.add(enemy)

    def update(self, elapsedTimeSec):
        self._enemyElapsedDelaySec += elapsedTimeSec

        # Check for collisions
        self._checkCollisions()

        # Update game entities
        self._playerGroup.update(elapsedTimeSec)
        self._enemiesGroup.update(elapsedTimeSec)
        self._hudGroup.update(elapsedTimeSec)

        # Invoke game director
        self._gameDirector.update(elapsedTimeSec)

        # Check whether the user wants to exit the game
        pressedKeys = pygame.key.get_pressed()
        if pressedKeys[K_BACKSPACE]:
            self._exitRound()

    def stop(self):
        self._musicPlayer.stop()
        self._gameDirector.stop()

    def _handlePlayerDeath(self):
        self._lives -= 1

        if self._lives < 0:
            self.stop()
            self._noteWars.goToMainMenuWithLose(self._score)
        else:
            self._livesSprite.updateText('Lives: ' + str(self._lives))
            self._enemiesGroup.empty()
            self._player.setPosition(self._playerSpawnPos)

    def roundComplete(self):
        self.stop()
        self._noteWars.goToMainMenuWithWin(self._score)

    def _exitRound(self):
        self.stop()
        self._noteWars.goToMainMenu()

    def _checkCollisions(self):
        # Check collisions between laser and enemies
        collidedEnemies = []
        if self._laser.isFiring():
            for enemy in self._enemiesGroup.sprites():
                if CollisionMethods.collideLineToRect(self._laser.getFiredFromPos(),
                                                      self._laser.getFiredToPos(),
                                                      enemy.rect):
                    collidedEnemies.append(enemy)

            self._score += len(collidedEnemies) * 100
            self._scoreSprite.updateText('Score: ' + str(self._score))

            for enemy in collidedEnemies:
                enemy.kill()

        # Check collisions between player and enemies
        collidedEnemies = pygame.sprite.spritecollide(self._player, self._enemiesGroup, True, CollisionMethods.collideRectThenMask)
        if collidedEnemies:
            self._handlePlayerDeath()

    def draw(self, screen):
        self._laser.draw(screen)
        self._playerGroup.draw(screen)
        self._enemiesGroup.draw(screen)

        [text.render() for text in self._hudGroup.sprites()]
        self._hudGroup.draw(screen)
Example #17
0
import threading
import time
from MusicPlayer import MusicPlayer

mp = MusicPlayer()


class BackgroundTimer(threading.Thread):

    # create a thread object that will do the counting in the background

    def __init__(self, interval=1):
        # init the thread
        threading.Thread.__init__(self)
        self.__interval = interval  # seconds
        # initial value
        self.__value = 0
        # controls the while loop in method run
        self.__alive = False
        # Sets time for end of song
        self.__endOfSong = 0
        mp.checkMusic()

    def run(self):
        # this will run in its own thread via self.start()
        self.__alive = True
        while self.__alive:
            time.sleep(self.__interval)
            # update count value
            self.__value += self.__interval
            print(self.__value)