Ejemplo n.º 1
0
	def fill(self, target_song_length = None):
		self._add_from_queue()
		# ONLY RUN _ADD_REQUESTS ONCE PER FILL
		self._add_requests()
		for i in range(len(self.songs), self._num_songs):
			if not target_song_length and len(self.songs) > 0 and 'length' in self.songs[0].data:
				target_song_length = self.songs[0].data['length']
				log.debug("elec_fill", "Second song in election, aligning to length %s" % target_song_length)
			song = playlist.get_random_song_timed(self.sid, target_song_length)
			song.data['entry_votes'] = 0
			song.data['entry_type'] = ElecSongTypes.normal
			song.data['elec_request_user_id'] = 0
			song.data['elec_request_username'] = None
			self._check_song_for_conflict(song)
			self.add_song(song)
Ejemplo n.º 2
0
 def fill(self, target_song_length=None):
     self._add_from_queue()
     # ONLY RUN _ADD_REQUESTS ONCE PER FILL
     self._add_requests()
     for i in range(len(self.songs), self._num_songs):
         if not target_song_length and len(
                 self.songs) > 0 and 'length' in self.songs[0].data:
             target_song_length = self.songs[0].data['length']
             log.debug(
                 "elec_fill",
                 "Second song in election, aligning to length %s" %
                 target_song_length)
         song = playlist.get_random_song_timed(self.sid, target_song_length)
         song.data['entry_votes'] = 0
         song.data['entry_type'] = ElecSongTypes.normal
         song.data['elec_request_user_id'] = 0
         song.data['elec_request_username'] = None
         self._check_song_for_conflict(song)
         self.add_song(song)
Ejemplo n.º 3
0
 def _fill_get_song(self, target_song_length):
     return playlist.get_random_song_timed(self.sid, target_song_length)
Ejemplo n.º 4
0
	def _fill_get_song(self, target_song_length):
		return playlist.get_random_song_timed(self.sid, target_song_length)
Ejemplo n.º 5
0
	def test_random_select(self):
		playlist.Song.load_from_file("tests/test1.mp3", [1])
		self.assertNotEqual(None, playlist.get_random_song_timed(1, 1))
		self.assertNotEqual(None, playlist.get_random_song(1))
		self.assertNotEqual(None, playlist.get_random_song_ignore_requests(1))
		self.assertNotEqual(None, playlist.get_random_song_ignore_all(1))
Ejemplo n.º 6
0
 def test_random_select(self):
     playlist.Song.load_from_file("tests/test1.mp3", [1])
     self.assertNotEqual(None, playlist.get_random_song_timed(1, 1))
     self.assertNotEqual(None, playlist.get_random_song(1))
     self.assertNotEqual(None, playlist.get_random_song_ignore_requests(1))
     self.assertNotEqual(None, playlist.get_random_song_ignore_all(1))