initial commit

This commit is contained in:
root committed 2026-11-09 02:00:13 +04:00
commit 19fe71b4c1
33 files changed
+557

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
<?php
require_once('../../php/util.php');
require_once('../../php/settings.php');
eval(FileUtil::getPluginConf('multidisk'));
if (empty($partitionDirectories)) {
if (User::isLocalMode() && rTorrentSettings::get()->linkExist && file_exists(rTorrentSettings::get()->directory)) {
$partitionDirectories = [rTorrentSettings::get()->directory => ''];
} else {
$partitionDirectories = [$topDirectory => ''];
}
}
$ret = [];
foreach (array_keys($partitionDirectories) as $dir) {
$item = [
"total" => 0,
"free" => 0,
];
if (is_dir($dir)) {
$item["total"] = disk_total_space($dir);
$item["free"] = disk_free_space($dir);
}
$ret[] = $item;
}
CachedEcho::send(JSON::safeEncode($ret), "application/json");
+6
View File
@@ -0,0 +1,6 @@
<?php
$diskUpdateInterval = 10; // in seconds
$notifySpaceLimit = 512; // in Mb
$partitionDirectories = ['/mnt/media1' => 'media1', '/mnt/media2' => 'media2']; // path => label shown on the bar. If empty, the rtorrent download directory is used
$freeBytesInMeter = false; // show free space instead of %
+114
View File
@@ -0,0 +1,114 @@
plugin.loadLang();
plugin.loadMainCSS();
plugin.setValue = function( i, full, free )
{
var used = full-free;
var percent = iv(full ? used/full*100 : 0);
if(percent>100)
percent = 100;
var name = (plugin.diskNames && plugin.diskNames[i]) ? plugin.diskNames[i] + ': ' : '';
$("[id='meter-disk-value']").eq(i).width( percent+"%" ).css( { "background-color": (new RGBackground()).setGradient(this.prgStartColor,this.prgEndColor,percent).getColor(),
visibility: !percent ? "hidden" : "visible" } );
if(plugin.freeBytesInMeter) $("[id='meter-disk-text']").eq(i).text(name + theConverter.bytes(free));
else $("[id='meter-disk-text']").eq(i).text(name + percent+'%');
if(theUILang.diskUsage) {
$("[id='meter-disk-holder']").eq(i).prop("title",
theUILang.diskUsage
.replace(/%USED%/, theConverter.bytes(used))
.replace(/%TOTAL%/, theConverter.bytes(full))
.replace(/%FREE%/, theConverter.bytes(free) + ", " + iv(full ? free/full*100 : 0) + "%")
);
}
}
plugin.setValues = function( data )
{
var low = false;
$.each(data, function(i, d)
{
plugin.setValue(i, d.total, d.free);
if(d.free<plugin.notifySpaceLimit)
low = true;
});
if($.noty && plugin.allStuffLoaded)
{
if(low && !plugin.noty)
plugin.noty = $.noty(
{
text: theUILang.diskNotification,
layout : 'bottomLeft',
type: 'error',
timeout : false,
closeOnSelfClick: false
});
if(!low && plugin.noty)
{
$.noty.close(plugin.noty);
plugin.noty = null;
}
}
}
plugin.init = function()
{
if(getCSSRule("#meter-disk-holder"))
{
plugin.prgStartColor = new RGBackground("#99D699");
plugin.prgEndColor = new RGBackground("#E69999");
var holders = $("<div>");
for(var i = 0; i < plugin.diskCount; i++)
holders.append(
$("<div>").attr({id: "meter-disk-holder"}).append(
$("<div>").attr({id: "meter-disk-value"}).width(0),
$("<div>").attr({id: "meter-disk-text"}),
)
);
plugin.addPaneToStatusbar(
"meter-disk-pane",
$("<div>").append(
$("<div>").addClass("icon"),
holders.children(),
),
1, true,
);
plugin.check = function()
{
jQuery.ajax(
{
type: "GET",
timeout: theWebUI.settings["webui.reqtimeout"],
async : true,
cache: false,
url : "plugins/multidisk/action.php",
dataType : "json",
success : function(data)
{
plugin.setValues( data );
},
complete : function(jqXHR, textStatus)
{
plugin.diskTimeout = window.setTimeout(plugin.check,plugin.interval*1000);
}
});
};
plugin.check();
plugin.markLoaded();
}
else
window.setTimeout(arguments.callee,500);
};
plugin.onRemove = function()
{
plugin.removePaneFromStatusbar("meter-disk-pane");
if(plugin.diskTimeout)
{
window.clearTimeout(plugin.diskTimeout);
plugin.diskTimeout = null;
}
}
plugin.init();
+30
View File
@@ -0,0 +1,30 @@
<?php
eval(FileUtil::getPluginConf($plugin["name"]));
if (empty($partitionDirectories)) {
if (User::isLocalMode() && rTorrentSettings::get()->linkExist && file_exists(rTorrentSettings::get()->directory)) {
$partitionDirectories = [rTorrentSettings::get()->directory => ''];
} else {
$partitionDirectories = [$topDirectory => ''];
}
}
$diskOk = function_exists('disk_total_space') && function_exists('disk_free_space');
if ($diskOk) {
foreach (array_keys($partitionDirectories) as $dir) {
if ((disk_total_space($dir) === false) || (disk_free_space($dir) === false)) {
$diskOk = false;
}
}
}
if (!$diskOk) {
$jResult .= "plugin.disable();";
} else {
$jResult .= "plugin.interval = " . $diskUpdateInterval . "; plugin.notifySpaceLimit = " . ($notifySpaceLimit * 1024 * 1024) . ";";
$jResult .= "plugin.freeBytesInMeter = " . ($freeBytesInMeter ? 1 : 0) . ";";
$jResult .= "plugin.diskCount = " . count($partitionDirectories) . ";";
$jResult .= "plugin.diskNames = " . json_encode(array_values($partitionDirectories)) . ";";
$theSettings->registerPlugin($plugin["name"], $pInfo["perms"]);
}
+12
View File
@@ -0,0 +1,12 @@
/*
* PLUGIN DISKSPACE
*
* Czech language file.
*
* Author:
*/
theUILang.diskNotification = "Warning! The disk is full. rTorrent may not run correctly, and no data will be downloaded until you free some disk space.";
theUILang.diskUsage = "%USED%/%TOTAL% (%FREE% free)";
thePlugins.get("diskspace").langLoaded();
+12
View File
@@ -0,0 +1,12 @@
/*
* PLUGIN DISKSPACE
*
* Danish language file.
*
* Author:
*/
theUILang.diskNotification = "Warning! The disk is full. rTorrent may not run correctly, and no data will be downloaded until you free some disk space.";
theUILang.diskUsage = "%USED%/%TOTAL% (%FREE% free)";
thePlugins.get("diskspace").langLoaded();
+12
View File
@@ -0,0 +1,12 @@
/*
* PLUGIN DISKSPACE
*
* German language file.
*
* Author: Dario Rugani (kontakt@rugani.de)
*/
theUILang.diskNotification = "Warnung! Die Festplatte ist voll. Es könnte sein, dass rTorrent nicht ordnungsgemäß funktioniert und es werden keine Daten heruntergeladen, bis Speicherplatz freigeben wird.";
theUILang.diskUsage = "%USED%/%TOTAL% (%FREE% free)";
thePlugins.get("diskspace").langLoaded();
+12
View File
@@ -0,0 +1,12 @@
/*
* PLUGIN DISKSPACE
*
* Greek language file.
*
* Author: Chris Kanatas (ckanatas@gmail.com)
*/
theUILang.diskNotification = "Προειδοποίηση! Ο δίσκος είναι πλήρης. Το rTorrent μπορεί να μην λειτουργεί σωστά, και δεν θα γίνεται λήψη δεδομένων μέχρι να ελευθερώσετε χώρο στο δίσκο.";
theUILang.diskUsage = "%USED%/%TOTAL% (%FREE% ελεύθερα)";
thePlugins.get("diskspace").langLoaded();
+12
View File
@@ -0,0 +1,12 @@
/*
* PLUGIN DISKSPACE
*
* English language file.
*
* Author:
*/
theUILang.diskNotification = "Warning! The disk is full. rTorrent may not run correctly, and no data will be downloaded until you free some disk space.";
theUILang.diskUsage = "%USED%/%TOTAL% (%FREE% free)";
thePlugins.get("diskspace").langLoaded();
+12
View File
@@ -0,0 +1,12 @@
/*
* PLUGIN DISKSPACE
*
* Spanish language file.
*
* Author:
*/
theUILang.diskNotification = "Warning! The disk is full. rTorrent may not run correctly, and no data will be downloaded until you free some disk space.";
theUILang.diskUsage = "%USED%/%TOTAL% (%FREE% free)";
thePlugins.get("diskspace").langLoaded();
+12
View File
@@ -0,0 +1,12 @@
/*
* PLUGIN DISKSPACE
*
* Finnish language file.
*
* Author:
*/
theUILang.diskNotification = "Warning! The disk is full. rTorrent may not run correctly, and no data will be downloaded until you free some disk space.";
theUILang.diskUsage = "%USED%/%TOTAL% (%FREE% free)";
thePlugins.get("diskspace").langLoaded();
+12
View File
@@ -0,0 +1,12 @@
/*
* PLUGIN DISKSPACE
*
* French language file.
*
* Author: Nicobubulle (nicobubulle@gmail.com)
*/
theUILang.diskNotification = "Attention! Votre espace disque est plein. rTorrent peut ne pas fonctionner normalement, et aucune donnée ne sera téléchargée jusqu'à ce que vous libériez de l'espace.";
theUILang.diskUsage = "%USED%/%TOTAL% (%FREE% libres)";
thePlugins.get("diskspace").langLoaded();
+12
View File
@@ -0,0 +1,12 @@
/*
* PLUGIN DISKSPACE
*
* Hungarian language file.
*
* Author:
*/
theUILang.diskNotification = "Figyelem! A lemez megtelt. Az rTorrent nem fog megfelelően futni, és addig nem töltődnek le adatok, amíg nem szabadít fel némi helyet a lemezen.";
theUILang.diskUsage = "%USED%/%TOTAL% (%FREE% free)";
thePlugins.get("diskspace").langLoaded();
+12
View File
@@ -0,0 +1,12 @@
/*
* PLUGIN DISKSPACE
*
* Italian language file.
*
* Author:
*/
theUILang.diskNotification = "Attenzione! Il disco è pieno. rTorrent potrebbe non funzionare correttamente, nessun dato verrà scaricato fino a che non liberi spazio su disco.";
theUILang.diskUsage = "%USED%/%TOTAL% (%FREE% free)";
thePlugins.get("diskspace").langLoaded();
+12
View File
@@ -0,0 +1,12 @@
/*
* PLUGIN DISKSPACE
*
* Korean language file.
*
* Author: Limerainne (limerainne@gmail.com)
*/
theUILang.diskNotification = "경고! 디스크가 가득 찼습니다. rTorrent가 정상적으로 동작하지 않을 수 있으며, 여유 공간을 확보하기 전까지는 어떤 데이터도 다운로드되지 않습니다.";
theUILang.diskUsage = "%USED%/%TOTAL% (%FREE% free)";
thePlugins.get("diskspace").langLoaded();
+12
View File
@@ -0,0 +1,12 @@
/*
* PLUGIN DISKSPACE
*
* Latvian language file.
*
* Author:
*/
theUILang.diskNotification = "Warning! The disk is full. rTorrent may not run correctly, and no data will be downloaded until you free some disk space.";
theUILang.diskUsage = "%USED%/%TOTAL% (%FREE% free)";
thePlugins.get("diskspace").langLoaded();
+12
View File
@@ -0,0 +1,12 @@
/*
* PLUGIN DISKSPACE
*
* Dutch language file.
*
* Author:
*/
theUILang.diskNotification = "Warning! The disk is full. rTorrent may not run correctly, and no data will be downloaded until you free some disk space.";
theUILang.diskUsage = "%USED%/%TOTAL% (%FREE% free)";
thePlugins.get("diskspace").langLoaded();
+12
View File
@@ -0,0 +1,12 @@
/*
* PLUGIN DISKSPACE
*
* Norwegian (nynorsk) language file.
*
* Author: jakobbg (jakob@grimstveit.no)
*/
theUILang.diskNotification = "Åtvaring! Disken er full. rTorrent vil kanskje feile. Ingen data vert lasta ned før du frigjer diskplass.";
theUILang.diskUsage = "%USED%/%TOTAL% (%FREE% ledig)";
thePlugins.get("diskspace").langLoaded();
+12
View File
@@ -0,0 +1,12 @@
/*
* PLUGIN DISKSPACE
*
* Norwegian language file.
*
* Author: nirosa (nirosax@gmail.com)
*/
theUILang.diskNotification = "Advarsel! Disken er full. rTorrent vil kanskje feile. Ingen data blir lastest ned før du frigjør diskplass.";
theUILang.diskUsage = "%USED%/%TOTAL% (%FREE% free)";
thePlugins.get("diskspace").langLoaded();
+12
View File
@@ -0,0 +1,12 @@
/*
* PLUGIN DISKSPACE
*
* Polish language file.
*
* Author:
*/
theUILang.diskNotification = "Uwaga! Dysk jest pełny. rTorrent może nie działać poprawnie i żadne dane nie zostaną pobrane, dopóki nie zwolnisz miejsca na dysku.";
theUILang.diskUsage = "%USED%/%TOTAL% (%FREE% free)";
thePlugins.get("diskspace").langLoaded();
+12
View File
@@ -0,0 +1,12 @@
/*
* PLUGIN DISKSPACE
*
* Portuguese (Brazil) language file.
*
* Author:
*/
theUILang.diskNotification = "Atenção! O disco está cheio. O rTorrent pode não funcionar corretamente, e nenhum dado será baixado até que você libere espaço em disco.";
theUILang.diskUsage = "%USED%/%TOTAL% (%FREE% free)";
thePlugins.get("diskspace").langLoaded();
+12
View File
@@ -0,0 +1,12 @@
/*
* PLUGIN DISKSPACE
*
* Portuguese (Portugal) language file.
*
* Author:
*/
theUILang.diskNotification = "Aviso! O disco está cheio. O rTorrent pode não funcionar corretamente e nenhum dado será descarregado até espaço em disco ser libertado.";
theUILang.diskUsage = "%USED%/%TOTAL% (%FREE% free)";
thePlugins.get("diskspace").langLoaded();
+12
View File
@@ -0,0 +1,12 @@
/*
* PLUGIN DISKSPACE
*
* Russian language file.
*
* Author:
*/
theUILang.diskNotification = "Внимание! Ваш диск переполнен. До тех пор, пока Вы не освободите дисковое пространство, данные загружаться не будут, и rTorrent может работать не корректно.";
theUILang.diskUsage = "%USED%/%TOTAL% (%FREE% free)";
thePlugins.get("diskspace").langLoaded();
+12
View File
@@ -0,0 +1,12 @@
/*
* PLUGIN DISKSPACE
*
* Slovak language file.
*
* Author:
*/
theUILang.diskNotification = "Warning! The disk is full. rTorrent may not run correctly, and no data will be downloaded until you free some disk space.";
theUILang.diskUsage = "%USED%/%TOTAL% (%FREE% free)";
thePlugins.get("diskspace").langLoaded();
+12
View File
@@ -0,0 +1,12 @@
/*
* PLUGIN DISKSPACE
*
* Serbian language file.
*
* Author:
*/
theUILang.diskNotification = "Warning! The disk is full. rTorrent may not run correctly, and no data will be downloaded until you free some disk space.";
theUILang.diskUsage = "%USED%/%TOTAL% (%FREE% free)";
thePlugins.get("diskspace").langLoaded();
+12
View File
@@ -0,0 +1,12 @@
/*
* PLUGIN DISKSPACE
*
* Swedish language file.
*
* Author: Magnus Holm (holmen@brasse.se)
*/
theUILang.diskNotification = "Varning! Disken är full. rTorrent kan inte köras korrekt och ingen data kommer att laddas ner förrän du frigör diskutrymme.";
theUILang.diskUsage = "%USED%/%TOTAL% (%FREE% free)";
thePlugins.get("diskspace").langLoaded();
+13
View File
@@ -0,0 +1,13 @@
/*
* PLUGIN DISKSPACE
*
* Turkish language file.
*
* Authors: Müslüm Barış Korkmazer (bkbabinco@gmail.com)
* Selim Şumlu
*/
theUILang.diskNotification = "Uyarı! Disk dolu. rTorrent düzgün çalışmayabilir. Yeni veri indirmek için disk alanınızı boşaltmalısınız.";
theUILang.diskUsage = "%USED%/%TOTAL% (%FREE% free)";
thePlugins.get("diskspace").langLoaded();
+12
View File
@@ -0,0 +1,12 @@
/*
* PLUGIN DISKSPACE
*
* Ukrainian language file.
*
* Author: Oleksandr Natalenko (oleksandr@natalenko.name)
*/
theUILang.diskNotification = "Попередження! Диск заповнено. Програма rTorrent може працювати некоректно, а дані не завантажуватимуться, поки не з’явиться вільне місце на диску.";
theUILang.diskUsage = "%USED%/%TOTAL% (%FREE% free)";
thePlugins.get("diskspace").langLoaded();
+12
View File
@@ -0,0 +1,12 @@
/*
* PLUGIN DISKSPACE
*
* Vietnamese language file.
*
* Author: Ta Xuan Truong (truongtx8 AT gmail DOT com)
*/
theUILang.diskNotification = "Chú ý! Ổ đĩa đầy. rTorrent có thể chạy không ổn định, và sẽ không có dữ liệu nào được tải về thêm cho tới khi bạn dọn bớt ổ đĩa.";
theUILang.diskUsage = "%USED%/%TOTAL% (%FREE% free)";
thePlugins.get("diskspace").langLoaded();
+12
View File
@@ -0,0 +1,12 @@
/*
* PLUGIN DISKSPACE
*
* Chinese Simplified language file.
*
* Author:
*/
theUILang.diskNotification = "警告! 存储空间已满. rTorrent 可能不会正常运行, 并且在你释放一些空间之前, 将不会下载数据.";
theUILang.diskUsage = "%USED%/%TOTAL% (%FREE% free)";
thePlugins.get("diskspace").langLoaded();
+12
View File
@@ -0,0 +1,12 @@
/*
* PLUGIN DISKSPACE
*
* Chinese Traditional language file.
*
* Author:
*/
theUILang.diskNotification = "Warning! The disk is full. rTorrent may not run correctly, and no data will be downloaded until you free some disk space.";
theUILang.diskUsage = "%USED%/%TOTAL% (%FREE% free)";
thePlugins.get("diskspace").langLoaded();
+50
View File
@@ -0,0 +1,50 @@
#StatusBar {
--pane-disk-icon: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABIUlEQVR4AWKgGOTmZzbkFWQDOCMDFQZhGIju/39TAWrSoLYguupt14K2DJgoPHJc4gMRT+C7L4YnT4wxS7Jg33eYGbz38GU2WO6ZLe+ZQwyXIL0TRLUgAv0iWtC6E4USVYRQCbZtg3MDhqHGwZV87ao5z/MlWNc1S/q+vwW/f5qmVmBmdyS84W0rWJYFXdedEjKOIzvCnLuUEm/O7hQcx/H3lxERIb+CDxdjoEExCEDR//+KAbYGg9kzAlVUqSoK1Lfc94To4TjXxfHeQ2u9IKVc9j+11iUwzm3bcF0XKKUQQkAphRgjCCHIOU+/7wtjDGbAOQfOOc6T4L5vMMZmwFqLYz+QUvp5H/48zxrovaO1NimlDEII3+HCcAMoz0yUAgBzjuKercwF7wAAAABJRU5ErkJggg==);
}
#meter-disk-pane .icon {
background-image: var(--pane-disk-icon);
}
#meter-disk-holder {
border: inset 1px #BBBBBB;
position: relative;
height: 18px;
}
#meter-disk-value {
height: 100%;
}
#meter-disk-text {
position: absolute;
top: 0;
text-align: center;
width: 100%;
height: 100%;
}
/* Custom break point settings for responsiveness */
/* X-Small devices (portrait phones, less than 576px) */
/* No media query for `xs` since this is the default in Bootstrap */
/* Custom rules for x-small devices */
#meter-disk-holder {
width: 50px;
}
/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
/* Custom rules for large devices */
#meter-disk-holder {
width: 100px;
}
}
#meter-disk-holder {
display: inline-block;
vertical-align: top;
}
#meter-disk-holder {
display: inline-block;
vertical-align: top;
margin-right: 4px;
}
+6
View File
@@ -0,0 +1,6 @@
plugin.description: Disk meters for several partitions in the bottom bar.
plugin.author: pyrschtjag
plugin.version: 1.0
rtorrent.need: 0
php.extensions.error: json
plugin.help: https://github.com/Novik/ruTorrent/wiki/PluginDiskspace