Skip to content

Commit

Permalink
feat: remove the deprecated virtual image
Browse files Browse the repository at this point in the history
  • Loading branch information
lumina37 committed Dec 19, 2024
1 parent 4d85bcc commit 1cb2150
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 107 deletions.
1 change: 0 additions & 1 deletion aiotieba/api/_classdef/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@
TypeFragTiebaPlus,
)
from .user import UserInfo
from .vimage import VirtualImage
from .vote import VoteInfo
3 changes: 0 additions & 3 deletions aiotieba/api/_classdef/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import dataclasses as dcs

from ...enums import Gender, PrivLike, PrivReply
from .vimage import VirtualImage


@dcs.dataclass
Expand All @@ -30,7 +29,6 @@ class UserInfo:
sign (str): 个性签名
ip (str): ip归属地
icons (list[str]): 印记信息
vimage (VirtualImage_pf): 虚拟形象信息
is_vip (bool): 是否超级会员
is_god (bool): 是否大神
Expand Down Expand Up @@ -61,7 +59,6 @@ class UserInfo:
sign: str = ""
ip: str = ''
icons: list[str] = dcs.field(default_factory=list)
vimage: VirtualImage = dcs.field(default_factory=VirtualImage)

is_vip: bool = False
is_god: bool = False
Expand Down
8 changes: 0 additions & 8 deletions aiotieba/api/_protobuf/User.proto
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,6 @@ message User {
int32 is_default_avatar = 106;
string tieba_uid = 120;
string ip_address = 127;
message VirtualImageInfo {
int32 isset_virtual_image = 1;
message StateInfo {
string text = 2;
}
StateInfo personal_state = 9;
}
VirtualImageInfo virtual_image_info = 136;
message UserGrowth {
uint32 level_id = 1;
}
Expand Down
36 changes: 16 additions & 20 deletions aiotieba/api/_protobuf/User_pb2.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
b'\n\nUser.proto"\x92\n\n\x04User\x12\n\n\x02id\x18\x02 \x01(\x03\x12\x0c\n\x04name\x18\x03 \x01(\t\x12\x11\n\tname_show\x18\x04 \x01(\t\x12\x10\n\x08portrait\x18\x05 \x01(\t\x12\x1c\n\x08iconinfo\x18\x11 \x03(\x0b\x32\n.User.Icon\x12\x13\n\x0bis_coreuser\x18\x14 \x01(\x05\x12\x10\n\x08level_id\x18\x17 \x01(\x05\x12\x0f\n\x07is_bawu\x18\x19 \x01(\x05\x12\x11\n\tbawu_type\x18\x1a \x01(\t\x12\r\n\x05\x42\x44USS\x18\x1d \x01(\t\x12\x10\n\x08\x66\x61ns_num\x18\x1e \x01(\x05\x12\x13\n\x0b\x63oncern_num\x18\x1f \x01(\x05\x12\x0b\n\x03sex\x18 \x01(\x05\x12\x13\n\x0bmy_like_num\x18! \x01(\x05\x12\r\n\x05intro\x18" \x01(\t\x12\x10\n\x08post_num\x18% \x01(\x05\x12\x0e\n\x06tb_age\x18& \x01(\t\x12\x0e\n\x06gender\x18* \x01(\x05\x12!\n\tpriv_sets\x18- \x01(\x0b\x32\x0e.User.PrivSets\x12\x11\n\tis_friend\x18. \x01(\x05\x12&\n\tlikeForum\x18/ \x03(\x0b\x32\x13.User.LikeForumInfo\x12\x13\n\x0bis_guanfang\x18\x34 \x01(\x05\x12"\n\x07vipInfo\x18= \x01(\x0b\x32\x11.User.UserVipInfo\x12\'\n\x0enew_tshow_icon\x18\x41 \x03(\x0b\x32\x0f.User.TshowInfo\x12\x0f\n\x07is_fans\x18[ \x01(\x05\x12&\n\x0cnew_god_data\x18\x65 \x01(\x0b\x32\x10.User.NewGodInfo\x12\x19\n\x11is_default_avatar\x18j \x01(\x05\x12\x11\n\ttieba_uid\x18x \x01(\t\x12\x12\n\nip_address\x18\x7f \x01(\t\x12\x33\n\x12virtual_image_info\x18\x88\x01 \x01(\x0b\x32\x16.User.VirtualImageInfo\x12&\n\x0buser_growth\x18\x89\x01 \x01(\x0b\x32\x10.User.UserGrowth\x1a\x14\n\x04Icon\x12\x0c\n\x04name\x18\x01 \x01(\t\x1a\xab\x01\n\x08PrivSets\x12\x10\n\x08location\x18\x01 \x01(\x05\x12\x0c\n\x04like\x18\x02 \x01(\x05\x12\r\n\x05group\x18\x03 \x01(\x05\x12\x0c\n\x04post\x18\x04 \x01(\x05\x12\x0e\n\x06\x66riend\x18\x05 \x01(\x05\x12\x0c\n\x04live\x18\x06 \x01(\x05\x12\r\n\x05reply\x18\x07 \x01(\x05\x12\x19\n\x11\x62\x61zhu_show_inside\x18\x08 \x01(\x05\x12\x1a\n\x12\x62\x61zhu_show_outside\x18\t \x01(\x05\x1a\x35\n\rLikeForumInfo\x12\x12\n\nforum_name\x18\x01 \x01(\t\x12\x10\n\x08\x66orum_id\x18\x02 \x01(\x04\x1a\x30\n\x0bUserVipInfo\x12\x10\n\x08v_status\x18\x01 \x01(\r\x12\x0f\n\x07v_level\x18\x05 \x01(\r\x1a\x19\n\tTshowInfo\x12\x0c\n\x04name\x18\x02 \x01(\t\x1a\x42\n\nNewGodInfo\x12\x0e\n\x06status\x18\x01 \x01(\x05\x12\x10\n\x08\x66ield_id\x18\x02 \x01(\r\x12\x12\n\nfield_name\x18\x03 \x01(\t\x1a\x84\x01\n\x10VirtualImageInfo\x12\x1b\n\x13isset_virtual_image\x18\x01 \x01(\x05\x12\x38\n\x0epersonal_state\x18\t \x01(\x0b\x32 .User.VirtualImageInfo.StateInfo\x1a\x19\n\tStateInfo\x12\x0c\n\x04text\x18\x02 \x01(\t\x1a\x1e\n\nUserGrowth\x12\x10\n\x08level_id\x18\x01 \x01(\rb\x06proto3'
b'\n\nUser.proto"\xd6\x08\n\x04User\x12\n\n\x02id\x18\x02 \x01(\x03\x12\x0c\n\x04name\x18\x03 \x01(\t\x12\x11\n\tname_show\x18\x04 \x01(\t\x12\x10\n\x08portrait\x18\x05 \x01(\t\x12\x1c\n\x08iconinfo\x18\x11 \x03(\x0b\x32\n.User.Icon\x12\x13\n\x0bis_coreuser\x18\x14 \x01(\x05\x12\x10\n\x08level_id\x18\x17 \x01(\x05\x12\x0f\n\x07is_bawu\x18\x19 \x01(\x05\x12\x11\n\tbawu_type\x18\x1a \x01(\t\x12\r\n\x05\x42\x44USS\x18\x1d \x01(\t\x12\x10\n\x08\x66\x61ns_num\x18\x1e \x01(\x05\x12\x13\n\x0b\x63oncern_num\x18\x1f \x01(\x05\x12\x0b\n\x03sex\x18 \x01(\x05\x12\x13\n\x0bmy_like_num\x18! \x01(\x05\x12\r\n\x05intro\x18" \x01(\t\x12\x10\n\x08post_num\x18% \x01(\x05\x12\x0e\n\x06tb_age\x18& \x01(\t\x12\x0e\n\x06gender\x18* \x01(\x05\x12!\n\tpriv_sets\x18- \x01(\x0b\x32\x0e.User.PrivSets\x12\x11\n\tis_friend\x18. \x01(\x05\x12&\n\tlikeForum\x18/ \x03(\x0b\x32\x13.User.LikeForumInfo\x12\x13\n\x0bis_guanfang\x18\x34 \x01(\x05\x12"\n\x07vipInfo\x18= \x01(\x0b\x32\x11.User.UserVipInfo\x12\'\n\x0enew_tshow_icon\x18\x41 \x03(\x0b\x32\x0f.User.TshowInfo\x12\x0f\n\x07is_fans\x18[ \x01(\x05\x12&\n\x0cnew_god_data\x18\x65 \x01(\x0b\x32\x10.User.NewGodInfo\x12\x19\n\x11is_default_avatar\x18j \x01(\x05\x12\x11\n\ttieba_uid\x18x \x01(\t\x12\x12\n\nip_address\x18\x7f \x01(\t\x12&\n\x0buser_growth\x18\x89\x01 \x01(\x0b\x32\x10.User.UserGrowth\x1a\x14\n\x04Icon\x12\x0c\n\x04name\x18\x01 \x01(\t\x1a\xab\x01\n\x08PrivSets\x12\x10\n\x08location\x18\x01 \x01(\x05\x12\x0c\n\x04like\x18\x02 \x01(\x05\x12\r\n\x05group\x18\x03 \x01(\x05\x12\x0c\n\x04post\x18\x04 \x01(\x05\x12\x0e\n\x06\x66riend\x18\x05 \x01(\x05\x12\x0c\n\x04live\x18\x06 \x01(\x05\x12\r\n\x05reply\x18\x07 \x01(\x05\x12\x19\n\x11\x62\x61zhu_show_inside\x18\x08 \x01(\x05\x12\x1a\n\x12\x62\x61zhu_show_outside\x18\t \x01(\x05\x1a\x35\n\rLikeForumInfo\x12\x12\n\nforum_name\x18\x01 \x01(\t\x12\x10\n\x08\x66orum_id\x18\x02 \x01(\x04\x1a\x30\n\x0bUserVipInfo\x12\x10\n\x08v_status\x18\x01 \x01(\r\x12\x0f\n\x07v_level\x18\x05 \x01(\r\x1a\x19\n\tTshowInfo\x12\x0c\n\x04name\x18\x02 \x01(\t\x1a\x42\n\nNewGodInfo\x12\x0e\n\x06status\x18\x01 \x01(\x05\x12\x10\n\x08\x66ield_id\x18\x02 \x01(\r\x12\x12\n\nfield_name\x18\x03 \x01(\t\x1a\x1e\n\nUserGrowth\x12\x10\n\x08level_id\x18\x01 \x01(\rb\x06proto3'
)

