tremotesf-android
tremotesf-android copied to clipboard
Feature request: delete torrent file
Can you add function: after adding torrent to transmission delete the initial .torrent file? Files are downloaded to doenload folder, and after adding them to transmission I do not need them.
I can implement this, but as far as I know there no way to do it reliably in Android. When a file is being opened in app from another app, it can be sent via content:// or file:// URI. When it's sent via content:// URI (which most apps do), Tremotesf access it not by itself, but through an app which a file has been opened from, and Tremotesf does not need access to external storage permission - an app grants temporary access to it. This, however, applies only to read permission. Whether to grant a write permission (which is obviously needed to delete a file) totally depends on an app, and most don't do it (the only one I know is standard DocumentsUI). I.e. if you download a torrent file in a browser, then open it in Tremotesf from notification, Tremotesf most likely won't be able to delete it (and there is no way to reliably extract actual file path from content:// URI to use a second method). Another way to pass a file to an app is by using file:// URI which is simply a file path. This way no temporary permissions are granted, an app needs to have full access to external storage to read or write to file. It allows Tremotesf to delete a file (if permissions are granted, obviously), but this method is discouraged by Google and not many apps use it nowadays.
To put it short, the only reliably way to delete a file would for user to navigate to a file in DocumentsUI and open it in Tremotesf from there - which makes this feature completely useless.
Hi,
Is this still the situation with Android 11+? I see the same answer under this https://stackoverflow.com/a/53722802/539198 - but there's a function to get the file path from the URI by the looks of it. I imagine you still need the full storage access permission. You don't need to grant the full storage permission for everyone on install or first startup, just for the users who want it (eg. it can be disabled by default, and if someone wants to use the Delete function, let it enable it from the settings, then ask for permission).
I have to use https://play.google.com/store/apps/details?id=com.gabordemko.torrnado to add torrents, as it has the Delete feature. I'm not sure what ES File Explorer uses, but probably the content URI.
Thank you!