Skip to content

Commit

Permalink
磁力引擎增加通知栏状态显示、更新tracker
Browse files Browse the repository at this point in the history
  • Loading branch information
qiusunshine committed May 21, 2023
1 parent a48b5c1 commit e20271a
Show file tree
Hide file tree
Showing 4 changed files with 342 additions and 25 deletions.
181 changes: 181 additions & 0 deletions app/src/main/assets/trackers.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
http://1337.abcvg.info:80/announce
http://207.241.226.111:6969/announce
http://207.241.231.226:6969/announce
http://[2001:1b10:1000:8101:0:242:ac11:2]:6969/announce
http://[2a04:ac00:1:3dd8::1:2710]:2710/announce
http://bt.endpot.com:80/announce
http://bt.okmp3.ru:2710/announce
http://chouchou.top:8080/announce
http://fe.dealclub.de:6969/announce
http://montreal.nyap2p.com:8080/announce
http://movies.zsw.ca:6969/announce
http://nyaa.tracker.wf:7777/announce
http://open.acgnxtracker.com:80/announce
http://open.acgtracker.com:1096/announce
http://open.tracker.ink:6969/announce
http://p2p.0g.cx:6969/announce
http://parag.rs:6969/announce
http://retracker.hotplug.ru:2710/announce
http://share.camoe.cn:8080/announce
http://t.acg.rip:6699/announce
http://torrentsmd.com:8080/announce
http://tr.cili001.com:8070/announce
http://tracker.birkenwald.de:6969/announce
http://tracker.bt4g.com:2095/announce
http://tracker.dler.com:6969/announce
http://tracker.dler.org:6969/announce
http://tracker.files.fm:6969/announce
http://tracker.gbitt.info:80/announce
http://tracker.ipv6tracker.ru:80/announce
http://tracker.k.vu:6969/announce
http://tracker.mywaifu.best:6969/announce
http://tracker.opentrackr.org:1337/announce
http://tracker.qu.ax:6969/announce
http://tracker.renfei.net:8080/announce
http://tracker.skyts.net:6969/announce
http://tracker.srv00.com:6969/announce
http://tracker.swateam.org.uk:2710/announce
http://v6-tracker.0g.cx:6969/announce
http://vps-dd0a0715.vps.ovh.net:6969/announce
http://wepzone.net:6969/announce
http://www.all4nothin.net:80/announce.php
http://www.peckservers.com:9000/announce
http://www.wareztorrent.com:80/announce
https://1337.abcvg.info:443/announce
https://opentracker.i2p.rocks:443/announce
https://t1.hloli.org:443/announce
https://tr.burnabyhighstar.com:443/announce
https://tr.ready4.icu:443/announce
https://tracker.foreverpirates.co:443/announce
https://tracker.gbitt.info:443/announce
https://tracker.imgoingto.icu:443/announce
https://tracker.jiesen.life:8443/announce
https://tracker.kuroy.me:443/announce
https://tracker.lilithraws.cf:443/announce
https://tracker.lilithraws.org:443/announce
https://tracker.loligirl.cn:443/announce
https://tracker.tamersunion.org:443/announce
https://tracker1.520.jp:443/announce
http://tracker.openbittorrent.com:80/announce
http://tracker2.dler.org:80/announce
http://tracker.edkj.club:6969/announce
http://incine.ru:6969/announce
http://tracker1.itzmx.com:8080/announce
udp://184.105.151.166:6969/announce
udp://207.241.226.111:6969/announce
udp://207.241.231.226:6969/announce
udp://52.58.128.163:6969/announce
udp://6ahddutb1ucc3cp.ru:6969/announce
udp://9.rarbg.com:2810/announce
udp://91.216.110.52:451/announce
udp://[2001:1b10:1000:8101:0:242:ac11:2]:6969/announce
udp://[2001:470:1:189:0:1:2:3]:6969/announce
udp://[2a03:7220:8083:cd00::1]:451/announce
udp://[2a04:ac00:1:3dd8::1:2710]:2710/announce
udp://[2a0f:e586:f:f::81]:6969/announce
udp://aarsen.me:6969/announce
udp://acxx.de:6969/announce
udp://aegir.sexy:6969/announce
udp://astrr.ru:6969/announce
udp://bedro.cloud:6969/announce
udp://boysbitte.be:6969/announce
udp://bt.ktrackers.com:6666/announce
udp://bt1.archive.org:6969/announce
udp://bt2.archive.org:6969/announce
udp://chouchou.top:8080/announce
udp://concen.org:6969/announce
udp://epider.me:6969/announce
udp://exodus.desync.com:6969/announce
udp://fe.dealclub.de:6969/announce
udp://fh2.cmp-gaming.com:6969/announce
udp://freedom.1776.ga:6969/announce
udp://htz3.noho.st:6969/announce
udp://inferno.demonoid.is:3391/announce
udp://ipv6.tracker.monitorit4.me:6969/announce
udp://jutone.com:6969/announce
udp://linfan.moe:6969/announce
udp://mail.artixlinux.org:6969/announce
udp://moonburrow.club:6969/announce
udp://movies.zsw.ca:6969/announce
udp://new-line.net:6969/announce
udp://open.demonii.com:1337/announce
udp://open.dstud.io:6969/announce
udp://open.stealth.si:80/announce
udp://open.tracker.ink:6969/announce
udp://opentor.org:2710/announce
udp://opentracker.i2p.rocks:6969/announce
udp://opentracker.io:6969/announce
udp://p4p.arenabg.com:1337/announce
udp://private.anonseed.com:6969/announce
udp://psyco.fr:6969/announce
udp://public.publictracker.xyz:6969/announce
udp://rep-art.ynh.fr:6969/announce
udp://retracker.hotplug.ru:2710/announce
udp://retracker.lanta-net.ru:2710/announce
udp://retracker01-msk-virt.corbina.net:80/announce
udp://run.publictracker.xyz:6969/announce
udp://ryjer.com:6969/announce
udp://sanincode.com:6969/announce
udp://stargrave.org:6969/announce
udp://static.54.161.216.95.clients.your-server.de:6969/announce
udp://t.133335.xyz:6969/announce
udp://tamas3.ynh.fr:6969/announce
udp://thagoat.rocks:6969/announce
udp://thinking.duckdns.org:6969/announce
udp://thouvenin.cloud:6969/announce
udp://torrents.artixlinux.org:6969/announce
udp://tr.bangumi.moe:6969/announce
udp://tr.cili001.com:8070/announce
udp://tr2.cubonegro.lol:6969/announce
udp://tracker-udp.gbitt.info:80/announce
udp://tracker.4.babico.name.tr:3131/announce
udp://tracker.altrosky.nl:6969/announce
udp://tracker.arcbox.cc:6969/announce
udp://tracker.artixlinux.org:6969/announce
udp://tracker.auctor.tv:6969/announce
udp://tracker.beeimg.com:6969/announce
udp://tracker.birkenwald.de:6969/announce
udp://tracker.bitsearch.to:1337/announce
udp://tracker.bittor.pw:1337/announce
udp://tracker.cubonegro.lol:6969/announce
udp://tracker.cyberia.is:6969/announce
udp://tracker.dler.com:6969/announce
udp://tracker.dler.org:6969/announce
udp://tracker.farted.net:6969/announce
udp://tracker.filemail.com:6969/announce
udp://tracker.jonaslsa.com:6969/announce
udp://tracker.joybomb.tw:6969/announce
udp://tracker.leech.ie:1337/announce
udp://tracker.moeking.me:6969/announce
udp://tracker.monitorit4.me:6969/announce
udp://tracker.openbittorrent.com:6969/announce
udp://tracker.opentrackr.org:1337/announce
udp://tracker.pimpmyworld.to:6969/announce
udp://tracker.qu.ax:6969/announce
udp://tracker.skyts.net:6969/announce
udp://tracker.srv00.com:6969/announce
udp://tracker.swateam.org.uk:2710/announce
udp://tracker.theoks.net:6969/announce
udp://tracker.tiny-vps.com:6969/announce
udp://tracker.torrent.eu.org:451/announce
udp://tracker1.bt.moack.co.kr:80/announce
udp://tracker1.myporn.club:9337/announce
udp://tracker2.dler.com:80/announce
udp://tracker2.dler.org:80/announce
udp://trackerb.jonaslsa.com:6969/announce
udp://u4.trakx.crim.ist:1337/announce
udp://u6.trakx.crim.ist:1337/announce
udp://uploads.gamecoast.net:6969/announce
udp://v1046920.hosted-by-vdsina.ru:6969/announce
udp://v2.iperson.xyz:6969/announce
udp://wepzone.net:6969/announce
udp://www.peckservers.com:9000/announce
udp://www.torrent.eu.org:451/announce
udp://open.tracker.cl:1337/announce
udp://explodie.org:6969/announce
udp://laze.cc:6969/announce
udp://public.tracker.vraphim.com:6969/announce
udp://download.nerocloud.me:6969/announce
udp://carr.codes:6969/announce
udp://black-bird.ynh.fr:6969/announce
udp://tracker.ccp.ovh:6969/announce
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
package com.example.hikerview.ui.thunder;

