Skip to content

Commit

Permalink
[feature|doc] Support downloading common files; supports renaming med…
Browse files Browse the repository at this point in the history
…ia library files; update README and screenshots
  • Loading branch information
SkyD666 committed Nov 30, 2024
1 parent 248a3ae commit c0642f1
Show file tree
Hide file tree
Showing 81 changed files with 3,073 additions and 745 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

1. **Subscribe to RSS**, Update RSS, **Read** RSS
2. **Automatically update RSS** subscriptions
3. **Download enclosures** (enclosure tags) of **torrent or magnet** links in RSS articles
3. **Download** enclosures (enclosure tags) in RSS articles, also supports **torrent or magnet links**
4. **Seeding** downloaded files
5. **Play media enclosures or downloaded videos**
6. Support variable playback **speed**, setup **audio track**, **subtitle track**, etc
Expand All @@ -57,9 +57,10 @@
9. **Searching** existing **RSS subscription content**
10. **Play other videos on the phone**
11. Support **custom MPV player**
12. Support **import and export** subscriptions via **OPML**
13. Support **dark mode**
14. ......
12. Support Android **Picture in Picture**
13. Support **import and export** subscriptions via **OPML**
14. Support **dark mode**
15. ......

## 🤩 Screenshots

Expand Down
4 changes: 3 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ android {
minSdk = 24
targetSdk = 35
versionCode = 24
versionName = "2.1-beta10"
versionName = "2.1-beta11"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

Expand Down Expand Up @@ -226,6 +226,8 @@ dependencies {
implementation(libs.libtorrent4j.x86)
implementation(libs.libtorrent4j.x8664)

implementation(project(":downloader"))

// debugImplementation("com.squareup.leakcanary:leakcanary-android:2.13")
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
Expand Down
7 changes: 2 additions & 5 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission
Expand Down Expand Up @@ -45,11 +45,8 @@
tools:targetApi="31">
<service
android:name="androidx.work.impl.foreground.SystemForegroundService"
android:foregroundServiceType="specialUse"
android:foregroundServiceType="dataSync"
tools:node="merge">
<property
android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
android:value="Download files" />
</service>

<activity
Expand Down
125 changes: 12 additions & 113 deletions app/src/main/java/com/skyd/anivu/model/bean/download/DownloadInfoBean.kt
Original file line number Diff line number Diff line change
@@ -1,118 +1,17 @@
package com.skyd.anivu.model.bean.download

import android.os.Parcelable
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.Ignore
import androidx.room.Index
import com.skyd.anivu.base.BaseBean
import kotlinx.parcelize.IgnoredOnParcel
import kotlinx.parcelize.Parcelize
import kotlinx.serialization.Serializable
import com.skyd.downloader.Status

const val DOWNLOAD_INFO_TABLE_NAME = "DownloadInfo"

@Parcelize
@Serializable
@Entity(
tableName = DOWNLOAD_INFO_TABLE_NAME,
primaryKeys = [
DownloadInfoBean.LINK_COLUMN
],
indices = [
Index(DownloadInfoBean.LINK_COLUMN, unique = true),
]
)
data class DownloadInfoBean(
@ColumnInfo(name = LINK_COLUMN)
val link: String,
@ColumnInfo(name = NAME_COLUMN)
val name: String,
@ColumnInfo(name = DOWNLOAD_DATE_COLUMN)
var downloadDate: Long,
@ColumnInfo(name = SIZE_COLUMN)
val size: Long,
@ColumnInfo(name = PROGRESS_COLUMN)
val progress: Float,
@ColumnInfo(name = DESCRIPTION_COLUMN)
val description: String? = null,
@ColumnInfo(name = DOWNLOAD_STATE_COLUMN)
val downloadState: DownloadState = DownloadState.Init,
@ColumnInfo(name = DOWNLOAD_REQUEST_ID_COLUMN)
val downloadRequestId: String,
) : BaseBean, Parcelable {
@IgnoredOnParcel
@Ignore
var peerInfoList: List<PeerInfoBean> = emptyList()

@IgnoredOnParcel
@Ignore
var uploadPayloadRate: Int = 0

@IgnoredOnParcel
@Ignore
var downloadPayloadRate: Int = 0

enum class DownloadState {
Init, Downloading, Paused, Completed, ErrorPaused, StorageMovedFailed, Seeding, SeedingPaused;

fun downloadComplete(): Boolean {
return this == Completed || this == Seeding || this == SeedingPaused
}
}

companion object {
const val LINK_COLUMN = "link"
const val NAME_COLUMN = "name"
const val DOWNLOAD_DATE_COLUMN = "downloadDate"
const val SIZE_COLUMN = "size"
const val PROGRESS_COLUMN = "progress"
const val DESCRIPTION_COLUMN = "description"
const val DOWNLOAD_STATE_COLUMN = "downloadState"
const val DOWNLOAD_REQUEST_ID_COLUMN = "downloadRequestId"

const val PAYLOAD_PROGRESS = "progress"
const val PAYLOAD_DESCRIPTION = "description"
const val PAYLOAD_PEER_INFO = "peerInfo"
const val PAYLOAD_UPLOAD_PAYLOAD_RATE = "uploadPayloadRate"
const val PAYLOAD_DOWNLOAD_PAYLOAD_RATE = "downloadPayloadRate"
const val PAYLOAD_DOWNLOAD_STATE = "downloadState"
const val PAYLOAD_NAME = "name"
const val PAYLOAD_DOWNLOADING_DIR_NAME = "downloadingDirName"
const val PAYLOAD_SIZE = "size"
}

override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false

other as DownloadInfoBean

if (link != other.link) return false
if (name != other.name) return false
if (downloadDate != other.downloadDate) return false
if (size != other.size) return false
if (progress != other.progress) return false
if (description != other.description) return false
if (downloadState != other.downloadState) return false
if (downloadRequestId != other.downloadRequestId) return false
if (uploadPayloadRate != other.uploadPayloadRate) return false
if (downloadPayloadRate != other.downloadPayloadRate) return false
return peerInfoList == other.peerInfoList
}

override fun hashCode(): Int {
var result = link.hashCode()
result = 31 * result + name.hashCode()
result = 31 * result + downloadDate.hashCode()
result = 31 * result + size.hashCode()
result = 31 * result + progress.hashCode()
result = 31 * result + (description?.hashCode() ?: 0)
result = 31 * result + downloadState.hashCode()
result = 31 * result + downloadRequestId.hashCode()
result = 31 * result + peerInfoList.hashCode()
result = 31 * result + uploadPayloadRate.hashCode()
result = 31 * result + downloadPayloadRate.hashCode()
return result
}
}
val id: Int,
val url: String,
val path: String,
val fileName: String,
val status: Status,
val totalBytes: Long,
val downloadedBytes: Long,
val speedInBytePerMs: Float,
val createTime: Long,
val failureReason: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
package com.skyd.anivu.model.bean.download.bt

import android.os.Parcelable
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.Ignore
import androidx.room.Index
import com.skyd.anivu.base.BaseBean
import kotlinx.parcelize.IgnoredOnParcel
import kotlinx.parcelize.Parcelize
import kotlinx.serialization.Serializable

const val DOWNLOAD_INFO_TABLE_NAME = "DownloadInfo"

@Parcelize
@Serializable
@Entity(
tableName = DOWNLOAD_INFO_TABLE_NAME,
primaryKeys = [
BtDownloadInfoBean.LINK_COLUMN
],
indices = [
Index(BtDownloadInfoBean.LINK_COLUMN, unique = true),
]
)
data class BtDownloadInfoBean(
@ColumnInfo(name = LINK_COLUMN)
val link: String,
@ColumnInfo(name = NAME_COLUMN)
val name: String,
@ColumnInfo(name = DOWNLOAD_DATE_COLUMN)
var downloadDate: Long,
@ColumnInfo(name = SIZE_COLUMN)
val size: Long,
@ColumnInfo(name = PROGRESS_COLUMN)
val progress: Float,
@ColumnInfo(name = DESCRIPTION_COLUMN)
val description: String? = null,
@ColumnInfo(name = DOWNLOAD_STATE_COLUMN)
val downloadState: DownloadState = DownloadState.Init,
@ColumnInfo(name = DOWNLOAD_REQUEST_ID_COLUMN)
val downloadRequestId: String,
) : BaseBean, Parcelable {
@IgnoredOnParcel
@Ignore
var peerInfoList: List<PeerInfoBean> = emptyList()

@IgnoredOnParcel
@Ignore
var uploadPayloadRate: Int = 0

@IgnoredOnParcel
@Ignore
var downloadPayloadRate: Int = 0

enum class DownloadState {
Init, Downloading, Paused, Completed, ErrorPaused, StorageMovedFailed, Seeding, SeedingPaused;

fun downloadComplete(): Boolean {
return this == Completed || this == Seeding || this == SeedingPaused
}
}

companion object {
const val LINK_COLUMN = "link"
const val NAME_COLUMN = "name"
const val DOWNLOAD_DATE_COLUMN = "downloadDate"
const val SIZE_COLUMN = "size"
const val PROGRESS_COLUMN = "progress"
const val DESCRIPTION_COLUMN = "description"
const val DOWNLOAD_STATE_COLUMN = "downloadState"
const val DOWNLOAD_REQUEST_ID_COLUMN = "downloadRequestId"
}

override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false

other as BtDownloadInfoBean

if (link != other.link) return false
if (name != other.name) return false
if (downloadDate != other.downloadDate) return false
if (size != other.size) return false
if (progress != other.progress) return false
if (description != other.description) return false
if (downloadState != other.downloadState) return false
if (downloadRequestId != other.downloadRequestId) return false
if (uploadPayloadRate != other.uploadPayloadRate) return false
if (downloadPayloadRate != other.downloadPayloadRate) return false
return peerInfoList == other.peerInfoList
}

override fun hashCode(): Int {
var result = link.hashCode()
result = 31 * result + name.hashCode()
result = 31 * result + downloadDate.hashCode()
result = 31 * result + size.hashCode()
result = 31 * result + progress.hashCode()
result = 31 * result + (description?.hashCode() ?: 0)
result = 31 * result + downloadState.hashCode()
result = 31 * result + downloadRequestId.hashCode()
result = 31 * result + peerInfoList.hashCode()
result = 31 * result + uploadPayloadRate.hashCode()
result = 31 * result + downloadPayloadRate.hashCode()
return result
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.skyd.anivu.model.bean.download
package com.skyd.anivu.model.bean.download.bt

import android.os.Parcelable
import androidx.room.ColumnInfo
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.skyd.anivu.model.bean.download
package com.skyd.anivu.model.bean.download.bt

import android.os.Parcelable
import com.skyd.anivu.base.BaseBean
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.skyd.anivu.model.bean.download
package com.skyd.anivu.model.bean.download.bt

import android.os.Parcelable
import androidx.room.ColumnInfo
Expand All @@ -16,12 +16,12 @@ const val SESSION_PARAMS_TABLE_NAME = "SessionParams"
@Entity(
tableName = SESSION_PARAMS_TABLE_NAME,
primaryKeys = [
DownloadInfoBean.LINK_COLUMN
BtDownloadInfoBean.LINK_COLUMN
],
foreignKeys = [
ForeignKey(
entity = DownloadInfoBean::class,
parentColumns = [DownloadInfoBean.LINK_COLUMN],
entity = BtDownloadInfoBean::class,
parentColumns = [BtDownloadInfoBean.LINK_COLUMN],
childColumns = [SessionParamsBean.LINK_COLUMN],
onDelete = ForeignKey.CASCADE
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.skyd.anivu.model.bean.download
package com.skyd.anivu.model.bean.download.bt

import android.os.Parcelable
import androidx.room.ColumnInfo
Expand All @@ -20,8 +20,8 @@ const val TORRENT_FILE_TABLE_NAME = "TorrentFile"
],
foreignKeys = [
ForeignKey(
entity = DownloadInfoBean::class,
parentColumns = [DownloadInfoBean.LINK_COLUMN],
entity = BtDownloadInfoBean::class,
parentColumns = [BtDownloadInfoBean.LINK_COLUMN],
childColumns = [TorrentFileBean.LINK_COLUMN],
onDelete = ForeignKey.CASCADE
)
Expand Down
10 changes: 5 additions & 5 deletions app/src/main/java/com/skyd/anivu/model/db/AppDatabase.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import com.skyd.anivu.model.bean.MediaPlayHistoryBean
import com.skyd.anivu.model.bean.article.ArticleBean
import com.skyd.anivu.model.bean.article.EnclosureBean
import com.skyd.anivu.model.bean.article.RssMediaBean
import com.skyd.anivu.model.bean.download.DownloadInfoBean
import com.skyd.anivu.model.bean.download.DownloadLinkUuidMapBean
import com.skyd.anivu.model.bean.download.SessionParamsBean
import com.skyd.anivu.model.bean.download.TorrentFileBean
import com.skyd.anivu.model.bean.download.bt.BtDownloadInfoBean
import com.skyd.anivu.model.bean.download.bt.DownloadLinkUuidMapBean
import com.skyd.anivu.model.bean.download.bt.SessionParamsBean
import com.skyd.anivu.model.bean.download.bt.TorrentFileBean
import com.skyd.anivu.model.bean.feed.FeedBean
import com.skyd.anivu.model.bean.feed.FeedViewBean
import com.skyd.anivu.model.bean.group.GroupBean
Expand Down Expand Up @@ -50,7 +50,7 @@ const val APP_DATA_BASE_FILE_NAME = "app.db"
FeedBean::class,
ArticleBean::class,
EnclosureBean::class,
DownloadInfoBean::class,
BtDownloadInfoBean::class,
DownloadLinkUuidMapBean::class,
SessionParamsBean::class,
TorrentFileBean::class,
Expand Down
Loading

0 comments on commit c0642f1

Please sign in to comment.