forked from rahulkhatri137/mirrorbot137
-
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.
- Loading branch information
1 parent
6d4ecce
commit 84e39a2
Showing
15 changed files
with
531 additions
and
26 deletions.
There are no files selected for viewing
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 @@ | ||
name: Manually Deploy to Heroku | ||
|
||
on: workflow_dispatch | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: akhileshns/[email protected] | ||
with: | ||
heroku_api_key: ${{secrets.HEROKU_API_KEY}} | ||
heroku_app_name: ${{secrets.HEROKU_APP_NAME}} | ||
heroku_email: ${{secrets.HEROKU_EMAIL}} | ||
usedocker: true | ||
docker_heroku_process_type: web | ||
stack: "container" | ||
region: "eu" | ||
env: | ||
HD_CONFIG_FILE_URL: ${{secrets.CONFIG_FILE_URL}} |
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
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
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,61 @@ | ||
from .status import Status | ||
from bot.helper.ext_utils.bot_utils import MirrorStatus, get_readable_file_size, get_readable_time | ||
from bot import DOWNLOAD_DIR | ||
|
||
|
||
class TgUploadStatus(Status): | ||
def __init__(self, obj, size, gid, listener): | ||
self.obj = obj | ||
self.__size = size | ||
self.uid = listener.uid | ||
self.message = listener.message | ||
self.__gid = gid | ||
|
||
def path(self): | ||
return f"{DOWNLOAD_DIR}{self.uid}" | ||
|
||
def processed_bytes(self): | ||
return self.obj.uploaded_bytes | ||
|
||
def size_raw(self): | ||
return self.__size | ||
|
||
def size(self): | ||
return get_readable_file_size(self.__size) | ||
|
||
def status(self): | ||
return MirrorStatus.STATUS_UPLOADING | ||
|
||
def name(self): | ||
return self.obj.name | ||
|
||
def progress_raw(self): | ||
try: | ||
return self.obj.uploaded_bytes / self.__size * 100 | ||
except ZeroDivisionError: | ||
return 0 | ||
|
||
def progress(self): | ||
return f'{round(self.progress_raw(), 2)}%' | ||
|
||
def speed_raw(self): | ||
""" | ||
:return: Upload speed in Bytes/Seconds | ||
""" | ||
return self.obj.speed() | ||
|
||
def speed(self): | ||
return f'{get_readable_file_size(self.speed_raw())}/s' | ||
|
||
def eta(self): | ||
try: | ||
seconds = (self.__size - self.obj.uploaded_bytes) / self.speed_raw() | ||
return f'{get_readable_time(seconds)}' | ||
except ZeroDivisionError: | ||
return '-' | ||
|
||
def gid(self) -> str: | ||
return self.__gid | ||
|
||
def download(self): | ||
return self.obj |
Oops, something went wrong.