import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.os.Build;
import android.os.IBinder;

import androidx.annotation.RequiresApi;
import androidx.core.app.NotificationCompat;

import com.example.hikerview.R;
import com.example.hikerview.ui.Application;
import com.example.hikerview.ui.video.EmptyActivity;

/**
* 作者:By 15968
* 日期:On 2019/12/4
* 时间:At 23:01
*/
public class MagentForegroundService extends Service {
private static final int ONGOING_NOTIFICATION_ID = 10;
private NotificationCompat.Builder notification;

public MagentForegroundService() {
}

@Override
public void onCreate() {
super.onCreate();
String channelId = "";
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
channelId = createNotificationChannel();
}

Intent intent = new Intent(this, EmptyActivity.class);
intent.putExtra("magnetStatus", true);
notification = new NotificationCompat.Builder(Application.application, channelId)
.setOnlyAlertOnce(true)
.setOngoing(true)
.setContentTitle("海阔视界·磁力引擎")
.setContentText("磁力引擎运行中")
.setSmallIcon(R.drawable.ic_stat_download)
.setContentIntent(PendingIntent.getActivity(this, 1, intent,
PendingIntent.FLAG_UPDATE_CURRENT))
.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.download));
startForeground(ONGOING_NOTIFICATION_ID, notification.build());
}


