Skip to content

Commit

Permalink
4.10.0 commit
Browse files Browse the repository at this point in the history
  • Loading branch information
XilinJia committed May 5, 2024
1 parent e901142 commit b719267
Show file tree
Hide file tree
Showing 59 changed files with 1,358 additions and 780 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Some drastic changes are made in the project since version 4.0:
- Viewbindings are enabled for most views,
- Project became mono-modular.

Even so, the database remains backward compatible, and AntennaPod's db can be easily imported.
~Even so, the database remains backward compatible, and AntennaPod's db can be easily imported.~ Since version 4.10.0 and/or AntennaPod 3.3.2, AntennaPod's DB can not be directly imported

## Notable new features & enhancements

Expand Down Expand Up @@ -76,15 +76,16 @@ Even so, the database remains backward compatible, and AntennaPod's db can be ea
* Left and right swipe actions on lists now have telltales and can be configured on the spot
* Played episodes have clearer markings
* Sort dialog no longer dims the main view
* in episode list view, if episode has no media, TTS button is shown for fetching transcript (if not exist) and then generating audio file from the transcript. TTS audio files are playable in the same way as local media (with speed setting, pause and rewind/forward)
* Subscriptions view has sorting by "Unread publication date"

### Podcast/Episode

* New share notes menu option on various episode views
* Feed info view offers a link for direct search of feeds related to author
* New episode home view with two display modes: webpage or reader
* Text-to-Speech is enabled in reader's mode
* RSS feeds with no playable media can be subscribed and read/listened
* In episode, in addition to "description" there is a new "transcript" field to save text (if any) fetched from the episode's website
* RSS feeds with no playable media can be subscribed and read/listened (via TTS)

### Online feed

