smserver.models package¶
Submodules¶
smserver.models.ban module¶
-
class
smserver.models.ban.Ban(**kwargs)¶ Bases:
sqlalchemy.ext.declarative.api.Base-
classmethod
ban(session, ip=None, user_id=None, room_id=None, fixed=False, duration=None)¶ Ban an IP or user from a room or the server
-
created_at¶
-
end_at¶
-
classmethod
find_ban(session, ip=None, user_id=None, room_id=None)¶ Check if an IP is on the ban list
-
fixed¶
-
id¶
-
ip¶
-
classmethod
is_ban(session, ip=None, user_id=None, room_id=None)¶ Check if an IP or user is ban list
-
classmethod
reset_ban(session, room_id=None, fixed=False)¶ Delete all the ban for the given room
-
room¶
-
room_id¶
-
classmethod
unban(session, ip=None, user_id=None, room_id=None)¶ Unban an IP. Return True on success
-
updated_at¶
-
user¶
-
user_id¶
-
classmethod
smserver.models.game module¶
smserver.models.privilege module¶
smserver.models.room module¶
-
class
smserver.models.room.Room(**kwargs)¶ Bases:
sqlalchemy.ext.declarative.api.Base-
active_song¶
-
active_song_id¶
-
classmethod
available_rooms(session, users=None, min_level=2)¶ Get the available rooms for the given user(s).
If no users provided, return all the rooms
-
bans¶
-
created_at¶
-
description¶
-
free¶
-
games¶
-
id¶
-
ingame¶
-
classmethod
init_from_hashes(hrooms, session)¶
-
last_game¶
-
static
list_to_smopacket(rooms)¶ Take a list of rooms and return the formatted SMO packet
-
classmethod
login(name, password, session)¶ Find a room matching the couple name and password
Return the room if the match is good
-
max_users¶
-
mode¶
-
moderators¶ Get all the moderators in this room
-
motd¶
-
name¶
-
nb_players¶
-
nsccuul¶ Return the NSCCUUL packets listing users in the room
-
online_users¶
-
password¶
-
privileges¶
-
classmethod
reset_room_status(session)¶
-
room_info¶
-
classmethod
smo_list(session, users=None, min_level=2)¶ Return the list of rooms already formatted in a SMO packet
Send the list of room with:
`serv.send(models.Room.smo_list(session))`
-
static¶
-
status¶
-
to_packet()¶
-
type¶
-
updated_at¶
-
users¶
-
smserver.models.schema module¶
smserver.models.song module¶
-
class
smserver.models.song.Song(**kwargs)¶ Bases:
sqlalchemy.ext.declarative.api.Base-
active_rooms¶
-
artist¶
-
best_score(feet)¶ Return the song_stat element with the highest score for this feet
-
best_score_value(feet)¶ Return the highest score for this feet
-
best_scores¶
-
created_at¶
-
classmethod
find_or_create(title, subtitle, artist, session)¶
-
fullname¶
-
games¶
-
id¶
-
stats¶
-
subtitle¶
-
time_played¶
-
title¶
-
updated_at¶
-
smserver.models.song_stat module¶
-
class
smserver.models.song_stat.SongStat(**kwargs)¶ Bases:
sqlalchemy.ext.declarative.api.Base-
DIFFICULTIES= {0: 'BEGINNER', 1: 'EASY', 2: 'MEDIUM', 3: 'HARD', 4: 'EXPERT'}¶
-
GRADES= {0: 'AAAA', 1: 'AAA', 2: 'AA', 3: 'A', 4: 'B', 5: 'C', 6: 'D', 7: 'F'}¶
-
avoid_mine¶
-
bad¶
-
calc_percentage(config=None)¶
-
calc_xp(config=None)¶
-
created_at¶
-
static
decode_stats(binary)¶
-
difficulty¶
-
duration¶
-
static
encode_stats(raw_data)¶
-
feet¶
-
flawless¶
-
full_difficulty¶
-
game¶
-
game_id¶
-
good¶
-
grade¶
-
great¶
-
held¶
-
hit_mine¶
-
id¶
-
lit_difficulty¶
-
lit_grade¶
-
max_combo¶
-
miss¶
-
nb_notes¶
-
not_held¶
-
options¶
-
percentage¶
-
perfect¶
-
pretty_result(room_id=None, color=False)¶
-
raw_stats¶
-
score¶
-
song¶
-
song_id¶
-
stats¶
-
stepid= {1: 'hit_mine', 2: 'avoid_mine', 3: 'miss', 4: 'bad', 5: 'good', 6: 'great', 7: 'perfect', 8: 'flawless', 9: 'not_held', 10: 'held'}¶
-
updated_at¶
-
user¶
-
user_id¶
-
smserver.models.user module¶
-
class
smserver.models.user.UserStatus¶ Bases:
enum.Enum
-
class
smserver.models.user.User(**kwargs)¶ Bases:
sqlalchemy.ext.declarative.api.Base-
REPR= {0: '', 10: '~', 2: '%', 3: '@', 5: '&'}¶
-
bans¶
-
can(action, room_id=None)¶
-
cannot(action, room_id=None)¶
-
chat_timestamp¶
-
static
colored_users_repr(users, room_id=None)¶ Colored textual representation of multiple users.
Parameters: room_id (int) – The ID of the room
-
classmethod
connect(name, pos, session)¶
-
created_at¶
-
classmethod
disconnect(user, session)¶
-
classmethod
disconnect_all(session)¶
-
email¶
-
enum_status¶
-
classmethod
from_ids(ids, session)¶ Return a list of user instance from the ids list
-
fullname(room_id=None)¶ Return user name with level prefix (~, &, ...)
-
fullname_colored(room_id=None)¶ Retun user fullname with chat_color
-
classmethod
get_from_pos(ids, pos, session)¶
-
id¶
-
last_ip¶
-
level(room_id=None)¶
-
name¶
-
classmethod
nb_onlines(session)¶
-
online¶
-
classmethod
online_from_ids(ids, session)¶ Return a list of online users from the ids list
-
classmethod
onlines(session, room_id=None)¶
-
password¶
-
pos¶
-
privileges¶
-
rank¶
-
room¶
-
room_id¶
-
room_privilege(room_id)¶
-
set_level(room_id, level)¶
-
song_stats¶
-
status¶
-
stepmania_name¶
-
stepmania_version¶
-
updated_at¶
-
classmethod
user_index(user_id, room_id, session)¶
-
static
users_repr(users, room_id=None)¶ Textual representation of multiple users?
Parameters: room_id (int) – The ID of the room
-
xp¶
-
-
exception
smserver.models.user.AlreadyConnectError(user)¶ Bases:
Exception