Giter Club home page Giter Club logo

tgmount's People

Contributors

juniorjpdj avatar nktknshn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

tgmount's Issues

Block on file open request

Hi,
When I try to open file there's infinite (or just long enough for me to stop waiting) block of any program trying to do so.
Not even reading file, just opening.
There's an example:
Screenshot_20200816_010417

Could not find the input entity for PeerUser

Unfortunately, it is throwing up an error.

$ python3 tgmount.py --list-documents --id 793392913 --limit 10
Traceback (most recent call last):
  File "tgmount.py", line 168, in <module>
    loop.run_until_complete(main())
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "tgmount.py", line 59, in main
    await list_documents(await client(),
  File "/home/media/tgmount/tgmount/tgmount/actions.py", line 39, in list_documents
    entity = await client.get_entity(id)
  File "/home/media/.local/lib/python3.8/site-packages/telethon/client/users.py", line 292, in get_entity
    inputs.append(await self.get_input_entity(x))
  File "/home/media/.local/lib/python3.8/site-packages/telethon/client/users.py", line 466, in get_input_entity
    raise ValueError(
ValueError: Could not find the input entity for PeerUser(user_id=793392913) (PeerUser). Please read https://docs.telethon.dev/en/stable/concepts/entities.html to find out more details.

Sometimes file's are corrupted

I cannot really say when it happens, but it happens.
The same file downloads with errors and then after some time - correctly.
I can hear it in music player, it looks like it downloads the same file part or chunk two times and returns it twice.

Eg. I'm listening to music and after some time there's glitched part: It plays again the same part of track second time or skips some fragment (very short, fraction of second, but disturbing).
When I listen close player and play this track again, there's no glitch anymore.

Bot support

Hi,
I tried logging in as bot, when I found out that there's no way, I tried to put already logged in bot session to bot, but it failed:

$ ./tgmount.py --id -1001410674750 --list-documents                                                                                                                                                         
Traceback (most recent call last):
  File "./tgmount.py", line 209, in <module>
    loop.run_until_complete(main())
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "./tgmount.py", line 70, in main
    await list_documents(await client(),
  File "/home/juniorjpdj/dev/tgmount/tgmount/tgmount/functions.py", line 50, in list_documents
    documents = await client.get_documents(entity,
  File "/home/juniorjpdj/dev/tgmount/tgmount/tgmount/tgclient.py", line 313, in get_documents
    [messages, documents] = await self._get_documents(entity,
  File "/home/juniorjpdj/dev/tgmount/tgmount/tgmount/tgclient.py", line 292, in _get_documents
    messages = await self.get_messages(entity, limit=limit, offset_id=offset_id, reverse=reverse,
  File "/usr/lib/python3.8/site-packages/telethon/client/messages.py", line 531, in get_messages
    return await it.collect()
  File "/usr/lib/python3.8/site-packages/telethon/requestiter.py", line 113, in collect
    async for message in self:
  File "/usr/lib/python3.8/site-packages/telethon/requestiter.py", line 74, in __anext__
    if await self._load_next_chunk():
  File "/usr/lib/python3.8/site-packages/telethon/client/messages.py", line 165, in _load_next_chunk
    r = await self.client(self.request)
  File "/usr/lib/python3.8/site-packages/telethon/client/users.py", line 30, in __call__
    return await self._call(self._sender, request, ordered=ordered)
  File "/usr/lib/python3.8/site-packages/telethon/client/users.py", line 77, in _call
    result = await future
telethon.errors.rpcerrorlist.BotMethodInvalidError: The API access for bot users is restricted. The method you tried to invoke cannot be executed as a bot (caused by SearchRequest)

Also when I tried to mount:

./tgmount.py --id -1001410674750 --mount ./dir --debug --debug-fuse                                                                                                                                         46.175.44.195   93%  ─╯
DEBUG   [root]  Namespace(all_files=False, debug=True, debug_fuse=True, download=None, files=[], fsname='tgfs', id='-1001410674750', json=False, limit=None, list_dialogs=False, list_documents=False, mount='./dir', no_updates=False, offset_id=0, reverse=False, session='tgfs', socks=None)
DEBUG   [tgclient]      Connecting to Telegram servers...
INFO    [telethon.network.mtprotosender]        Connecting to 149.154.167.92:443/TcpFull...
INFO    [telethon.network.mtprotosender]        Connection to 149.154.167.92:443/TcpFull complete!
DEBUG   [tgclient]      Connected
DEBUG   [pyfuse3]       Calling fuse_session_unmount
[1]    143926 segmentation fault (core dumped)  ./tgmount.py --id -1001410674750 --mount ./dir --debug --debug-fuse

Keep the same naming scheme

Hi!
I'm trying to automate detection of new files posted on group I mounted.
The problem is your filenames are not consistent.

def message_doc_filename_format(msg: Message, doc: TgmountDocument):
attr_file_name = doc.atrributes.get('file_name')
if attr_file_name:
return ("%s %s" % (msg.id, attr_file_name)).encode()
else:
return ("msg_%s_doc" % msg.id).encode()

Could you please always prepend your names with ID, not make special case when name starts with msg and ID is somewhere inside? It will also fix sorting of files.

TypeError: 'Message' object is not subscriptable

$ python3 tgmount.py --download /tmp/files/ --id blahblah --files 17525,17526
INFO    [root]  Download files [17525, 17526] from blahblah to /tmp/files/
Traceback (most recent call last):
  File "tgmount.py", line 168, in <module>
    loop.run_until_complete(main())
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "tgmount.py", line 81, in main
    await download(await client(),
  File "/home/media/tgmount/tgmount/tgmount/actions.py", line 156, in download
    ([d['attributes']['file_name'] for m, d in documents],))
  File "/home/media/tgmount/tgmount/tgmount/actions.py", line 156, in <listcomp>
    ([d['attributes']['file_name'] for m, d in documents],))
TypeError: 'Message' object is not subscriptable

ZIP file as directory support

Me and my friends are sharing music with each other, but when we share albums - those are ZIPed.
What if your filesystem could mount those ZIP files as directories in filesystem?
There's very easy to use Zipfile lib in python stdlib.

timeout raises IOError

Screenshot_20210507_145313

$ cp flaczkownia/66556\ DJ\ Wielki\ Huj\ -\ Halloween\ EP\ 2\ \(2018\).zip .
cp: error reading 'flaczkownia/66556 DJ Wielki Huj - Halloween EP 2 (2018).zip': Input/output error

Could you add a way to retry on timeout and make retries amount configurable?
I can't use it right now as it breaks everything when telegram is lagging a bit.

Blocks any reads after few hours of operation

I'm having weird problem.
Everything works at least good at start and few hours later, but at some moment reads just block.
No network activity is observed after file open, read of old files is just stuck. New files are working good.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.