Hide keyboard shortcuts

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 2015 Hermann Krumrey <hermann@krumreyh.com> 

3 

4This file is part of toktokkie. 

5 

6toktokkie 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. 

10 

11toktokkie 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. 

15 

16You should have received a copy of the GNU General Public License 

17along with toktokkie. If not, see <http://www.gnu.org/licenses/>. 

18LICENSE""" 

19 

20import os 

21from abc import ABC 

22from typing import List 

23from toktokkie.metadata.base.MetadataBase import MetadataBase 

24 

25 

26class ComicExtras(MetadataBase, ABC): 

27 """ 

28 Additional methods and attributes for comic metadata objects 

29 """ 

30 # TODO volume or chapter based 

31 

32 @property 

33 def main_path(self) -> str: 

34 """ 

35 The path to the main manga directory 

36 :return: The path 

37 """ 

38 return os.path.join(self.directory_path, "Main") 

39 

40 @property 

41 def special_path(self) -> str: 

42 """ 

43 The path to the special manga directory 

44 :return: The path or None if it does not exist 

45 """ 

46 return os.path.join(self.directory_path, "Special") 

47 

48 @property 

49 def special_chapters(self) -> List[str]: 

50 """ 

51 :return: A list of special chapter identifiers for this series 

52 """ 

53 return self.json.get("special_chapters", []) 

54 

55 @special_chapters.setter 

56 def special_chapters(self, special_chapters: List[str]): 

57 """ 

58 Setter method for the special_chapters 

59 :param special_chapters: The special chapter identifiers to set 

60 :return: None 

61 """ 

62 if len(special_chapters) > 0: 

63 max_len = len(max(special_chapters, key=lambda x: len(x))) 

64 special_chapters.sort(key=lambda x: x.zfill(max_len)) 

65 self.json["special_chapters"] = special_chapters