Image improvements (#847)

* Fix image performer filtering
* Add performer images tab
* Add studio images tab
* Rename interface
* Add tag images tab
* Add path filtering for images
* Show image stats on stats page
* Fix incorrect scan counts after timeout
* Add gallery filters
* Relax scene gallery selector
This commit is contained in:
WithoutPants
2020-10-20 10:11:15 +11:00
committed by GitHub
parent 80199f79f3
commit 8eda72ad89
31 changed files with 463 additions and 169 deletions

View File

@@ -16,6 +16,7 @@ const Units: Unit[] = [
"terabyte",
"petabyte",
];
const shortUnits = ["B", "KB", "MB", "GB", "TB", "PB"];
const truncate = (
value?: string,
@@ -32,7 +33,7 @@ const fileSize = (bytes: number = 0) => {
let unit = 0;
let count = bytes;
while (count >= 1024) {
while (count >= 1024 && unit + 1 < Units.length) {
count /= 1024;
unit++;
}
@@ -43,6 +44,11 @@ const fileSize = (bytes: number = 0) => {
};
};
const formatFileSizeUnit = (u: Unit) => {
const i = Units.indexOf(u);
return shortUnits[i];
};
const secondsToTimestamp = (seconds: number) => {
let ret = new Date(seconds * 1000).toISOString().substr(11, 8);
@@ -141,6 +147,7 @@ const formatDate = (intl: IntlShape, date?: string) => {
const TextUtils = {
truncate,
fileSize,
formatFileSizeUnit,
secondsToTimestamp,
fileNameFromPath,
age: getAge,