diff --git a/src/components/TorrentDetail/Info.vue b/src/components/TorrentDetail/Info.vue index 48fca9ac..64b2b76f 100644 --- a/src/components/TorrentDetail/Info.vue +++ b/src/components/TorrentDetail/Info.vue @@ -72,6 +72,8 @@ const speedPpts = [ { title: 'download_speed', text: 'dlspeed' }, { title: 'upload_limit', text: 'up_limit' }, { title: 'upload_speed', text: 'upspeed' }, + { title: 'avg_download_speed', text: 'avgDownloadSpeed' }, + { title: 'avg_upload_speed', text: 'avgUploadSpeed' }, { title: 'global_speed', text: 'globalSpeed' } ] diff --git a/src/composables/TorrentBuilder.ts b/src/composables/TorrentBuilder.ts index 66577d4d..0525862a 100644 --- a/src/composables/TorrentBuilder.ts +++ b/src/composables/TorrentBuilder.ts @@ -6,7 +6,7 @@ import { useI18n } from 'vue-i18n' export function useTorrentBuilder() { const { t } = useI18n() - const computedValues = ['globalSpeed', 'globalVolume', 'priority'] + const computedValues = ['avgDownloadSpeed', 'avgUploadSpeed', 'globalSpeed', 'globalVolume', 'priority'] function buildFromQbit(data: QbitTorrent): Torrent { const torrent = { @@ -60,8 +60,15 @@ export function useTorrentBuilder() { upspeed: data.upspeed } + const dlDuration = torrent.time_active - torrent.seeding_time + const ulDuration = torrent.time_active + return Object.freeze({ ...torrent, + // const qlonglong dlDuration = torrent->activeTime() - torrent->finishedTime(); + // dataDict[KEY_PROP_DL_SPEED_AVG] = torrent->totalDownload() / ((dlDuration == 0) ? -1 : dlDuration); + avgDownloadSpeed: torrent.downloaded / ((dlDuration == 0) ? -1 : dlDuration), + avgUploadSpeed: torrent.uploaded / ((ulDuration == 0) ? -1 : ulDuration), globalSpeed: torrent.dlspeed + torrent.upspeed, globalVolume: torrent.downloaded + torrent.uploaded }) diff --git a/src/constants/qbit/SortOptions.ts b/src/constants/qbit/SortOptions.ts index c3e79360..da29cfd0 100644 --- a/src/constants/qbit/SortOptions.ts +++ b/src/constants/qbit/SortOptions.ts @@ -3,6 +3,8 @@ export enum SortOptions { AMOUNT_LEFT = 'amount_left', AUTO_TMM = 'auto_tmm', AVAILABILITY = 'availability', + AVG_DOWNLOAD_SPEED = 'avgDownloadSpeed', + AVG_UPLOAD_SPEED = 'avgUploadSpeed', CATEGORY = 'category', COMPLETED = 'completed', COMPLETION_ON = 'completion_on', diff --git a/src/constants/vuetorrent/DashboardDefaults.ts b/src/constants/vuetorrent/DashboardDefaults.ts index e02af5a9..da63334f 100644 --- a/src/constants/vuetorrent/DashboardDefaults.ts +++ b/src/constants/vuetorrent/DashboardDefaults.ts @@ -15,6 +15,14 @@ export const propsData: PropertyData = { active: true, order: 17 }, + [DashboardProperty.AVG_DOWNLOAD_SPEED]: { + active: false, + order: 40 + }, + [DashboardProperty.AVG_UPLOAD_SPEED]: { + active: false, + order: 41 + }, [DashboardProperty.CATEGORY]: { active: true, order: 14 @@ -173,6 +181,14 @@ export const propsMetadata: PropertyMetadata = { props: { title: 'availability', value: 'availability' }, type: DashboardPropertyType.TEXT }, + [DashboardProperty.AVG_DOWNLOAD_SPEED]: { + props: { title: 'avg_download_speed', value: 'avgDownloadSpeed' }, + type: DashboardPropertyType.SPEED + }, + [DashboardProperty.AVG_UPLOAD_SPEED]: { + props: { title: 'avg_upload_speed', value: 'avgUploadSpeed' }, + type: DashboardPropertyType.SPEED + }, [DashboardProperty.CATEGORY]: { props: { title: 'category', value: 'category', color: 'category' }, type: DashboardPropertyType.CHIP diff --git a/src/constants/vuetorrent/DashboardProperty.ts b/src/constants/vuetorrent/DashboardProperty.ts index a3830a80..2de41b5a 100644 --- a/src/constants/vuetorrent/DashboardProperty.ts +++ b/src/constants/vuetorrent/DashboardProperty.ts @@ -2,6 +2,8 @@ export enum DashboardProperty { ADDED_ON = 'added_on', AMOUNT_LEFT = 'amount_left', AVAILABILITY = 'availability', + AVG_DOWNLOAD_SPEED = 'avg_download_speed', + AVG_UPLOAD_SPEED = 'avg_upload_speed', CATEGORY = 'category', COMPLETED_ON = 'completed_on', CONTENT_PATH = 'content_path', diff --git a/src/locales/en.json b/src/locales/en.json index d8215da5..16d0ca7d 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -29,6 +29,8 @@ "amount_left": "Amount Left", "auto_tmm": "Auto TMM", "availability": "Availability", + "avg_download_speed": "Avg DL Speed", + "avg_upload_speed": "Avg UL Speed", "category": "Category", "completed": "Completed", "completion_on": "Completed On", @@ -189,6 +191,8 @@ "amount_left": "Amount Left", "auto_tmm": "Automatic Torrent Management", "availability": "Availability", + "avg_download_speed": "Average Download Speed", + "avg_upload_speed": "Average Upload Speed", "available_peers": "Peers (swarm)", "available_seeds": "Seeds (swarm)", "category": "Category", diff --git a/src/pages/Dashboard.vue b/src/pages/Dashboard.vue index 92849e92..b0b3ae9b 100644 --- a/src/pages/Dashboard.vue +++ b/src/pages/Dashboard.vue @@ -30,6 +30,8 @@ const torrentSortOptions = [ { value: 'amount_left', title: t('dashboard.sortBy.amount_left') }, { value: 'auto_tmm', title: t('dashboard.sortBy.auto_tmm') }, { value: 'availability', title: t('dashboard.sortBy.availability') }, + { value: 'avg_download_speed', title: t('dashboard.sortBy.avg_download_speed') }, + { value: 'avg_upload_speed', title: t('dashboard.sortBy.avg_upload_speed') }, { value: 'category', title: t('dashboard.sortBy.category') }, { value: 'completed', title: t('dashboard.sortBy.completed') }, { value: 'completion_on', title: t('dashboard.sortBy.completion_on') }, diff --git a/src/types/vuetorrent/Torrent.ts b/src/types/vuetorrent/Torrent.ts index 9a07484e..ff1877e5 100644 --- a/src/types/vuetorrent/Torrent.ts +++ b/src/types/vuetorrent/Torrent.ts @@ -50,6 +50,8 @@ export default interface Torrent { upspeed: number // computed + avgDownloadSpeed: number, + avgUploadSpeed: number, globalSpeed: number globalVolume: number