You've already forked JapariArchive
fixed memory leak related to video files
This commit is contained in:
@@ -68,7 +68,7 @@ async def download_loop(botData: RuntimeBotData):
|
||||
await discordHelper.post_result(results, guild, botData.new_accounts)
|
||||
except Exception as ex:
|
||||
print(ex)
|
||||
await discordHelper.send_error(traceback.format_exc()[0:256], botData)
|
||||
await discordHelper.send_error(str(ex) + " " + traceback.format_exc(), botData)
|
||||
|
||||
async def download_post(artist: x_accounts, tweet: Tweet, botData: RuntimeBotData):
|
||||
x_post = x_posts(id = tweet.id, account_id = tweet.author.id, date = tweet.date, text = tweet.text)
|
||||
@@ -79,8 +79,8 @@ async def download_post(artist: x_accounts, tweet: Tweet, botData: RuntimeBotDat
|
||||
return
|
||||
|
||||
print("New media post:", str(tweet.url))
|
||||
media = await tweetHelper.GetTweetMediaUrls(tweet)
|
||||
image_containers = [x_posts_images(tweet.id, idx, file = url) for idx, url in enumerate(media)]
|
||||
media = await tweetHelper.GetTweetMedia(tweet)
|
||||
image_containers = [x_posts_images(tweet.id, idx, file = med.url) for idx, med in enumerate(media)]
|
||||
|
||||
try:
|
||||
async with aiohttp.ClientSession() as session:
|
||||
@@ -104,7 +104,7 @@ async def download_post(artist: x_accounts, tweet: Tweet, botData: RuntimeBotDat
|
||||
for idx, attachment in enumerate(downloaded_media):
|
||||
container = image_containers[idx]
|
||||
container.saved_file = attachment.file_name
|
||||
container.vox_label, container.rating, container.tags, filtered_tags, container.phash, container.dhash, container.error_id = await classify_all(attachment.file_bytes, botData.classifier, botData.vox)
|
||||
container.vox_label, container.rating, container.tags, filtered_tags, container.phash, container.dhash, container.error_id = await classify_all(attachment.file_bytes if not attachment.is_video else None, botData.classifier, botData.vox)
|
||||
|
||||
if container.vox_label not in vox_labels:
|
||||
vox_labels.append(container.vox_label)
|
||||
|
||||
Reference in New Issue
Block a user