Hello,
i've made some modification on webui to get space disk :
1] Create a file get.js in /usr/share/transmission/web/javascript (linux path here)
touch /usr/share/transmission/web/javascript/get.js
nano /usr/share/transmission/web/javascript/get.js
Code: Select all
var data = new Array();
var i = 0;
var datafile = window.location.href.substring(0,
window.location.href.lastIndexOf("/") + 1) +
"./javascript/data.txt";
var url = new java.net.URL(datafile);
var connect = url.openConnection();
var input = new java.io.BufferedReader(
new java.io.InputStreamReader(
connect.getInputStream()));
var aLine = ""
while((aLine = input.readLine()) != null) {
data[i++] = aLine;
}
As you can see, the file data.txt should be in the same directory /usr/share/transmission/web/javascript/
2] We need to make some modification on the index.html file :
nano /usr/share/transmission/web/index.html
Find this line :
<script type="text/javascript" src="./javascript/jquery/jquery.transmenu.min.js"></script>
Then add before or after this one :
Code: Select all
<script type="text/javascript" src="./javascript/get.js"></script>
3] Another modification in index.html :
Find this line :
<div id="disk_space_container"></div>
Put this between <div></div>:
Code: Select all
Disk Space :
<SCRIPT language = "Javascript">
var temp = ""
temp = data[0];
document.write(temp);
</SCRIPT>
You should have this :
<div id="disk_space_container">Disk Space :
<SCRIPT language = "Javascript">
var temp = ""
temp = data[0];
document.write(temp);
</SCRIPT>
</div>
For this part, there is no need to but on Linux, but the path should be different.
Next i've just make a cron that is check every hours the disk space and put the result in the data.txt file.
touch ~/disk_trans.sh
nano ~/disk_trans.sh
Code: Select all
df /mnt -h | grep -i /mnt | awk {'print "Used:",$3,"- Free:",$4'} >/usr/share/transmission/web/javascript/data.txt
chmod +x ~/disk_trans.sh
crontab -e
for every 10 mins :
Code: Select all
0,10,20,30,40,50 * * * * /root/disk_trans.sh
That's all.
The cron launch the script every hours, then put the disk space on data.txt and the javascript in webui just read the data.txt file.
Sorry for my bad english
For any question, just ask me !
ps : the disk space appear in the bottom right corner of webui