_globals = globals()
Expand All @@ -18,22 +18,18 @@
if not _descriptor._USE_C_DESCRIPTORS:
DESCRIPTOR._loaded_options = None
_globals['_USER']._serialized_start = 15
_globals['_USER']._serialized_end = 1313
_globals['_USER_ICON']._serialized_start = 752
_globals['_USER_ICON']._serialized_end = 772
_globals['_USER_PRIVSETS']._serialized_start = 775
_globals['_USER_PRIVSETS']._serialized_end = 946
_globals['_USER_LIKEFORUMINFO']._serialized_start = 948
_globals['_USER_LIKEFORUMINFO']._serialized_end = 1001
_globals['_USER_USERVIPINFO']._serialized_start = 1003
_globals['_USER_USERVIPINFO']._serialized_end = 1051
_globals['_USER_TSHOWINFO']._serialized_start = 1053
_globals['_USER_TSHOWINFO']._serialized_end = 1078
_globals['_USER_NEWGODINFO']._serialized_start = 1080
_globals['_USER_NEWGODINFO']._serialized_end = 1146
_globals['_USER_VIRTUALIMAGEINFO']._serialized_start = 1149
_globals['_USER_VIRTUALIMAGEINFO']._serialized_end = 1281
_globals['_USER_VIRTUALIMAGEINFO_STATEINFO']._serialized_start = 1256
_globals['_USER_VIRTUALIMAGEINFO_STATEINFO']._serialized_end = 1281
_globals['_USER_USERGROWTH']._serialized_start = 1283
_globals['_USER_USERGROWTH']._serialized_end = 1313
_globals['_USER']._serialized_end = 1125
_globals['_USER_ICON']._serialized_start = 699
_globals['_USER_ICON']._serialized_end = 719
_globals['_USER_PRIVSETS']._serialized_start = 722
_globals['_USER_PRIVSETS']._serialized_end = 893
_globals['_USER_LIKEFORUMINFO']._serialized_start = 895
_globals['_USER_LIKEFORUMINFO']._serialized_end = 948
_globals['_USER_USERVIPINFO']._serialized_start = 950
_globals['_USER_USERVIPINFO']._serialized_end = 998
_globals['_USER_TSHOWINFO']._serialized_start = 1000
_globals['_USER_TSHOWINFO']._serialized_end = 1025
_globals['_USER_NEWGODINFO']._serialized_start = 1027
_globals['_USER_NEWGODINFO']._serialized_end = 1093
_globals['_USER_USERGROWTH']._serialized_start = 1095
_globals['_USER_USERGROWTH']._serialized_end = 1125
1 change: 0 additions & 1 deletion aiotieba/api/agree_vimage/__init__.py

