-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Discord Notifications #21
Conversation
had errors starting the repair script. change bencode3 to `#all` to fix
Handles file not found errors by telling the arrs to refresh and rescan the item.
SPELLING
@@ -83,26 +83,28 @@ def cleanFileName(name): | |||
|
|||
refreshingTask = None | |||
|
|||
async def refreshArr(arr: Arr, count=60): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why get rid of this system rather than updating it? This was here so that if you refreshArr on multiple torrents at the same time it doesn't just pile them up but does them all in the same refresh option.
This actually might be broken in that it doesn't take into account which arr we're dealing with, but that can probably be fixed pretty easily.
arr.refreshMonitoredDownloads() | ||
await asyncio.sleep(delay) | ||
|
||
def retryRequest(func, retries=3, delay=2, print=print): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have a retryRequest system, let's update that and use it here instead?
|
||
def copyFiles(file: TorrentFileInfo, folderPathMountTorrent, arr: Arr): | ||
# Consider removing this and always streaming |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably get rid of this whole chunk of code rather than the comment.
if not await torrent.selectFiles(): | ||
torrent.delete() | ||
return False | ||
elif status == torrent.STATUS_DOWNLOADING: | ||
await asyncio.sleep(15) # Add a 15-second wait between select file calls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
@@ -188,14 +218,6 @@ def print(*values: object): | |||
for root, dirs, files in os.walk(folderPathMountTorrent): | |||
relRoot = os.path.relpath(root, folderPathMountTorrent) | |||
for filename in files: | |||
# Check if the file is accessible | |||
# if not await is_accessible(os.path.join(root, filename)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If getting rid of this we should probably get rid of the code it's calling. Alternatively we can try getting the is_accessible code to work.
@@ -254,20 +261,16 @@ async def selectFiles(self): | |||
extraFilesGroup = next((fileGroup for fileGroup in self._instantAvailability if largestMediaFileId in fileGroup.keys()), None) | |||
if self.onlyLargestFile and extraFilesGroup: | |||
self.print('extra files required for cache:', extraFilesGroup) | |||
discordUpdate('Extra files required for cache:', extraFilesGroup) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to keep this as a separate message because I'm still trying to gauge how often it happens. I don't know of anyone that's actually gotten this message yet.
if self.onlyLargestFile and len(mediaFiles) > 1: | ||
discordUpdate('largest file:', largestMediaFile['path']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a debugging tool, should we add it as a field in the discord message?
@property | ||
def instantAvailability(self): | ||
return self._instantAvailability | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a purpose for this and the one in torbox?
@@ -412,7 +423,7 @@ async def getInfo(self, refresh=False): | |||
torrents = infoRequest.json()['data'] | |||
|
|||
for torrent in torrents: | |||
if torrent['id'] == self.id: | |||
if (torrent['id'] == self.id) and ('download_finished' in torrent): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we specifically don't want this.
rate_limit_retry=True, | ||
username='Update Bot' | ||
) | ||
webhook.add_embed(embed) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any need to move this out here instead of inline?
TAG_ON_SUCCESS=true | ||
TAG_ON_FAILURE=false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Start these with DISCORD
DISCORD_USER_TAG=<your_discord_user_id> | ||
TAG_ON_SUCCESS=true | ||
TAG_ON_FAILURE=false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider making these a blackhole property instead of a discord property. Though not really sure where they belong because they currently only apply to blackhole, but should it remain that way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm it would be cool to have repair added to the discord notifications if we are wanting to do the one big embed?
DISCORD_USER_TAG=<your_discord_user_id> | ||
TAG_ON_SUCCESS=true | ||
TAG_ON_FAILURE=false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update all the locations that this is applicable, like the readme file. (I usually just ask gpt for a description)
if realdebrid['enabled']: | ||
torrentConstructors.append(RealDebridTorrent if file.torrentInfo.isDotTorrentFile else RealDebridMagnet) | ||
debrid_provider = "Real-Debrid" | ||
if torbox['enabled']: | ||
torrentConstructors.append(TorboxTorrent if file.torrentInfo.isDotTorrentFile else TorboxMagnet) | ||
debrid_provider = "Torbox" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They can both be enabled, so this is probably something we should just pull directly from TorrentBase
type
discord_user = os.getenv('DISCORD_USER_TAG') | ||
discord_user_tag = f"<@{discord_user}>" | ||
tag_on_success = os.getenv('TAG_ON_SUCCESS', 'true').lower() == 'true' | ||
tag_on_failure = os.getenv('TAG_ON_FAILURE', 'true').lower() == 'true' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do this in the shared.py file in the same way as all the others.
@@ -2,7 +2,8 @@ environs==9.5.0 #all | |||
discord_webhook==1.3.0 #all | |||
requests==2.28.1 #all | |||
ratelimit #all | |||
rank-torrent-name==0.2.23 #all | |||
rank-torrent-name #all | |||
python-dotenv #all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already using environs, no need for this.
embed = DiscordEmbed(title=title, description=message, color=color) | ||
embed.set_author(name="Blackhole", icon_url="https://cdn.discordapp.com/attachments/1222893572521594962/1262384669161295934/black-hole-556660.png?ex=669666d7&is=66951557&hm=e792b1162ea86c1ba24ee9f4568c571ff1e3429e5b295555fea3fcb94404b434&") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
discordUpdate is also used for other scripts, so we should probably do this more dynamically
@Pukabyte Build is failing for some reason |
RTN
toblackhole.py
for parsing torrent namesDockerfile.blackhole
needs to be changed to at least Python 3.11-slimrank-torrent-name
added torequirements.txt
discord.py
to handle new updatesdebrid.py
blackhole.py
Series
orMovie