transmission / transmission

Official Transmission BitTorrent client repository
https://transmissionbt.com
Other
12k stars 1.2k forks source link

Pause torrents when on a metered connection #1074

Open pwithnall opened 4 years ago

pwithnall commented 4 years ago

If on a metered network connection (g_network_monitor_get_network_metered()), where the user pays per unit of data transfer, it would be useful to automatically pause the user’s torrents so they don’t accidentally keep downloading/seeding and end up with a large data bill.

The user could always manually unpause the torrents if they want to continue torrenting despite being on a metered connection.

sio commented 4 years ago

How portable is this solution? Transmission runs on a number of operating systems and CPU architectures...

pwithnall commented 4 years ago

I don’t know how Transmission is written. The API I mentioned above is from GLib, and will provide some cross-platform detection of metered status on different Linux distributions. It currently doesn’t support Windows or macOS, but could be made to.

If you don’t use GLib to write the core of Transmission then you’d have to do your own platform-specific detection of metered status. On Linux, this is a case of querying NetworkManager over D-Bus.

The CPU architecture should make no difference at all.

I’m interested in this for Linux; I’ve filed this bug as Transmission was explicitly listed by about 1.5% of respondents to a GNOME metered data survey as causing them problems when using metered data. (I ran the survey but don’t use Transmission myself.)

lighterowl commented 4 years ago

The only sensible place for this would be the libtransmission core component, since it would then be possible to easily incorporate this to various GUIs and (if needed, though it doesn't seem likely) add extra methods/fields inthe RPC protocol. However, libtransmission doesn't use GLib, so implementing this feature on Linux would require making D-Bus calls manually. Similar information is also available via WinAPI starting with Windows 8.

svanstrom commented 4 years ago

Personally I don't feel that this is a feature that should be prioritised in most apps; because in most cases it adds no real value in-app, as compared with the user simply quitting/starting apps depending on current needs. (So, it'd make more sense with a third party app that quits/starts apps based on certain conditions.)

Having said that… In the case of a torrenting app the logic behind implementing a feature like this doesn't necessarily have to be based primarily on trying to figure out if the connection is metered or not; but rather the network used.

So you do a fairly simple lookup of the non-local/NAT address, and based on that in the settings have a list of networks where torrenting is allowed to automatically happen.

pwithnall commented 4 years ago

Personally I don't feel that this is a feature that should be prioritised in most apps; because in most cases it adds no real value in-app, as compared with the user simply quitting/starting apps depending on current needs. (So, it'd make more sense with a third party app that quits/starts apps based on certain conditions.)

Users shouldn’t have to think about all the apps they have running (in the foreground or background) every time they change network. Users often end up changing network on the move without even realise it (switching between Wi-Fi and 4G, for example). This is an entirely avoidable mental burden on the user.

So you do a fairly simple lookup of the non-local/NAT address, and based on that in the settings have a list of networks where torrenting is allowed to automatically happen.

It shouldn’t need to be that complicated. NetworkManager has an existing way of indicating whether a network is metered on Linux, and other platforms have equivalent APIs.

hparlak commented 3 years ago

I back this issue too. This is an easy to solve issue. Also I think this will add value to the app.

maifeeulasad commented 2 years ago

Since Qt 6.1 has this QNetworkInformation class, which has this isMetered method. It may be a straightforward solution. Not sure, what the current version of the project is using, and I'm quite sure upgrading may break some portion of the project. But it will be really helpful, as there are tons of users from South Asia, Africa, who use mobile data a lot. I'm from Bangladesh. Don't take it as a racial comment. This is just an analysis.