@RequiresApi(Build.VERSION_CODES.O)
private String createNotificationChannel() {
String channelId = "海阔视界";
String channelName = "磁力引擎状态通知";
NotificationChannel chan = new NotificationChannel(channelId,
channelName, NotificationManager.IMPORTANCE_HIGH);
chan.setLightColor(Color.BLUE);
chan.setImportance(NotificationManager.IMPORTANCE_HIGH);
chan.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
NotificationManager service = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
if (service != null) {
service.createNotificationChannel(chan);
}
return channelId;
}

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
return super.onStartCommand(intent, flags, startId);
}

@Override
public void onDestroy() {
super.onDestroy();
}

@Override
public IBinder onBind(Intent intent) {
return null;
}
}
48 changes: 35 additions & 13 deletions app/src/main/java/com/example/hikerview/ui/thunder/TSEngine.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,37 @@ package com.example.hikerview.ui.thunder
import android.content.Context
import com.example.hikerview.event.home.LoadingEvent
import com.example.hikerview.service.parser.HttpParser
import com.example.hikerview.ui.Application
import com.example.hikerview.ui.browser.model.DetectedMediaResult
import com.example.hikerview.ui.setting.office.MoreSettingOfficer
import com.example.hikerview.ui.video.PlayerChooser
import com.example.hikerview.ui.view.XiuTanResultPopup
import com.example.hikerview.ui.webdlan.LocalServerParser
import com.example.hikerview.utils.*
import com.example.hikerview.utils.ClipboardUtil
import com.example.hikerview.utils.FileUtil
import com.example.hikerview.utils.PreferenceMgr
import com.example.hikerview.utils.ShareUtil
import com.example.hikerview.utils.ThreadTool
import com.example.hikerview.utils.ToastMgr
import com.example.hikerview.utils.UriUtils
import com.github.se_bastiaan.torrentstream.StreamStatus
import com.github.se_bastiaan.torrentstream.Torrent
import com.github.se_bastiaan.torrentstream.TorrentOptions
import com.github.se_bastiaan.torrentstreamserver.TorrentServerListener
import com.github.se_bastiaan.torrentstreamserver.TorrentStreamServer
import com.lxj.xpopup.XPopup
import com.xunlei.downloadlib.XLTaskHelper
import kotlinx.coroutines.*
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.cancel
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import org.greenrobot.eventbus.EventBus
import org.joor.Reflect
import org.libtorrent4j.AnnounceEntry
import java.io.File
import java.util.*
import java.util.Locale
import java.util.concurrent.atomic.AtomicBoolean
import kotlin.collections.ArrayList

