-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release1. Added TeamMember, Team, Friend, Comment. Updated README.md
- Loading branch information
xealmi
committed
Dec 31, 2024
1 parent
71942d0
commit 043f983
Showing
23 changed files
with
738 additions
and
206 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from mangalib_parser.objects import * | ||
from mangalib_parser.data import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from mangalib_parser.data import level, sites, statuses, models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,24 @@ | ||
class Model: | ||
def __init__(self, model: str): | ||
def __init__(self, model: str, name: str): | ||
self.model = model | ||
self.name = name | ||
|
||
def __str__(self): | ||
return self.name | ||
|
||
MANGA = Model('manga') | ||
USER = Model('user') | ||
POST = Model('post', 'Пост') | ||
CHAPTER = Model('chapter', 'Глава') | ||
EPISODES = Model('episodes', 'Эпизод') | ||
MANGA = Model('manga', 'Манга/Ранобе') | ||
ANIME = Model('anime', 'Аниме') | ||
USER = Model('user', 'Пользователь') | ||
TEAM = Model('team', 'Команда') | ||
COLLECTION = Model('collection', 'Коллекция') | ||
REVIEW = Model('review', 'Отзыв') | ||
|
||
|
||
MODELS_LIST = [MANGA, USER] | ||
MODELS = ['manga', 'user'] | ||
MODELS_LIST = [MANGA, USER, TEAM, CHAPTER, POST, ANIME, EPISODES, COLLECTION, REVIEW] | ||
def get_tmodel_by_model(model:str) -> Model: | ||
index = MODELS.index(model) | ||
return MODELS_LIST[index] | ||
for tmodel in MODELS_LIST: | ||
if tmodel.model == model: | ||
return tmodel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from mangalib_parser.objects.user import User | ||
from mangalib_parser.objects.comment import Comment | ||
from mangalib_parser.objects.bookmark import Bookmark | ||
from mangalib_parser.objects.friend import Friend | ||
from mangalib_parser.objects.team_member import TeamMember | ||
from mangalib_parser.objects.team import Team |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,24 @@ | ||
from datetime import datetime | ||
from mangalib_parser.data import models, sites, statuses | ||
from mangalib_parser.objects.main_object import MainObject | ||
|
||
|
||
class Bookmark(MainObject): | ||
def __init__(self, **kwargs): | ||
self.__dict__ = kwargs | ||
self.url = self.get_url() | ||
|
||
self.chapter: int = None | ||
self.page: int = None | ||
self.status: statuses.Status = None | ||
self.created_at: datetime = None | ||
self.updated_at: datetime = None | ||
self.name: str = None | ||
self.rus_name: str = None | ||
self.slug_url: str = None | ||
self.site: sites.Site = None | ||
self.model: models.Model = None | ||
|
||
self.__dict__.update(kwargs) | ||
self.url: str = self.get_url() | ||
|
||
def __str__(self): | ||
return f'Bookmark({self.name})' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from datetime import datetime | ||
from mangalib_parser.data import models, sites | ||
from mangalib_parser.objects.main_object import MainObject | ||
|
||
|
||
class Comment(MainObject): | ||
def __init__(self, comment: str, id: int, created_at: datetime, user_id: int, votes: list[int, int], relation_type: models.Model, **kwargs): | ||
self.comment = comment | ||
self.id = id | ||
self.created_at = created_at | ||
self.user_id = user_id | ||
self.votes = votes #list[down, up] | ||
self.relation_type = relation_type | ||
self.slug_url: str|int = '' | ||
self.url: str = '' | ||
|
||
self.__dict__.update(kwargs) | ||
|
||
def __str__(self): | ||
return f'Comment({self.comment})' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from datetime import datetime | ||
from mangalib_parser.objects.main_object import MainObject | ||
from mangalib_parser.settings.logging import do_log | ||
|
||
|
||
class Friend(MainObject): | ||
def __init__(self, user_id: int, **kwargs): | ||
self.user_id: int = user_id | ||
|
||
self.comment: str = None | ||
self.created_at: datetime = None | ||
self.status: dict = None | ||
self.__dict__.update(kwargs) | ||
|
||
def __str__(self): | ||
return f'Friend({self.user_id})' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.