This file was deleted.

30 changes: 0 additions & 30 deletions aiotieba/api/agree_vimage/_api.py

This file was deleted.

8 changes: 1 addition & 7 deletions aiotieba/api/get_posts/_classdef.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from ...enums import Gender, PrivLike, PrivReply
from ...exception import TbErrorExt
from .._classdef import Containers, TypeMessage, VirtualImage, VoteInfo
from .._classdef import Containers, TypeMessage, VoteInfo
from .._classdef.contents import (
_IMAGEHASH_EXP,
FragAt,
Expand All @@ -19,8 +19,6 @@
TypeFragText,
)

VirtualImage_p = VirtualImage

FragText_p = FragText_pt = FragText_pc = FragText
FragEmoji_p = FragEmoji_pt = FragEmoji_pc = FragEmoji
FragAt_p = FragAt_pt = FragAt_pc = FragAt
Expand Down Expand Up @@ -513,7 +511,6 @@ class Post:
pid (int): 回复id
user (UserInfo_p): 发布者的用户信息
author_id (int): 发布者的user_id
vimage (VirtualImage_p): 虚拟形象信息
floor (int): 楼层数
reply_num (int): 楼中楼数
Expand All @@ -534,7 +531,6 @@ class Post:
pid: int = 0
user: UserInfo_p = dcs.field(default_factory=UserInfo_p)
author_id: int = 0
vimage: VirtualImage_p = dcs.field(default_factory=VirtualImage_p)

