Skip to content

Commit

Permalink
dev: update ltorrent-async
Browse files Browse the repository at this point in the history
  • Loading branch information
hlf20010508 committed Dec 5, 2023
1 parent 6dec5fc commit da6e7a1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ FROM python:3.8.16-alpine3.17
WORKDIR /telegram-onedrive
COPY ./ ./
RUN apk add --update --no-cache libgcc git &&\
pip install --no-cache-dir telethon requests flask onedrivesdk==1.1.8 git+https://github.com/hlf20010508/LTorrent.git@1.4.0 &&\
pip install --no-cache-dir telethon requests flask onedrivesdk==1.1.8 git+https://github.com/hlf20010508/LTorrent.git@1.5.0#subdirectory=ltorrent_async &&\
apk del git
COPY --from=cryptg_builder /cryptg /usr/local/lib/python3.8/site-packages
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ flask = "*"
telethon = "*"
requests = "*"
cryptg = "==0.4.0"
ltorrent = {ref = "1.4.0", git = "https://github.com/hlf20010508/LTorrent.git"}
ltorrent-async = {ref = "1.5.0", git = "git+https://github.com/hlf20010508/LTorrent.git", subdirectory = "ltorrent_async"}
7 changes: 4 additions & 3 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions modules/handlers/magnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from time import time
from io import BytesIO
from telethon import events
from ltorrent.lt_async.client import Client, CustomStorage
from ltorrent.lt_async.log import LoggerBase
from ltorrent_async.client import Client, CustomStorage
from ltorrent_async.log import LoggerBase
from modules.client import tg_bot, onedrive
from modules.env import tg_user_name, server_uri
from modules.utils import check_in_group, check_tg_login, check_od_login, cmd_parser
Expand Down Expand Up @@ -99,7 +99,7 @@ async def magnet_handler(event):
if len(cmd) == 2:
# /magnet magnet:?xt=urn:btih:xxxxxxxxxxxx
if cmd[1].startswith('magnet:?'):
client.load(magnet_link=cmd[1])
await client.load(magnet_link=cmd[1])
# '0' for all
await client.select_file(selection='0')
client.custom_storage = MyStorage(client.torrent.file_names)
Expand All @@ -110,11 +110,11 @@ async def magnet_handler(event):
# /magnet list magnet:?xt=urn:btih:xxxxxxxxxxxx
await event.reply('Format wrong.')
elif len(cmd) == 3 and cmd[1] == 'list' and cmd[2].startswith('magnet:?'):
client.load(magnet_link=cmd[2])
await client.load(magnet_link=cmd[2])
await client.list_file()
elif len(cmd) >2 and cmd[1].startswith('magnet:?'):
# /magnet magnet:?xt=urn:btih:xxxxxxxxxxxx 1 3-6 9
client.load(magnet_link=cmd[1])
await client.load(magnet_link=cmd[1])
await client.select_file(selection=' '.join(cmd[2:]))
client.custom_storage = MyStorage(client.torrent.file_names)
await client.run()
Expand Down

0 comments on commit da6e7a1

Please sign in to comment.