Skip to content

Commit

Permalink
fix(mt): keep upload task
Browse files Browse the repository at this point in the history
  • Loading branch information
fzlins committed May 22, 2024
1 parent 5d2a9da commit f348f26
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions src/options/views/search/KeepUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ export default Vue.extend({
status: this.$t("keepUploadTask.status.downloading").toString()
});
// requests.push(this.getTorrent(item.url, index));
this.getTorrent(item.url, index)
this.getTorrent(item, index)
.then((result: any) => {
this.verification(result, index);
})
Expand All @@ -352,7 +352,7 @@ export default Vue.extend({
this.verifiedItems[index].loading = true;
this.verifiedItems[index].status = this.$t("keepUploadTask.status.downloading").toString();
this.getTorrent(this.verifiedItems[index].data.url, index)
this.getTorrent(this.verifiedItems[index].data, index)
.then((result: any) => {
this.verification(result, index);
})
Expand Down Expand Up @@ -462,11 +462,30 @@ export default Vue.extend({
/**
* 获取种子文件内容
*/
getTorrent(url: string, index: number): Promise<any> {
getTorrent(item: SearchResultItem, index: number): Promise<any> {
if (item.url) {
switch (item.site.name) {
case "M-Team":
let id = item.url.replace(/^\D+/g, '');
console.log(`getTorrentDataFromURL.M-Team ${item.url} -> ${id}`);
if (id) {
if (parseInt(id)) {
let torrentURL = PPF.resolveMTDownloadURL(id, item.site);
console.log(`getTorrentDataFromURL.M-Team1 ${item.url} -> ${torrentURL}`);
item.url = torrentURL;
} else {
console.log(`getTorrentDataFromURL.M-Team2 ${item.url}, id 链接可能已是直链, 不进行转换...`);
}
}
break
default:
break
}
}
return new Promise<any>((resolve?: any, reject?: any) => {
extension
.sendRequest(EAction.getTorrentDataFromURL, null, {
url,
url: item.url,
parseTorrent: true
})
.then(result => {
Expand Down

0 comments on commit f348f26

Please sign in to comment.