node-red-node-transmission-mh
Version:
A Node-RED node to access and control the Transmission torrent client Remote API.
152 lines (139 loc) • 6.23 kB
HTML
<script type="text/x-red" data-template-name="transmission-config">
<div class="form-row">
<label for="node-config-input-hostname"><i class="fa fa-bookmark"></i>Host Name</label>
<input class="input-append-left" type="text" id="node-config-input-hostname" style="width: 40%;" >
</div>
<div class="form-row">
<label for="node-config-input-portnum"><i class="fa fa-bookmark"></i>Port Num</label>
<input class="input-append-left" type="text" id="node-config-input-portnum" style="width: 40%;" >
</div>
<div class="form-row">
<label for="node-config-input-username"><i class="fa fa-bookmark"></i>User</label>
<input class="input-append-left" type="text" id="node-config-input-username" style="width: 40%;" >
</div>
<div class="form-row">
<label for="node-config-input-password"><i class="fa fa-bookmark"></i>Password</label>
<input class="input-append-left" type="text" id="node-config-input-password" style="width: 40%;" >
</div>
</script>
<script type="text/javascript">
(function() {
RED.nodes.registerType('transmission-config',{
category: 'config',
defaults: { },
credentials: {
hostname: {required:true},
portnum: {required:false},
username: {required:false},
password: {required:false}
},
label: function() {
return "Transmission API";
},
exportable: false,
});
})();
</script>
<script type="text/x-red" data-template-name="Transmission List Torrents">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-config"><i class="fa fa-user"></i> Transmission API</label>
<input type="text" id="node-input-config">
</div>
</script>
<script type="text/x-red" data-help-name="Transmission List Torrents">
<p>Gets the current torrent list JSON data from the Transmission Instance.</p>
<p>Returns an Array of the RPC JSON data in msg.payload with a msg.topic of '/transmission.v1/torrentData'</p>
<p>See the 3.3 Torrent Accessors section of the RPC-Spec <a href="https://trac.transmissionbt.com/browser/trunk/extras/rpc-spec.txt" target="_blank">https://trac.transmissionbt.com/browser/trunk/extras/rpc-spec.txt</a>
</script>
<script type="text/javascript">
RED.nodes.registerType('Transmission List Torrents',{
category: 'transmission',
color:"#C0DEED",
defaults: {
config: {type:"transmission-config",required:true},
name: {value:""}
},
inputs:1,
outputs:1,
icon: "transmission.png",
label: function() {
return this.name||"List Torrents";
}
});
</script>
<script type="text/x-red" data-template-name="Transmission Add Torrent">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-config"><i class="fa fa-user"></i> Transmission API</label>
<input type="text" id="node-input-config">
</div>
<div class="form-row node-input-url">
<label for="node-input-url"><i class="fa fa-tag"></i> Url</label>
<input type="text" id="node-input-url" placeholder="url">
</div>
</script>
<script type="text/x-red" data-help-name="Transmission Add Torrent">
<p>Adds a new torrent via the config panel URL or msg.url value of a .torrent file or a magnet reference.</p>
<p>Returns a single instance of the RPC JSON data in msg.payload with a msg.topic of '/transmission.v1/torrentAdd'</p>
<p>See the 3.3 Torrent Accessors section of the RPC-Spec <a href="https://trac.transmissionbt.com/browser/trunk/extras/rpc-spec.txt" target="_blank">https://trac.transmissionbt.com/browser/trunk/extras/rpc-spec.txt</a>
</script>
<script type="text/javascript">
RED.nodes.registerType('Transmission Add Torrent',{
category: 'transmission',
color:"#C0DEED",
defaults: {
config: {type:"transmission-config",required:true},
url: {value: "",required:false},
name: {value:""}
},
inputs:1,
outputs:1,
icon: "transmission.png",
label: function() {
return this.name||"Add Torrent";
}
});
</script>
<script type="text/x-red" data-template-name="Transmission Remove Torrent">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-config"><i class="fa fa-user"></i> Transmission API</label>
<input type="text" id="node-input-config">
</div>
<div class="form-row node-input-ids">
<label for="node-input-ids"><i class="fa fa-tag"></i> Ids</label>
<input type="text" id="node-input-ids" placeholder="hashString">
</div>
</script>
<script type="text/x-red" data-help-name="Transmission Remove Torrent">
<p>Remove a torrent using the hashString value of a torrent in Transmission using 'msg.ids'.</p>
<p>Returns an empty object in msg.payload with a msg.topic of '/transmission.v1/torrentRemove'</p>
<p>See the 3.3 Torrent Accessors section of the RPC-Spec <a href="https://trac.transmissionbt.com/browser/trunk/extras/rpc-spec.txt" target="_blank">https://trac.transmissionbt.com/browser/trunk/extras/rpc-spec.txt</a>
</script>
<script type="text/javascript">
RED.nodes.registerType('Transmission Remove Torrent',{
category: 'transmission',
color:"#C0DEED",
defaults: {
config: {type:"transmission-config",required:true},
ids: {value: "",required:false},
name: {value:""}
},
inputs:1,
outputs:1,
icon: "transmission.png",
label: function() {
return this.name||"Remove Torrent";
}
});
</script>