Advertisement
Guest User

Untitled

a guest
Jan 18th, 2020
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.08 KB | None | 0 0
  1. class User:
  2.         def __init__(self, response):
  3.             self.userid = int(response["user_id"])
  4.             self.username = response["username"]
  5.             self.join_date = Osu._parse_time(response["join_date"])
  6.             self.count300 = int(response["count300"])
  7.             self.count100 = int(response["count100"])
  8.             self.count50 = int(response["count50"])
  9.             self.playcount = int(response["playcount"])
  10.             self.ranked_score = int(response["ranked_score"])
  11.             self.total_score = int(response["total_score"])
  12.             self.rank = int(response["pp_rank"])
  13.             self.level = float(response["level"])
  14.             self.pp = float(response["pp_raw"])
  15.             self.acc = float(response["accuracy"])
  16.             self.rank_ss = float(response["count_rank_ss"])
  17.             self.rank_ssh = float(response["count_rank_ssh"])
  18.             self.rank_s = float(response["count_rank_s"])
  19.             self.rank_sh = float(response["count_rank_sh"])
  20.             self.rank_a = float(response["count_rank_a"])
  21.             self.country = response["country"]
  22.             self.time_played = int(response["total_seconds_played"])
  23.             self.rank_country = int(response["pp_country_rank"])
  24.             self.events = self.get_events(response["events"])
  25.        
  26.         def get_events(self, raw):
  27.             events = []
  28.             for e in raw:
  29.                 events.append(Event(e))
  30.             return events
  31.  
  32.     class Event:
  33.         def __init__(self, response):
  34.             self.html = response["display_html"]
  35.             self.beatmap_id = int(response["beatmap_id"])
  36.             self.beatmapset_id = int(response["beatmapset_id"])
  37.             self.date = Osu._parse_time(response["date"])
  38.             self.epic = response["epicfactor"]
  39.  
  40.     class Beatmap:
  41.         def __init__(self, response):
  42.             self.approved = int(response["approved"]) # add table for this
  43.             self.submit_date = Osu._parse_time(response["submit_date"])
  44.             self.approved_date = Osu._parse_time(response["approved_date"])
  45.             self.last_update = Osu._parse_time(response["last_update"])
  46.             self.artist = response["artist"]
  47.             self.beatmap_id = int(response["beatmap_id"])
  48.             self.beatmapset_id = int(response["beatmapset_id"])
  49.             self.bpm = float(response["bpm"])
  50.             self.creator = response["creator"]
  51.             self.creator_id = int(response["creator_id"])
  52.             self.diff_star = float(response["difficultyrating"])
  53.             #self.diff_aim = float(response["diff_aim"])    #NYI
  54.             #self.diff_speed = float(response["diff_speed"])    #NYI
  55.             self.cs = float(response["diff_size"])
  56.             self.od = float(response["diff_overall"])
  57.             self.ar = float(response["diff_approach"])
  58.             self.drain = float(response["diff_drain"])  #drain gang
  59.             self.hit_length = float(response["hit_length"])
  60.             self.source = response["source"]
  61.             self.genre_id = int(response["genre_id"])   #add table for this
  62.             self.language_id = int(response["language_id"]) #add table for this
  63.             self.title = response["title"]
  64.             self.total_length = float(response["total_length"])
  65.             self.diff_name = response["version"]
  66.             self.file_md5 = response["file_md5"]
  67.             self.mode = int(response["mode"])
  68.             self.tags = response["tags"].split(" ")
  69.             self.favourite_count = int(response["favourite_count"])
  70.             self.rating = float(response["rating"])
  71.             self.play_count = int(response["playcount"])
  72.             self.pass_count = int(response["passcount"])
  73.             self.count_normal = int(response["count_normal"])
  74.             self.count_slider = int(response["count_slider"])
  75.             self.count_spinner = int(response["count_spinner"])
  76.             #self.max_combo = int(response["max_combo"])    #NYI
  77.             self.download_unavailable = bool(int(response["download_unavailable"]))
  78.             self.audio_unavailable = bool(int(response["audio_unavailable"]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement