summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authoraetherised2021-05-11 02:31:18 -0400
committeraetherised2021-05-11 02:31:18 -0400
commit47f001bfb2af09cbaa1e3077a1971a3d61ccd066 (patch)
treefd2b32cfed9333d8fe3cea9dfcfc46527863292e
downloadaur-addmag.tar.gz
init
-rw-r--r--.SRCINFO20
-rw-r--r--.gitignore3
-rw-r--r--LICENSE7
-rw-r--r--PKGBUILD28
-rw-r--r--README.md30
-rwxr-xr-xaddmag35
-rw-r--r--addmag.desktop11
7 files changed, 134 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 00000000000..bd84f735c4d
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,20 @@
+pkgbase = addmag
+ pkgdesc = Opens magnet links using a remote Transmission daemon
+ pkgver = 0.1.1
+ pkgrel = 4
+ url = https://github.com/aetherised/addmag
+ arch = any
+ license = MIT
+ depends = transmission-cli
+ depends = bash
+ source = addmag
+ source = addmag.desktop
+ source = LICENSE
+ source = README.md
+ md5sums = 14f98b59c71487c92b6b5d49cc2db79d
+ md5sums = 921ef9cd57fe1e0f6e8cb3cd7ce41029
+ md5sums = 648ebc0775a7579d1f66bbf4b2381b83
+ md5sums = 0398bc2eabdc6bf328ca160dfd2074ad
+
+pkgname = addmag
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000000..ed45410df8f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+pkg/
+src/
+*.zst
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 00000000000..d72f934aa2c
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,7 @@
+Copyright 2021 aetherised <aetherised@gmail.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 00000000000..4b260c7903a
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,28 @@
+# Maintainer: aetherised <aetherised@gmail.com>
+
+pkgname=addmag
+pkgver=0.1.1
+pkgrel=4
+pkgdesc="Opens magnet links using a remote Transmission daemon"
+arch=('any')
+url="https://github.com/aetherised/addmag"
+license=('MIT')
+depends=('transmission-cli' 'bash')
+source=(
+ 'addmag'
+ 'addmag.desktop'
+ 'LICENSE'
+ 'README.md'
+)
+package() {
+ install -Dvm755 "addmag" "${pkgdir}/usr/bin/addmag"
+ install -Dvm644 "addmag.desktop" "${pkgdir}/usr/share/applications/addmag.desktop"
+ install -Dvm644 "LICENSE" "${pkgdir}/usr/share/doc/${pkgname}/LICENSE"
+ install -Dvm644 "README.md" "${pkgdir}/usr/share/doc/${pkgname}/README.md"
+ install -dv "${pkgdir}/usr/share/licenses/${pkgname}"
+ ln -s "/usr/share/doc/${pkgname}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}"
+}
+md5sums=('14f98b59c71487c92b6b5d49cc2db79d'
+ '921ef9cd57fe1e0f6e8cb3cd7ce41029'
+ '648ebc0775a7579d1f66bbf4b2381b83'
+ '0398bc2eabdc6bf328ca160dfd2074ad')
diff --git a/README.md b/README.md
new file mode 100644
index 00000000000..e333e93b000
--- /dev/null
+++ b/README.md
@@ -0,0 +1,30 @@
+**A simple tool to open magnet links** using a remote
+[Transmission](https://github.com/transmission/transmission) daemon. Includes
+a `.desktop` file for use with `xdg-open`. The remote server address is
+configurable on a system-wide and per-user basis.
+
+Requires that `transmission-remote` be available on the system. Includes
+PKGBUILD for installation on Arch. Under Arch, `transmission-remote` is found in
+the `transmission-cli` package.
+
+# USAGE
+
+**`addmag LINK`** where `LINK` is a magnet link or path to a torrent file
+
+# CONFIGURATION
+
+**`addmag`** looks for configuration files in the following locations:
+
+* `/etc/addmagrc`
+* `~/.addmagrc`
+
+These files should contain the address of the server running the Transmission
+daemon and nothing else. Per-user configutation (in `~/.addmagrc`) overrides
+the system configuration (in `/etc/addmagrc`).
+
+# LICENSE & COPYRIGHT
+
+Available under the terms of the **MIT license**. See included LICENSE file for
+the full text of the lisence.
+
+Copyright 2021 **aetherised** <<aetherised@gmail.com>>
diff --git a/addmag b/addmag
new file mode 100755
index 00000000000..13fe60d453c
--- /dev/null
+++ b/addmag
@@ -0,0 +1,35 @@
+#!/bin/bash
+#
+# USAGE: addmag LINK
+# Opens magnet links with a remote transmission daemon.
+# The remote address is configured in either:
+# /etc/addmagrc
+# ${HOME}/.addmagrc
+# These files should contain nothing but the remote address.
+#
+# aetherised 2021 <aetherised@gmail.com>
+#
+
+RCNAME="addmagrc"
+SYSRC="/etc/${RCNAME}"
+USRRC="${HOME}/.${RCNAME}"
+
+LINK="${1}"
+ADDR=
+
+if [[ -z "${LINK}" ]]; then
+ echo "ERROR: no magnet link or torrent file specified"
+ exit 1
+fi
+
+[[ -f "${SYSRC}" ]] && ADDR=$(cat "${SYSRC}")
+[[ -f "${USRRC}" ]] && ADDR=$(cat "${USRRC}")
+if [[ -z "${ADDR}" ]]; then
+ echo "ERROR: no remote address configured"
+ echo " Place the address of the remote daemon in one of these locations:"
+ echo " ${SYSRC}"
+ echo " ${USRRC}"
+ exit 1
+fi
+
+transmission-remote "${ADDR}" -a "${LINK}"
diff --git a/addmag.desktop b/addmag.desktop
new file mode 100644
index 00000000000..698616d040f
--- /dev/null
+++ b/addmag.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Name=addmag
+GenericName=Transmission Daemon Magnet Link Handler
+Comment=Open magnent links with a remote Transmission daemon
+Exec=addmag %U
+Terminal=false
+TryExec=addmag
+Type=Application
+StartupNotify=true
+MimeType=x-scheme-handler/magnet;
+Categories=Network;FileTransfer;P2P;