/**
* 作者:By 15968
Expand Down Expand Up @@ -58,6 +68,11 @@ class TSEngine : TorrentEngine() {
} catch (e: Exception) {
e.printStackTrace()
}
try {
Application.application.startMagnetStatusService()
} catch (e: Exception) {
e.printStackTrace()
}
break
}
}
Expand All @@ -82,6 +97,7 @@ class TSEngine : TorrentEngine() {
} else if (files.size == 1) {
startDownloadNow(torrent, fileNames, files[0])
} else {
torrent.pause()
XPopup.Builder(context)
.moveUpToKeyboard(false)
.asCustom(
Expand Down Expand Up @@ -167,7 +183,10 @@ class TSEngine : TorrentEngine() {
PlayerChooser.startPlayer(
context,
name,
url + "#file=" + HttpParser.encodeUrl(name),
url?.replace(
"0.0.0.0",
LocalServerParser.getIP(context)
) + "#file=" + HttpParser.encodeUrl(name),
null
)
}
Expand Down Expand Up @@ -195,21 +214,24 @@ class TSEngine : TorrentEngine() {
override fun initEngine() {
if (torrentStreamServer == null) {
initDir(context)
val torrentOptions: TorrentOptions = TorrentOptions.Builder()
.saveLocation(ThunderManager.path)
.removeFilesAfterStop(true)
.autoDownload(false)
.prepareSize(1 * 1024L * 1024L)
.build()
torrentStreamServer = TorrentStreamServer.getInstance()
torrentStreamServer?.setTorrentOptions(torrentOptions)
torrentStreamServer?.setServerHost(LocalServerParser.getIP(contextProvider.get()))
torrentStreamServer?.setTorrentOptions(buildOptions())
torrentStreamServer?.setServerHost("0.0.0.0")
torrentStreamServer?.setServerPort(52121)
torrentStreamServer?.startTorrentStream()
torrentStreamServer?.addListener(torrentListener)
}
}

private fun buildOptions(): TorrentOptions {
return TorrentOptions.Builder()
.saveLocation(UriUtils.getRootDir(context) + File.separator + "magnet")
.removeFilesAfterStop(true)
.autoDownload(false)
.prepareSize(1 * 1024L * 1024L)
.build()
}

override fun isDownloading(): Boolean {
return torrentStreamServer?.currentTorrent != null || torrentStreamServer?.isStreaming == true
}
Expand Down
Loading

0 comments on commit e20271a

Please sign in to comment.