Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"""LICENSE
2Copyright 2019 Hermann Krumrey <hermann@krumreyh.com>
4This file is part of otaku-info-bot.
6otaku-info-bot is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation, either version 3 of the License, or
9(at your option) any later version.
11otaku-info-bot is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
16You should have received a copy of the GNU General Public License
17along with otaku-info-bot. If not, see <http://www.gnu.org/licenses/>.
18LICENSE"""
20from kudubot.db import Base
21from sqlalchemy import Column, Integer, String, ForeignKey
22from sqlalchemy.orm import relationship
23from sqlalchemy.ext.declarative import declared_attr
26class NotificationConfig:
27 """
28 Models generic anilist-related notification configurations
29 """
31 id = Column(Integer, primary_key=True, autoincrement=True)
32 """
33 The ID of the config
34 """
36 @declared_attr
37 def address_id(self):
38 """
39 The ID of the associated address
40 """
41 return Column(Integer, ForeignKey("addressbook.id"))
43 @declared_attr
44 def address(self):
45 """
46 The associated address
47 """
48 return relationship("Address")
50 anilist_username = Column(String(255), nullable=False)
51 """
52 The anilist username to use
53 """
55 list_name = Column(String(255), nullable=False)
56 """
57 The anilist list
58 """
60 @classmethod
61 def default_list_name(cls) -> str:
62 """
63 :return: The default list name
64 """
65 raise NotImplementedError()
67 @classmethod
68 def media_type(cls) -> str:
69 """
70 :return: The media type
71 """
72 raise NotImplementedError()
75class AnimeNotificationConfig(NotificationConfig, Base):
76 """
77 Configuration for anime updates
78 """
80 __tablename__ = "anime_notification_configs"
81 """
82 The table name
83 """
85 @classmethod
86 def default_list_name(cls) -> str:
87 """
88 :return: The default list name
89 """
90 return "Watching"
92 @classmethod
93 def media_type(cls) -> str:
94 """
95 :return: The media type
96 """
97 return "anime"
100class MangaNotificationConfig(NotificationConfig, Base):
101 """
102 Configuration for manga reminders
103 """
105 __tablename__ = "manga_notification_configs"
106 """
107 The table name
108 """
110 @classmethod
111 def default_list_name(cls) -> str:
112 """
113 :return: The default list name
114 """
115 return "Reading"
117 @classmethod
118 def media_type(cls) -> str:
119 """
120 :return: The media type
121 """
122 return "manga"