Skip to content

Commit

Permalink
update by doc
Browse files Browse the repository at this point in the history
  • Loading branch information
trim21 committed Dec 18, 2023
1 parent 5f75572 commit 49a17ce
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
14 changes: 7 additions & 7 deletions chii/timeline/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Dict, List, Optional
from typing import Any, Dict, Optional

from pydantic import BaseModel

Expand Down Expand Up @@ -67,12 +67,12 @@ class Timeline(BaseModel):
memo: Any


SUBJECT_TYPE_MAP: Dict[int, List[int]] = {
SubjectType.book: [0, 1, 5, 9, 13, 14],
SubjectType.anime: [0, 2, 6, 10, 13, 14],
SubjectType.music: [0, 3, 7, 11, 13, 14],
SubjectType.game: [0, 4, 8, 12, 13, 14],
SubjectType.real: [0, 2, 6, 10, 13, 14],
SUBJECT_TYPE_MAP: Dict[int, Dict[int, int]] = {
SubjectType.book: {1: 1, 2: 5, 3: 9, 4: 13, 5: 14},
SubjectType.anime: {1: 2, 2: 6, 3: 10, 4: 13, 5: 14},
SubjectType.music: {1: 3, 2: 7, 3: 11, 4: 13, 5: 14},
SubjectType.game: {1: 4, 2: 8, 3: 12, 4: 13, 5: 14},
SubjectType.real: {1: 2, 2: 6, 3: 10, 4: 13, 5: 14},
}


Expand Down
15 changes: 10 additions & 5 deletions rpc/timeline_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ def SubjectCollect(
self, request: SubjectCollectRequest, context: RpcContext
) -> SubjectCollectResponse:
"""
cat 3 看过/读过/抛弃了...
https://github.com/bangumi/dev-docs/blob/master/Timeline.md#cat_sbj_collect-条目收藏
"""
tlType = SUBJECT_TYPE_MAP[request.subject.type][request.collection]
Expand Down Expand Up @@ -199,6 +201,14 @@ def EpisodeCollect(
def SubjectProgress(
self, req: SubjectProgressRequest, context
) -> SubjectProgressResponse:
"""
cat 4 type 0
"""
tlType = 0

if config.debug:
print(req)

memo = ProgressMemo(
subject_name=req.subject.name,
subject_id=str(req.subject.id),
Expand All @@ -209,11 +219,6 @@ def SubjectProgress(
vols_update=req.vols_update,
)

tlType = 0

if config.debug:
print(req)

with self.SessionMaker.begin() as session:
tl: Optional[ChiiTimeline] = session.scalar(
sa.get(
Expand Down

0 comments on commit 49a17ce

Please sign in to comment.