Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def default(self, obj):
if isinstance(obj, PlaylistEntry):
return {
ActivePlaylistEntry.SERVER_ID_PARAM : obj.getServerId(),
ActivePlaylistEntry.PRIORITY_PARAM : obj.getPriority(),
ActivePlaylistEntry.LIBRARY_ID_PARAM : obj.getLibId(),
ActivePlaylistEntry.SONG_PARAM : obj.getSong(),
ActivePlaylistEntry.ARTIST_PARAM : obj.getArtist(),
ActivePlaylistEntry.ALBUM_PARAM : obj.getAlbum(),
ActivePlaylistEntry.VOTES_PARAM : obj.getVotes(),
ActivePlaylistEntry.TIME_ADDED_PARAM : obj.getTimeAdded(),
ActivePlaylistEntry.IS_DELETED_PARAM : obj.getIsDeleted(),
ActivePlaylistEntry.CLIENT_ID_PARAM : obj.getClientId()
}
else:
return json.JSONEncoder.default(self, obj)
def default(self, obj):
if isinstance(obj, PlaylistEntry):
return {
ActivePlaylistEntry.SERVER_ID_PARAM : obj.getServerId(),
ActivePlaylistEntry.PRIORITY_PARAM : obj.getPriority(),
ActivePlaylistEntry.LIBRARY_ID_PARAM : obj.getLibId(),
ActivePlaylistEntry.SONG_PARAM : obj.getSong(),
ActivePlaylistEntry.ARTIST_PARAM : obj.getArtist(),
ActivePlaylistEntry.ALBUM_PARAM : obj.getAlbum(),
ActivePlaylistEntry.VOTES_PARAM : obj.getVotes(),
ActivePlaylistEntry.TIME_ADDED_PARAM : obj.getTimeAdded(),
ActivePlaylistEntry.IS_DELETED_PARAM : obj.getIsDeleted(),
ActivePlaylistEntry.CLIENT_ID_PARAM : obj.getClientId()
}
else:
return json.JSONEncoder.default(self, obj)
def default(self, obj):
if isinstance(obj, PlaylistEntry):
return {
ActivePlaylistEntry.SERVER_ID_PARAM : obj.getServerId(),
ActivePlaylistEntry.PRIORITY_PARAM : obj.getPriority(),
ActivePlaylistEntry.LIBRARY_ID_PARAM : obj.getLibId(),
ActivePlaylistEntry.SONG_PARAM : obj.getSong(),
ActivePlaylistEntry.ARTIST_PARAM : obj.getArtist(),
ActivePlaylistEntry.ALBUM_PARAM : obj.getAlbum(),
ActivePlaylistEntry.VOTES_PARAM : obj.getVotes(),
ActivePlaylistEntry.TIME_ADDED_PARAM : obj.getTimeAdded(),
ActivePlaylistEntry.IS_DELETED_PARAM : obj.getIsDeleted(),
ActivePlaylistEntry.CLIENT_ID_PARAM : obj.getClientId()
}
else:
return json.JSONEncoder.default(self, obj)
def getObject(dbrow):
isDel = False
if(dbrow.isDeleted):
isDel = true
return ActivePlaylistEntry(
dbrow.plId,
dbrow.priority,
dbrow.libraryId,
dbrow.song,
dbrow.artist,
dbrow.album,
dbrow.voteCount,
dbrow.timeAdded,
isDel)
def default(self, obj):
if isinstance(obj, PlaylistEntry):
return {
ActivePlaylistEntry.SERVER_ID_PARAM : obj.getServerId(),
ActivePlaylistEntry.PRIORITY_PARAM : obj.getPriority(),
ActivePlaylistEntry.LIBRARY_ID_PARAM : obj.getLibId(),
ActivePlaylistEntry.SONG_PARAM : obj.getSong(),
ActivePlaylistEntry.ARTIST_PARAM : obj.getArtist(),
ActivePlaylistEntry.ALBUM_PARAM : obj.getAlbum(),
ActivePlaylistEntry.VOTES_PARAM : obj.getVotes(),
ActivePlaylistEntry.TIME_ADDED_PARAM : obj.getTimeAdded(),
ActivePlaylistEntry.IS_DELETED_PARAM : obj.getIsDeleted(),
ActivePlaylistEntry.CLIENT_ID_PARAM : obj.getClientId()
}
else:
return json.JSONEncoder.default(self, obj)
def getObject(dbrow):
isDel = False
if(dbrow.isDeleted):
isDel = true
return ActivePlaylistEntry(
dbrow.plId,
dbrow.priority,
dbrow.libraryId,
dbrow.song,
dbrow.artist,
dbrow.album,
dbrow.voteCount,
dbrow.timeAdded,
isDel)
def default(self, obj):
if isinstance(obj, PlaylistEntry):
return {
ActivePlaylistEntry.SERVER_ID_PARAM : obj.getServerId(),
ActivePlaylistEntry.PRIORITY_PARAM : obj.getPriority(),
ActivePlaylistEntry.LIBRARY_ID_PARAM : obj.getLibId(),
ActivePlaylistEntry.SONG_PARAM : obj.getSong(),
ActivePlaylistEntry.ARTIST_PARAM : obj.getArtist(),
ActivePlaylistEntry.ALBUM_PARAM : obj.getAlbum(),
ActivePlaylistEntry.VOTES_PARAM : obj.getVotes(),
ActivePlaylistEntry.TIME_ADDED_PARAM : obj.getTimeAdded(),
ActivePlaylistEntry.IS_DELETED_PARAM : obj.getIsDeleted(),
ActivePlaylistEntry.CLIENT_ID_PARAM : obj.getClientId()
}
else:
return json.JSONEncoder.default(self, obj)
def default(self, obj):
if isinstance(obj, PlaylistEntry):
return {
ActivePlaylistEntry.SERVER_ID_PARAM : obj.getServerId(),
ActivePlaylistEntry.PRIORITY_PARAM : obj.getPriority(),
ActivePlaylistEntry.LIBRARY_ID_PARAM : obj.getLibId(),
ActivePlaylistEntry.SONG_PARAM : obj.getSong(),
ActivePlaylistEntry.ARTIST_PARAM : obj.getArtist(),
ActivePlaylistEntry.ALBUM_PARAM : obj.getAlbum(),
ActivePlaylistEntry.VOTES_PARAM : obj.getVotes(),
ActivePlaylistEntry.TIME_ADDED_PARAM : obj.getTimeAdded(),
ActivePlaylistEntry.IS_DELETED_PARAM : obj.getIsDeleted(),
ActivePlaylistEntry.CLIENT_ID_PARAM : obj.getClientId()
}
else:
return json.JSONEncoder.default(self, obj)
def default(self, obj):
if isinstance(obj, PlaylistEntry):
return {
ActivePlaylistEntry.SERVER_ID_PARAM : obj.getServerId(),
ActivePlaylistEntry.PRIORITY_PARAM : obj.getPriority(),
ActivePlaylistEntry.LIBRARY_ID_PARAM : obj.getLibId(),
ActivePlaylistEntry.SONG_PARAM : obj.getSong(),
ActivePlaylistEntry.ARTIST_PARAM : obj.getArtist(),
ActivePlaylistEntry.ALBUM_PARAM : obj.getAlbum(),
ActivePlaylistEntry.VOTES_PARAM : obj.getVotes(),
ActivePlaylistEntry.TIME_ADDED_PARAM : obj.getTimeAdded(),
ActivePlaylistEntry.IS_DELETED_PARAM : obj.getIsDeleted(),
ActivePlaylistEntry.CLIENT_ID_PARAM : obj.getClientId()
}
else:
return json.JSONEncoder.default(self, obj)