floor: int = 0
reply_num: int = 0
Expand All @@ -551,7 +547,6 @@ def from_tbdata(data_proto: TypeMessage) -> Post:
is_aimeme = bool(data_proto.sprite_meme_info.meme_id)
pid = data_proto.id
author_id = data_proto.author_id
vimage = VirtualImage_p.from_tbdata(data_proto)
floor = data_proto.floor
reply_num = data_proto.sub_post_number
agree = data_proto.agree.agree_num
Expand All @@ -568,7 +563,6 @@ def from_tbdata(data_proto: TypeMessage) -> Post:
pid,
None,
author_id,
vimage,
floor,
reply_num,
agree,
Expand Down
8 changes: 1 addition & 7 deletions aiotieba/api/get_threads/_classdef.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from ...enums import Gender, PrivLike, PrivReply
from ...exception import TbErrorExt
from .._classdef import Containers, TypeMessage, VirtualImage, VoteInfo
from .._classdef import Containers, TypeMessage, VoteInfo
from .._classdef.contents import (
_IMAGEHASH_EXP,
FragAt,
Expand All @@ -19,8 +19,6 @@
TypeFragText,
)

VirtualImage_t = VirtualImage

FragText_t = FragText_st = FragText
FragEmoji_t = FragEmoji_st = FragEmoji
FragAt_t = FragAt_st = FragAt
Expand Down Expand Up @@ -538,7 +536,6 @@ class Thread:
pid (int): 首楼回复pid
user (UserInfo_t): 发布者的用户信息
author_id (int): 发布者的user_id
vimage (VirtualImage_t): 虚拟形象信息
type (int): 帖子类型
tab_id (int): 帖子所在分区id
Expand Down Expand Up @@ -569,7 +566,6 @@ class Thread:
pid: int = 0
user: UserInfo_t = dcs.field(default_factory=UserInfo_t)
author_id: int = 0
vimage: VirtualImage_t = dcs.field(default_factory=VirtualImage_t)

