4
1
Fork 1
This repository has been archived on 2024-08-07. You can view files and clone it, but cannot push or open issues or pull requests.
qBitDownload-Bot/tubot/torrent/abc.py

37 lines
987 B
Python
Raw Normal View History

# -*- coding: utf-8 -*-
######################################################
# Abstract methods and interfaces for torrent module #
######################################################
from abc import ABC, abstractmethod
from tubot.static.abc import IValidatable
from tubot.torrent.types import TorrentTypes
class TorrentObj(IValidatable, ABC):
"""
Abstract class of torrent object
"""
_ttype: TorrentTypes # Torrent type property
dest: str
content: str
@property
def torrent_type(self) -> TorrentTypes:
"""
:return: Torrent type
"""
if self._ttype is None:
raise NotImplementedError("Torrent type not implemented")
return self._ttype
def __init__(self, content: str, destination: str) -> None:
"""
:param content: Torrent content (link, file path)
:param destination: Download directory
"""
self.content = content
self.dest = destination