Skip to content

Commit

Permalink
feat: add BTN class requirements and BP (#1673)
Browse files Browse the repository at this point in the history
feat: add BTN class requirements and BP
  • Loading branch information
Gawain12 committed Nov 28, 2023
1 parent a1a6124 commit 000785d
Show file tree
Hide file tree
Showing 5 changed files with 175 additions and 7 deletions.
4 changes: 4 additions & 0 deletions resource/i18n/en.json
Expand Up @@ -217,6 +217,7 @@
"comments": "Comments",
"uploads": "Uploaded",
"trueDownloaded": "True Downloaded",
"totalData":"Total Data",
"classPoints": "Class Points",
"unsatisfieds": "Unsatisfieds",
"prewarn": "H&R Prewarn"
Expand Down Expand Up @@ -244,7 +245,10 @@
"downloaded":"Downloaded",
"uploads": "Uploaded",
"downloads": "Downloaded",
"totalSeedtime":"totalSeedtime",
"snatches":"snatched",
"trueDownloaded": "True Downloaded",
"totalData":"Total Data",
"classPoints": "Class Points",
"uniqueGroups": "Unique Groups",
"perfectFLAC": "\"Perfect\" FLAC",
Expand Down
3 changes: 3 additions & 0 deletions resource/i18n/zh-CN.json
Expand Up @@ -213,6 +213,7 @@
"status": "状态",
"uploads": "发布数",
"trueDownloaded": "真实下载",
"totalData":"总流量",
"classPoints": "等级积分",
"unsatisfieds": "H&R考核中",
"prewarn": "H&R预警"
Expand All @@ -239,7 +240,9 @@
"downloaded":"下载量",
"uploads": "发布",
"downloads": "完成",
"snatches":"完成数",
"trueDownloaded": "真实下载",
"totalData":"总流量",
"classPoints": "等级积分",
"posts": "论坛帖子",
"uniqueGroups": "独特分组",
Expand Down
96 changes: 91 additions & 5 deletions resource/sites/broadcasthe.net/config.json
Expand Up @@ -14,6 +14,64 @@
"parseScriptFile": "getSearchResult.js",
"queryString": "searchstr=$key$"
},
"levelRequirements": [{
"level": "1",
"name": "Member",
"interval": "2",
"totalData": "100GiB",
"bonus":"100000",
"snatches":"100",
"privilege": "Can access the XXX forum."
},{
"level": "2",
"name": "Power User",
"interval": "4",
"totalData": "250GiB",
"bonus":"250000",
"snatches":"250",
"privilege": "Has access to the Power User forum, Official and Unofficial Invites forums, Top 10 filters, and can access notifications."
},{
"level": "3",
"name": "Extreme User",
"interval": "82D",
"totalData": "500GiB",
"bonus":"500000",
"snatches":"500",
"privilege": "Has access to the Extreme User forum."
},{
"level": "4",
"name": "Elite",
"interval": "166D",
"totalData": "1TiB",
"bonus":"850000",
"snatches":"1000",
"privilege": "Has access to the Elite forum and can set own Custom Title, and the ability to send invites purchased from the Lumens Store."
},{
"level": "5",
"name": "Guru",
"interval": "251D",
"totalData": "2.5TiB",
"bonus":"1500000",
"snatches":"1500",
"privilege": "Has access to the Guru forum."
},{
"level": "6",
"name": "Master",
"interval": "365D",
"totalData": "7.5TiB",
"bonus":"3000000",
"snatches":"3000",
"privilege": "Has access to the Master forum."
},{
"level": "7",
"name": "Overlord",
"interval": "1065D",
"totalData": "100TiB",
"bonus":"250000000",
"snatches":"35000",
"totalSeedtime":"250000",
"privilege": "Has access to the Overlord forum, Custom Title, Unlimited Invites, and more to come!"
}],
"searchEntry": [{
"name": "all",
"enabled": true
Expand Down Expand Up @@ -76,24 +134,52 @@
"query.text().replace(/,/g,'')"
]
},
"bonusPerHour": {
"selector": ["li:contains('Per Day: ')"],
"filters": ["query.eq(0).text().replace(/,/g, '').match(/\\d+/)","query ? (parseFloat(query[0]) / 24) : 0"]
},
"joinTime": {
"selector": "#section2 > div > div.statistics > div:nth-child(1) > ul > li:nth-child(1) > span",
"filters": [
"query.attr('title')||query.text()",
"dateTime(query).isValid()?dateTime(query).valueOf():query"
]
},
"totalData": {
"selector": "#section2 > div > div.statistics > div:nth-child(3) > ul > li:nth-child(13)",
"filters": [
"query.text().replace(/,/g,'').match(/Total Traffic:.+?([\\d.]+ ?[TGMK]?i?B)/)",
"(query && query.length>=2)?(query[1]).sizeToNumber():0"
]
},
"snatches": {
"selector": "#section2 > div > div.statistics > div:nth-child(3) > ul",
"filters": [
"query.text().match(/Snatched: (\\d+)/g)",
"query.reduce((sum, match) => sum + Number(match.split(\": \")[1]), 0)"
]
},
"totalSeedtime": {
"selector": "#section2 > div > div.statistics > div:nth-child(3) > ul > li:nth-child(12)",
"filters": [
"query.text().replace(/,/g,'').match(/Total Time Seeded:.+?(\\d+).+?/)",
"(query && query.length>=2)?(query[1]):null"
]
},
"seeding": {
"selector": "#section2 > div > div.statistics > div:nth-child(3) > ul > li:nth-child(4)",
"filters": [
"query.text().replace(/,/g,'').match(/Seeding:.+?(\\d+).+?/)",
"(query && query.length>=2)?(query[1]):null"
]
},
"uploads": {
"selector": "#section2 > div > div.statistics > div:nth-child(3) > ul > li:nth-child(2)",
"filters": [
"query.text().replace(/,/g,'').match(/Uploaded:.+?(\\d+).+?/)",
"(query && query.length>=2)?(query[1]):null"
]
},
"bonusPerHour": {
"selector": ["li:contains('Per Day: ')"],
"filters": ["query.eq(0).text().replace(/,/g, '').match(/\\d+/)","query ? (parseFloat(query[0]) / 24) : 0"]
},
"seedingSize": {
"selector": "#section2 > div > div.statistics > div:nth-child(3) > ul > li:nth-child(5)",
"filters": [
Expand All @@ -116,4 +202,4 @@
"supportedFeatures": {
"imdbSearch": false
}
}
}
12 changes: 12 additions & 0 deletions src/interface/common.ts
Expand Up @@ -330,12 +330,16 @@ export interface LevelRequirement {
uploads?: number;
// 下载数要求
downloads?: number;
// snatch
snatches?: number;
// 上传量要求
uploaded?: string | number;
// 下载量要求
downloaded?: string | number;
// 真实下载量
trueDownloaded?: string | number;
// 总流量
totalData?: string | number;
// 积分要求
bonus?: number;
// 做种积分要求
Expand All @@ -344,6 +348,8 @@ export interface LevelRequirement {
seedingTime?: number;
// 平均保种时间要求
averageSeedtime?: number;
// 总保种时间要求
totalSeedtime?: number
// 保种体积要求
seedingSize?: string | number;
// 分享率要求
Expand Down Expand Up @@ -620,8 +626,12 @@ export interface UserInfo {
downloaded?: number;
// 真实下载量
trueDownloaded?: string | number;
// 总流量
totalData?: string | number;
// 下载数
downloads?: number;
// snatch
snatches?: number;
// 分享率
ratio?: number;
// 当前做种数量
Expand All @@ -642,6 +652,8 @@ export interface UserInfo {
seedingTime?: number;
// 平均保种时间
averageSeedtime?: number;
// 总保种时间
totalSeedtime?: number;
// 时魔
bonusPerHour?: number;
// 积分页面
Expand Down
67 changes: 65 additions & 2 deletions src/options/views/Home.vue
Expand Up @@ -163,6 +163,12 @@
nextLevel.trueDownloaded | formatSize
}} 
</template>
<template v-if="nextLevel.totalData">
{{ $t("home.levelRequirement.totalData") }}
{{
nextLevel.totalData | formatSize
}}&nbsp;
</template>
<template v-if="nextLevel.bonus">
<v-icon small color="green darken-4">attach_money</v-icon>{{
nextLevel.bonus | formatNumber
Expand All @@ -188,10 +194,19 @@
nextLevel.averageSeedtime | formatNumber
}}{{$t("home.levelRequirement.days")}}&nbsp;
</template>
<template v-if="nextLevel.totalSeedtime">
<v-icon small color="green darken-4">timer</v-icon>{{
nextLevel.totalSeedtime | formatNumber
}}{{$t("home.levelRequirement.days")}}&nbsp;
</template>
<template v-if="nextLevel.uploads">
<v-icon small color="green darken-4">file_upload</v-icon>{{ nextLevel.uploads
}}&nbsp;
</template>
<template v-if="nextLevel.snatches">
<v-icon small color="red darken-4">file_download</v-icon>{{ nextLevel.snatches
}}&nbsp;
</template>
<template v-if="nextLevel.downloads">
<v-icon small color="red darken-4">file_download</v-icon>{{ nextLevel.downloads
}}&nbsp;
Expand Down Expand Up @@ -233,13 +248,20 @@
<template v-if="levelRequirement.uploads">
<v-icon small color="green darken-4" :title="$t('home.levelRequirement.uploads')">file_upload</v-icon>{{ levelRequirement.uploads }};
</template>
<template v-if="levelRequirement.snatches">
<v-icon small color="red darken-4" :title="$t('home.levelRequirement.snatches')">file_download</v-icon>{{ levelRequirement.snatches }};
</template>
<template v-if="levelRequirement.downloaded">
<v-icon small color="red darken-4" :title="$t('home.levelRequirement.downloaded')">expand_more</v-icon>{{ levelRequirement.downloaded }};
</template>
<template v-if="levelRequirement.trueDownloaded">
{{ $t("home.levelRequirement.trueDownloaded") }}
{{ levelRequirement.trueDownloaded }};
</template>
<template v-if="levelRequirement.totalData">
{{ $t("home.levelRequirement.totalData") }}
{{ levelRequirement.totalData }};
</template>
<template v-if="levelRequirement.downloads">
<v-icon small color="red darken-4" :title="$t('home.levelRequirement.downloads')">file_download</v-icon>{{ levelRequirement.downloads }};
</template>
Expand Down Expand Up @@ -269,6 +291,11 @@
| formatInteger
}}{{$t("home.levelRequirement.days")}};
</template>
<template v-if="levelRequirement.totalSeedtime">
<v-icon small color="green darken-4" :title="$t('home.levelRequirement.totalSeedtime')">timer</v-icon>{{ levelRequirement.totalSeedtime
| formatInteger
}}{{$t("home.levelRequirement.days")}};
</template>
<template v-if="levelRequirement.classPoints">
<v-icon small color="yellow darken-4" :title="$t('home.levelRequirement.classPoints')">energy_savings_leaf</v-icon>{{ levelRequirement.classPoints
| formatInteger
Expand Down Expand Up @@ -301,13 +328,20 @@
<template v-if="option.uploads">
<v-icon small color="green darken-4" :title="$t('home.levelRequirement.uploads')">file_upload</v-icon>{{ option.uploads }};
</template>
<template v-if="option.snatches">
<v-icon small color="red darken-4" :title="$t('home.levelRequirement.snatches')">file_download</v-icon>{{ option.snatches }};
</template>
<template v-if="option.downloaded">
<v-icon small color="red darken-4" :title="$t('home.levelRequirement.downloaded')">expand_more</v-icon>{{ option.downloaded }};
</template>
<template v-if="option.trueDownloaded">
{{ $t("home.levelRequirement.trueDownloaded") }}
{{ option.trueDownloaded }};
</template>
<template v-if="option.totalData">
{{ $t("home.levelRequirement.totalData") }}
{{ option.totalData }};
</template>
<template v-if="option.downloads">
<v-icon small color="red darken-4" :title="$t('home.levelRequirement.downloads')">file_download</v-icon>{{ option.downloads }};
</template>
Expand Down Expand Up @@ -337,6 +371,11 @@
| formatInteger
}}{{$t("home.levelRequirement.days")}};
</template>
<template v-if="option.totalSeedtime">
<v-icon small color="green darken-4" :title="$t('home.levelRequirement.totalSeedtime')">timer</v-icon>{{ option.totalSeedtime
| formatInteger
}}{{$t("home.levelRequirement.days")}};
</template>
<template v-if="option.classPoints">
<v-icon small color="yellow darken-4" :title="$t('home.levelRequirement.classPoints')">energy_savings_leaf</v-icon>{{ option.classPoints
| formatInteger
Expand Down Expand Up @@ -1044,6 +1083,14 @@ export default Vue.extend({
nextLevel.level = levelRequirement.level;
}
}
if (levelRequirement.totalSeedtime) {
let usertotalSeedtime = user.totalSeedtime as number;
let requiredtotalSeedtime = levelRequirement.totalSeedtime as number;
if (usertotalSeedtime < requiredtotalSeedtime) {
nextLevel.totalSeedtime = requiredtotalSeedtime - usertotalSeedtime;
nextLevel.level = levelRequirement.level;
}
}
if (levelRequirement.uploads) {
let userUploads = user.uploads ? user.uploads as number : 0;
Expand All @@ -1053,7 +1100,14 @@ export default Vue.extend({
nextLevel.level = levelRequirement.level;
}
}
if (levelRequirement.snatches) {
let userSnatches = user.snatches ? user.snatches as number : 0;
let requiredSnatches = levelRequirement.snatches as number;
if (userSnatches < requiredSnatches) {
nextLevel.snatches = requiredSnatches - userSnatches;
nextLevel.level = levelRequirement.level;
}
}
if (levelRequirement.downloads) {
let userDownloads = user.downloads ? user.downloads as number : 0;
let requiredDownloads = levelRequirement.downloads as number;
Expand All @@ -1073,7 +1127,16 @@ export default Vue.extend({
nextLevel.level = levelRequirement.level;
}
}
if (levelRequirement.totalData) {
let usertotalData = user.totalData ? (user.totalData as number) : 0;
let requiredtotalData = this.fileSizetoLength(
levelRequirement.totalData as string
);
if (usertotalData < requiredtotalData) {
nextLevel.totalData = requiredtotalData - usertotalData;
nextLevel.level = levelRequirement.level;
}
}
if (levelRequirement.classPoints) {
let userClassPoints = user.classPoints as number;
let requiredClassPoints = levelRequirement.classPoints as number;
Expand Down

0 comments on commit 000785d

Please sign in to comment.