Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/soft/weechat-share-file

Weechat-share-file is an extension for popular WeeChat IRC-client that makes sharing files blazingly fast.
https://github.com/soft/weechat-share-file

extension file-shari python script upload weechat

Last synced: 10 days ago
JSON representation

Weechat-share-file is an extension for popular WeeChat IRC-client that makes sharing files blazingly fast.

Awesome Lists containing this project

README

        

# Dashing file sharing for WeeChat :rocket:

Weechat-share-file is an extension for popular [WeeChat](https://weechat.org)
IRC-client that makes sharing files blazingly fast. No longer will there be a
disparity between newfangled IM clients and the trusty old IRC when it comes to
the ease of sharing photos and files. Just pick a file and WeeChat will share it
using the sharing service of your choice and provide you with an URL ready to be
sent out. All without leaving the comfort of your chat buffer.

The script adds an integrated file browser to WeeChat that allows users to
select the files they wish to share. How the files are actually shared is
dependent upon their type and can be configured using a built-in command. Adding
an external sharing tool simply requires associating it with a
[MIME](http://en.wikipedia.org/wiki/Media_type) type.

The aesthetics of weechat-share-file have been strongly influenced by Emacs'
[Ido-mode](https://www.gnu.org/software/emacs/manual/html_mono/ido.html) and the
ever so useful [go.py](https://weechat.org/scripts/source/go.py.html/) buffer
selection tool.

## Features

- Snappy, search-oriented interface
- Multiple matching methods
- Sorting
- …and more!

## Installation

weechat-share-file requires WeeChat compiled with a support for Python 2.7 and
[python-magic](https://pypi.python.org/pypi/python-magic/) package to be
installed.

At present, weechat-share-file can only be installed directly from this
repository. Simply download the `share_file.py` script to WeeChat's python
script directory:

cd ~/.weechat/python # or alternatively ~/.weechat/python/autoload if you wish the script to be automatically loaded on start up
wget https://bitbucket.org/Soft/weechat-share-file/raw/master/share_file.py

After this, the script is ready to be activated:

/python load share_file.py

It is also recommended to bind the `/share` command to a key combination.

/key bind meta-o /share

Binds the `/share` command to `ALT-o`.

## Viewing and Editing Program Associations

weechat-share-file relies on external programs for sharing the files. This means
it is not dependent on any particular service and that adding support for new
services is close to trivial. However, this decoupling also means that there is
some configuration required, before the script can be fully utilized. The
`sharers` directory contains a few example scripts for uploading files to
popular hosting services.

weechat-share-file chooses how a file should be shared based on its MIME type.
Applications can be associated with MIME type patterns. For example, by default
the script has just a single association:

/sharers list

All sharers:
1. * echo

This means that any type of file (the `*` pattern in the output) is "shared"
using the `echo` command. This causes the path to the selected file to be
appended to the message, when the user tries to share a file. We can add a new
associating for files of type `image/*`:

/sharers add image/* imgur.sh 1

This assumes that a script `imgur.sh` resides in the `PATH`. The final `1` in
the command specifies the rule's priority. The rules are tried sequentially
until a matching rule is found. Since the default rule matches all the files we
added the new rule with a higher priority. Now, if we take a look at the
associations listing we'll see:

All sharers:
1. image/* imgur.sh
2. * echo

This means that if the file is an image, it is shared via the `imgur.sh` script.
If the file is not an image, it is still sent to `echo`. If we want to, we can
now delete the default rule by executing:

/sharers del 2

## Usage

Once setup, you should be able to invoke `/share` command on any buffer by
pressing `ALT-o`. The command transforms the input bar into an inline file
browser that can then be used to select files for sharing. The browser should
support everything you would expect from any self-respecting file explorer
utility. As a search-oriented interface, the listing can be further filtered
down by searching. By default, `ALT-TAB` and `ALT-SHIFT-TAB` can be used to move
between the candidates.

## Additional Configuration

weechat-share-file supports a bunch of customization options. Available options
can be viewed with `/set plugins.var.python.share_file.*`.

## License

weechat-share-file and all the associated scripts are licensed under the
[GNU General Public License Version 3](http://www.gnu.org/licenses/gpl-3.0.en.html)
or any later version.