Esempio n. 1
0
	def getPlaylist(self,playlistName):
		if (self.legacymode):
			logger.info("getPlaylist is disabled in legacy mode.")
			return Playlist(playlistName)
		else:
			for playlist in self.il['Playlists']:
				if playlist['Name'] == playlistName:
					#id 	playlist_id 	track_num 	url 	title 	album 	artist 	length 	uniqueid
					p = Playlist(playlistName)
					tracknum=1
					#Make sure playlist was not empty
					if 'Playlist Items' in playlist:
						for track in playlist['Playlist Items']:
							id=int(track['Track ID'])
							t = PlTrack()
							t.number = tracknum
							t.name = self.songs[id].name
							t.artist = self.songs[id].artist
							t.album = self.songs[id].album
							t.length = self.songs[id].length
							t.location = self.songs[id].location
							#album
							tracknum+=1
							p.tracks.append(t)
					return p
Esempio n. 2
0
 def getPlaylist(self, playlistName):
     if (self.legacymode):
         logger.info("getPlaylist is disabled in legacy mode.")
         return Playlist(playlistName)
     else:
         for playlist in self.il['Playlists']:
             if playlist['Name'] == playlistName:
                 #id 	playlist_id 	track_num 	url 	title 	album 	artist 	length 	uniqueid
                 p = Playlist(playlistName)
                 p.is_folder = True if 'Folder' in playlist and playlist[
                     'Folder'] == True else False
                 if 'Playlist Persistent ID' in playlist:
                     p.playlist_persistent_id = playlist[
                         'Playlist Persistent ID']
                 if 'Parent Persistent ID' in playlist:
                     p.parent_persistent_id = playlist[
                         'Parent Persistent ID']
                 tracknum = 1
                 #Make sure playlist was not empty
                 if 'Playlist Items' in playlist:
                     for track in playlist['Playlist Items']:
                         id = int(track['Track ID'])
                         t = self.songs[id]
                         t.playlist_order = tracknum
                         tracknum += 1
                         p.tracks.append(t)
                 return p
Esempio n. 3
0
	def getPlaylist(self,playlistName):
		if (self.legacymode):
			logger.info("getPlaylist is disabled in legacy mode.")
			return Playlist(playlistName)
		else:
			for playlist in self.il['Playlists']:
				if playlist['Name'] == playlistName:
					#id 	playlist_id 	track_num 	url 	title 	album 	artist 	length 	uniqueid
					p = Playlist(playlistName)
					p.is_folder = True if 'Folder' in playlist and playlist['Folder'] == True else False
					if 'Playlist Persistent ID' in playlist:
						p.playlist_persistent_id = playlist['Playlist Persistent ID']
					if 'Parent Persistent ID' in playlist:
						p.parent_persistent_id = playlist['Parent Persistent ID']
					tracknum=1
					#Make sure playlist was not empty
					if 'Playlist Items' in playlist:
						for track in playlist['Playlist Items']:
							id=int(track['Track ID'])
							t = self.songs[id]
							t.playlist_order = tracknum
							tracknum+=1
							p.tracks.append(t)
					return p
Esempio n. 4
0
	def parsePlaylists(self,dictionary,songs):
		playlists = []
		for playlist,attributes in dictionary.iteritems():
			p = Playlist()
			p.itunes_id = playlist
			p.name = attributes.get('Name')
			p.visible = attributes.get('Visible')
			p.allItems = attributes.get('All Items')
			p.playlistPersistentId = attributes.get('Playlist Persistent Id')
			p.playlistId = attributes.get('Playlist Id')

			for songId in attributes.get('Playlist Items',[]):
				p.songs.append(self._buildSong(songId,songs[songId]))

			playlists.append(p)

		return playlists