type: int = 0
tab_id: int = 0
Expand All @@ -596,7 +592,6 @@ def from_tbdata(data_proto: TypeMessage) -> None:
tid = data_proto.id
pid = data_proto.first_post_id
author_id = data_proto.author_id
vimage = VirtualImage_t.from_tbdata(data_proto)
type_ = data_proto.thread_type
tab_id = data_proto.tab_id
is_good = bool(data_proto.is_good)
Expand Down Expand Up @@ -629,7 +624,6 @@ def from_tbdata(data_proto: TypeMessage) -> None:
pid,
None,
author_id,
vimage,
type_,
tab_id,
is_good,
Expand Down
30 changes: 0 additions & 30 deletions aiotieba/api/profile/_classdef.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,32 +26,6 @@
FragVoice_pf = FragVoice


@dcs.dataclass
class VirtualImage_pf:
"""
虚拟形象信息
Attributes:
enabled (bool): 是否启用虚拟形象
state (str): 虚拟形象状态签名
"""

enabled: bool = False
state: str = ""

@staticmethod
def from_tbdata(data_proto: TypeMessage) -> VirtualImage_pf:
enabled = bool(data_proto.isset_virtual_image)
state = data_proto.personal_state.text
return VirtualImage_pf(enabled, state)

def __str__(self) -> str:
return self.state

def __bool__(self) -> bool:
return self.enabled


@dcs.dataclass
class UserInfo_pf(TbErrorExt):
"""
Expand All @@ -77,7 +51,6 @@ class UserInfo_pf(TbErrorExt):
sign (str): 个性签名
ip (str): ip归属地
icons (list[str]): 印记信息
vimage (VirtualImage_pf): 虚拟形象信息
is_vip (bool): 是否超级会员
is_god (bool): 是否大神
Expand Down Expand Up @@ -107,7 +80,6 @@ class UserInfo_pf(TbErrorExt):
sign: str = ""
ip: str = ''
icons: list[str] = dcs.field(default_factory=list)
vimage: VirtualImage_pf = dcs.field(default_factory=VirtualImage_pf)

is_vip: bool = False
is_god: bool = False
Expand Down Expand Up @@ -136,7 +108,6 @@ def from_tbdata(data_proto: TypeMessage) -> UserInfo_pf:
sign = user_proto.intro
ip = user_proto.ip_address
icons = [name for i in user_proto.iconinfo if (name := i.name)]
vimage = VirtualImage_pf.from_tbdata(user_proto.virtual_image_info)
is_vip = bool(user_proto.new_tshow_icon)
is_god = bool(user_proto.new_god_data.status)
anti_proto = data_proto.anti_stat
Expand All @@ -163,7 +134,6 @@ def from_tbdata(data_proto: TypeMessage) -> UserInfo_pf:
sign,
ip,
icons,
vimage,
is_vip,
is_god,
is_blocked,
Expand Down

0 comments on commit 1cb2150

Please sign in to comment.