Skip to content

Commit

Permalink
Issue #131: Selective uploading option
Browse files Browse the repository at this point in the history
  • Loading branch information
Nekmo committed Feb 27, 2022
1 parent 791e53d commit 50f2fb0
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 8 deletions.
13 changes: 9 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,19 @@ The ``--delete-on-success`` option allows you to delete the Telegram message aft
useful to send files to download to your saved messages and avoid downloading them again. You can use this option to
download files on your computer away from home.

The **interactive option** (``--interactive``) allows you to choose the dialog and the files to download with a
**terminal wizard**. It even **supports mouse**!
`Read the documentation <https://docs.nekmo.org/telegram-upload/usage.html#telegram-download>`_ for more info.


Interactive mode
================
The **interactive option** (``--interactive``) allows you to choose the dialog and the files to download or upload with
a **terminal wizard**. It even **supports mouse**!

.. code-block:: console
$ telegram-download --interactive
$ telegram-upload --interactive # Interactive upload
$ telegram-download --interactive # Interactive download
`Read the documentation <https://docs.nekmo.org/telegram-upload/usage.html#telegram-download>`_ for more info.
Features
Expand Down
32 changes: 29 additions & 3 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@ Usage
:prog: telegram-download
:show-nested:

Interactive download
====================
Interactive mode
================
Use the ``-i`` (or ``--interactive``) option to activate the **interactive mode** to choose the dialog (chat,
channel...) and the files to download::
channel...) and the files. To **upload files** using interactive mode:

$ telegram-upload -i

To **download files** using interactive mode:

$ telegram-download -i

Expand All @@ -28,6 +32,28 @@ The following keys are available in this mode:
* **pageup**: go to the previous page of items. Allows quick navigation..
* **pagedown**: go to the next page of items. Allows quick navigation..

Interactive upload
------------------
This wizard has two steps. The *first step* chooses the files to upload. You can choose several files::

Select the local files to upload:
[SPACE] Select file [ENTER] Next step
[ ] myphoto1.jpg
[ ] myphoto2.jpg
[ ] myphoto3.jpg

The *second step* chooses the conversation::

Select the dialog of the files to download:
[SPACE] Select dialog [ENTER] Next step
( ) Groupchat 1
( ) Bob's chat
( ) A channel
( ) Me


Interactive download
--------------------
This wizard has two steps. The *first step* chooses the conversation::

Select the dialog of the files to download:
Expand Down
2 changes: 1 addition & 1 deletion telegram_upload/management.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def upload(files, to, config, delete_on_success, print_file_id, force_file, forw
client = Client(config or default_config(), proxy=proxy)
client.start()
if interactive and not files:
click.echo('Select the local filesto upload:')
click.echo('Select the local files to upload:')
click.echo('[SPACE] Select file [ENTER] Next step')
files = async_to_sync(interactive_select_local_files())
if interactive and to is None:
Expand Down

0 comments on commit 50f2fb0

Please sign in to comment.