Expand Down
16 changes: 8 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ android {
// Version code schema (not used):
// "1.2.3-beta4" -> 1020304
// "1.2.3" -> 1020395
versionCode 3020137
versionName "4.9.6"
versionCode 3020138
versionName "4.10.0"

def commit = ""
try {
Expand Down Expand Up @@ -248,12 +248,12 @@ dependencies {
implementation "androidx.work:work-runtime:2.9.0"
implementation "androidx.core:core-splashscreen:1.0.1"
implementation 'androidx.documentfile:documentfile:1.0.1'
implementation 'androidx.webkit:webkit:1.9.0'
implementation 'androidx.webkit:webkit:1.10.0'

implementation "com.google.android.material:material:1.11.0"

implementation "org.apache.commons:commons-lang3:3.14.0"
implementation "commons-io:commons-io:2.15.1"
implementation 'commons-io:commons-io:2.16.1'
implementation "org.jsoup:jsoup:1.17.2"

implementation "com.github.bumptech.glide:glide:4.16.0"
Expand All @@ -263,7 +263,7 @@ dependencies {
implementation "com.squareup.okhttp3:okhttp:4.12.0"
implementation "com.squareup.okhttp3:okhttp-urlconnection:4.12.0"

implementation "com.squareup.okio:okio:3.7.0"
implementation 'com.squareup.okio:okio:3.9.0'

implementation "org.greenrobot:eventbus:3.3.1"
kapt "org.greenrobot:eventbus-annotation-processor:3.3.1"
Expand Down Expand Up @@ -294,17 +294,17 @@ dependencies {
androidTestImplementation "androidx.test:runner:1.5.2"
androidTestImplementation "androidx.test:rules:1.5.0"
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation "org.awaitility:awaitility:4.2.0"
androidTestImplementation 'org.awaitility:awaitility:4.2.1'

implementation 'com.github.mfietz:fyydlin:v0.5.0'

// Non-free dependencies:

testImplementation "androidx.test:core:1.5.0"
testImplementation "org.awaitility:awaitility:4.2.0"
testImplementation 'org.awaitility:awaitility:4.2.1'
testImplementation "junit:junit:4.13.2"
testImplementation 'org.mockito:mockito-inline:5.2.0'
testImplementation "org.robolectric:robolectric:4.11.1"
testImplementation 'org.robolectric:robolectric:4.12'
testImplementation 'javax.inject:javax.inject:1'

playImplementation 'com.google.android.gms:play-services-base:18.3.0'
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@

<intent-filter>
<action android:name="androidx.media3.session.MediaSessionService"/>
<!-- <action android:name="android.media.browse.MediaBrowserService"/>-->
<action android:name="android.media.browse.MediaBrowserService"/>
<action android:name="ac.mdiq.podcini.intents.PLAYBACK_SERVICE" />
</intent-filter>
</service>
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/ac/mdiq/podcini/feed/LocalFeedUpdater.kt
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ object LocalFeedUpdater {
val status = DownloadResult(feed, feed.title?:"",
DownloadError.ERROR_IO_ERROR, false, reasonDetailed?:"")
DBWriter.addDownloadStatus(status)
DBWriter.setFeedLastUpdateFailed(feed.id, true)
DBWriter.persistFeedLastUpdateFailed(feed.id, true)
}

/**
Expand All @@ -230,7 +230,7 @@ object LocalFeedUpdater {
@UnstableApi private fun reportSuccess(feed: Feed) {
val status = DownloadResult(feed, feed.title?:"", DownloadError.SUCCESS, true, "")
DBWriter.addDownloadStatus(status)
DBWriter.setFeedLastUpdateFailed(feed.id, false)
DBWriter.persistFeedLastUpdateFailed(feed.id, false)
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ object MediaSizeLoader {
else media.size = size

emitter.onSuccess(size)
DBWriter.setFeedMedia(media)
DBWriter.persistFeedMedia(media)
})
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import ac.mdiq.podcini.storage.model.feed.Feed
import ac.mdiq.podcini.storage.model.feed.FeedMedia
import ac.mdiq.podcini.net.download.serviceinterface.DownloadRequest
import ac.mdiq.podcini.preferences.UserPreferences
import ac.mdiq.podcini.storage.model.feed.FeedItem
import org.apache.commons.io.FilenameUtils
import java.io.File

Expand Down Expand Up @@ -100,4 +101,30 @@ object DownloadRequestCreator {

return (baseFilename + FilenameUtils.EXTENSION_SEPARATOR + media.id + FilenameUtils.EXTENSION_SEPARATOR + FilenameUtils.getExtension(urlBaseFilename))
}

fun getMediafilePath(item: FeedItem): String {
val title = item.feed?.title?:return ""
val mediaPath = (MEDIA_DOWNLOADPATH + FileNameGenerator.generateFileName(title))
return UserPreferences.getDataFolder(mediaPath).toString() + "/"
}

fun getMediafilename(item: FeedItem): String {
var titleBaseFilename = ""

// Try to generate the filename by the item title
if (item.title != null) {
val title = item.title!!
titleBaseFilename = FileNameGenerator.generateFileName(title)
}

// val urlBaseFilename = URLUtil.guessFileName(media.download_url, null, media.mime_type)

var baseFilename: String
baseFilename = if (titleBaseFilename != "") titleBaseFilename else "NoTitle"
val filenameMaxLength = 220
if (baseFilename.length > filenameMaxLength) baseFilename = baseFilename.substring(0, filenameMaxLength)

return (baseFilename + FilenameUtils.EXTENSION_SEPARATOR + "noid" + FilenameUtils.EXTENSION_SEPARATOR + "wav")
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import android.app.Notification
import android.app.NotificationManager
import android.app.PendingIntent
import android.content.Context
import android.os.Build
import android.util.Log
import androidx.annotation.OptIn
import androidx.core.app.NotificationCompat
Expand Down Expand Up @@ -53,11 +52,7 @@ class EpisodeDownloadWorker(context: Context, params: WorkerParameters) : Worker
if (isInterrupted) return
notificationProgress.put(media.getEpisodeTitle(), request.progressPercent)
}
setProgressAsync(
Data.Builder()
.putInt(DownloadServiceInterface.WORK_DATA_PROGRESS, request.progressPercent)
.build())
.get()
setProgressAsync(Data.Builder().putInt(DownloadServiceInterface.WORK_DATA_PROGRESS, request.progressPercent).build()).get()
val nm = applicationContext.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
nm.notify(R.id.notification_downloading, generateProgressNotification())
sleep(1000)
Expand Down Expand Up @@ -119,7 +114,7 @@ class EpisodeDownloadWorker(context: Context, params: WorkerParameters) : Worker
if (dest.exists()) {
media.file_url = request.destination
try {
DBWriter.setFeedMedia(media).get()
DBWriter.persistFeedMedia(media).get()
} catch (e: Exception) {
Log.e(TAG, "ExecutionException in writeFileUrl: " + e.message)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class FeedUpdateWorker(context: Context, params: WorkerParameters) : Worker(cont
if (feed.isLocalFeed) LocalFeedUpdater.updateFeed(feed, applicationContext, null)
else refreshFeed(feed, force)
} catch (e: Exception) {
DBWriter.setFeedLastUpdateFailed(feed.id, true)
DBWriter.persistFeedLastUpdateFailed(feed.id, true)
val status = DownloadResult(feed, feed.title?:"", DownloadError.ERROR_IO_ERROR, false, e.message?:"")
DBWriter.addDownloadStatus(status)
}
Expand All @@ -147,7 +147,7 @@ class FeedUpdateWorker(context: Context, params: WorkerParameters) : Worker(cont
if (!downloader.result.isSuccessful) {
if (downloader.cancelled || downloader.result.reason == DownloadError.ERROR_DOWNLOAD_CANCELLED) return

DBWriter.setFeedLastUpdateFailed(request.feedfileId, true)
DBWriter.persistFeedLastUpdateFailed(request.feedfileId, true)
DBWriter.addDownloadStatus(downloader.result)
return
}
Expand All @@ -156,7 +156,7 @@ class FeedUpdateWorker(context: Context, params: WorkerParameters) : Worker(cont
val success = feedSyncTask.run()

if (!success) {
DBWriter.setFeedLastUpdateFailed(request.feedfileId, true)
DBWriter.persistFeedLastUpdateFailed(request.feedfileId, true)
DBWriter.addDownloadStatus(feedSyncTask.downloadStatus)
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class FeedParserTask(private val request: DownloadRequest) : Callable<FeedHandle
result = feedHandler.parseFeed(feed)
Log.d(TAG, feed.title + " parsed")
checkFeedData(feed)
// TODO: what the shit is this??
if (feed.imageUrl.isNullOrEmpty()) feed.imageUrl = Feed.PREFIX_GENERATIVE_COVER + feed.download_url
} catch (e: SAXException) {
isSuccessful = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ class MediaDownloadedHandler(private val context: Context, var updatedStatus: Do
val item = media.item

try {
DBWriter.setFeedMedia(media).get()
DBWriter.persistFeedMedia(media).get()

// we've received the media, we don't want to autodownload it again
if (item != null) {
item.disableAutoDownload()
// setFeedItem() signals (via EventBus) that the item has been updated,
// so we do it after the enclosing media has been updated above,
// to ensure subscribers will get the updated FeedMedia as well
DBWriter.setFeedItem(item).get()
DBWriter.persistFeedItem(item).get()
if (broadcastUnreadStateUpdate) EventBus.getDefault().post(UnreadItemsUpdateEvent())
}
} catch (e: InterruptedException) {
Expand Down
5 changes: 2 additions & 3 deletions app/src/main/java/ac/mdiq/podcini/net/sync/SyncService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import ac.mdiq.podcini.storage.DBReader.loadAdditionalFeedItemListData
import ac.mdiq.podcini.storage.DBTasks.removeFeedWithDownloadUrl
import ac.mdiq.podcini.storage.DBTasks.updateFeed
import ac.mdiq.podcini.storage.DBWriter.removeQueueItem
import ac.mdiq.podcini.storage.DBWriter.setItemList
import ac.mdiq.podcini.storage.DBWriter.persistItemList
import ac.mdiq.podcini.storage.model.feed.*
import ac.mdiq.podcini.ui.utils.NotificationUtils
import ac.mdiq.podcini.util.FeedItemUtil.hasAlmostEnded
Expand All @@ -38,7 +38,6 @@ import ac.mdiq.podcini.util.event.SyncServiceEvent
import android.app.NotificationManager
import android.app.PendingIntent
import android.content.Context
import android.os.Build
import android.util.Log
import androidx.core.app.NotificationCompat
import androidx.media3.common.util.UnstableApi
Expand Down Expand Up @@ -225,7 +224,7 @@ class SyncService(context: Context, params: WorkerParameters) : Worker(context,
}
removeQueueItem(applicationContext, false, *queueToBeRemoved.toArray())
loadAdditionalFeedItemListData(updatedItems)
setItemList(updatedItems)
persistItemList(updatedItems)
}

private fun clearErrorNotifications() {
Expand Down
Loading

0 comments on commit b719267

Please sign in to comment.