Skip to content

Commit

Permalink
6.15.5 commit
Browse files Browse the repository at this point in the history
  • Loading branch information
XilinJia committed Dec 9, 2024
1 parent cce7399 commit f547df6
Show file tree
Hide file tree
Showing 37 changed files with 555 additions and 1,495 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ android {
vectorDrawables.useSupportLibrary false
vectorDrawables.generatedDensities = []

versionCode 3020313
versionName "6.15.4"
versionCode 3020314
versionName "6.15.5"

applicationId "ac.mdiq.podcini.R"
def commit = ""
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,6 @@
android:value="ac.mdiq.podcini.ui.activity.PreferenceActivity"/>
</activity>

<!-- android:screenOrientation="sensorLandscape"-->

<activity
android:name=".ui.activity.VideoplayerActivity"
android:configChanges="keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,8 @@ class DownloadServiceInterfaceImpl : DownloadServiceInterface() {
private fun generateProgressNotification(): Notification {
val bigTextB = StringBuilder()
var progressCopy: Map<String, Int>
synchronized(notificationProgress) {
progressCopy = HashMap(notificationProgress)
}
for ((key, value) in progressCopy) {
bigTextB.append(String.format(Locale.getDefault(), "%s (%d%%)\n", key, value))
}
synchronized(notificationProgress) { progressCopy = HashMap(notificationProgress) }
for ((key, value) in progressCopy) bigTextB.append(String.format(Locale.getDefault(), "%s (%d%%)\n", key, value))
val bigText = bigTextB.toString().trim { it <= ' ' }
val contentText = if (progressCopy.size == 1) bigText
else applicationContext.resources.getQuantityString(R.plurals.downloads_left, progressCopy.size, progressCopy.size)
Expand Down Expand Up @@ -350,23 +346,19 @@ class DownloadServiceInterfaceImpl : DownloadServiceInterface() {
return constraints.build()
}


private fun getRequest(item: Episode): OneTimeWorkRequest.Builder {
Logd(TAG, "starting getRequest")
val workRequest: OneTimeWorkRequest.Builder = OneTimeWorkRequest.Builder(EpisodeDownloadWorker::class.java)
.setInitialDelay(0L, TimeUnit.MILLISECONDS)
.addTag(WORK_TAG)
.addTag(WORK_TAG_EPISODE_URL + item.media!!.downloadUrl)
if (enqueueDownloadedEpisodes()) {
if (appPrefs.getBoolean(UserPreferences.Prefs.prefEnqueueDownloaded.name, true)) {
if (item.feed?.preferences?.queue != null)
runBlocking { Queues.addToQueueSync(item, item.feed?.preferences?.queue) }
workRequest.addTag(WORK_DATA_WAS_QUEUED)
}
workRequest.setInputData(Data.Builder().putLong(WORK_DATA_MEDIA_ID, item.media!!.id).build())
return workRequest
}
private fun enqueueDownloadedEpisodes(): Boolean {
return appPrefs.getBoolean(UserPreferences.Prefs.prefEnqueueDownloaded.name, true)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ import java.util.*
import java.util.concurrent.Callable
import kotlin.concurrent.Volatile

/**
* Downloads files
*/
abstract class Downloader(val downloadRequest: DownloadRequest) : Callable<Downloader> {
@Volatile
var isFinished: Boolean = false
Expand Down
106 changes: 102 additions & 4 deletions app/src/main/kotlin/ac/mdiq/podcini/net/feed/FeedBuilder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import java.io.File
import java.io.IOException
import java.net.HttpURLConnection
import java.net.URL
import kotlin.Throws

class FeedBuilder(val context: Context, val showError: (String?, String)->Unit) {
private val TAG = "DirectSubscribe"
Expand Down Expand Up @@ -259,10 +260,7 @@ class FeedBuilder(val context: Context, val showError: (String?, String)->Unit)
}
}
selectedDownloadUrl = prepareUrl(url)
val request = create(Feed(selectedDownloadUrl, null))
.withAuthentication(username, password)
.withInitiatedByUser(true)
.build()
val request = create(Feed(selectedDownloadUrl, null)).withAuthentication(username, password).withInitiatedByUser(true).build()
CoroutineScope(Dispatchers.IO).launch {
try {
downloader = HttpDownloader(request)
Expand Down Expand Up @@ -367,4 +365,104 @@ class FeedBuilder(val context: Context, val showError: (String?, String)->Unit)
// }
Logd(TAG, "fo.id: ${fo?.id} feed.id: ${feed.id}")
}

/**
*
* @return true if a FeedDiscoveryDialog is shown, false otherwise (e.g., due to no feed found).
*/
// private fun showFeedDiscoveryDialog(feedFile: File, baseUrl: String): Boolean {
// val fd = FeedDiscoverer()
// val urlsMap: Map<String, String>
// try {
// urlsMap = fd.findLinks(feedFile, baseUrl)
// if (urlsMap.isEmpty()) return false
// } catch (e: IOException) {
// e.printStackTrace()
// return false
// }
//
// if (isRemoving || isPaused) return false
// val titles: MutableList<String?> = ArrayList()
// val urls: List<String> = ArrayList(urlsMap.keys)
// for (url in urls) {
// titles.add(urlsMap[url])
// }
// if (urls.size == 1) {
// // Skip dialog and display the item directly
// feeds = getFeedList()
// subscribe.startFeedBuilding(urls[0]) {feed, map -> showFeedInformation(feed, map) }
// return true
// }
// val adapter = ArrayAdapter(requireContext(), R.layout.ellipsize_start_listitem, R.id.txtvTitle, titles)
// val onClickListener = DialogInterface.OnClickListener { dialog: DialogInterface, which: Int ->
// val selectedUrl = urls[which]
// dialog.dismiss()
// feeds = getFeedList()
// subscribe.startFeedBuilding(selectedUrl) {feed, map -> showFeedInformation(feed, map) }
// }
// val ab = MaterialAlertDialogBuilder(requireContext())
// .setTitle(R.string.feeds_label)
// .setCancelable(true)
// .setOnCancelListener { _: DialogInterface? ->/* finish() */ }
// .setAdapter(adapter, onClickListener)
// requireActivity().runOnUiThread {
// if (dialog != null && dialog!!.isShowing) dialog!!.dismiss()
// dialog = ab.show()
// }
// return true
// }

/**
* Finds RSS/Atom URLs in a HTML document using the auto-discovery techniques described here:
* http://www.rssboard.org/rss-autodiscovery
* http://blog.whatwg.org/feed-autodiscovery
*/
// class FeedDiscoverer {
// /**
// * Discovers links to RSS and Atom feeds in the given File which must be a HTML document.
// * @return A map which contains the feed URLs as keys and titles as values (the feed URL is also used as a title if
// * a title cannot be found).
// */
// @Throws(IOException::class)
// fun findLinks(inVal: File, baseUrl: String): Map<String, String> {
// return findLinks(Jsoup.parse(inVal), baseUrl)
// }
// /**
// * Discovers links to RSS and Atom feeds in the given File which must be a HTML document.
// * @return A map which contains the feed URLs as keys and titles as values (the feed URL is also used as a title if
// * a title cannot be found).
// */
// fun findLinks(inVal: String, baseUrl: String): Map<String, String> {
// return findLinks(Jsoup.parse(inVal), baseUrl)
// }
// private fun findLinks(document: Document, baseUrl: String): Map<String, String> {
// val res: MutableMap<String, String> = ArrayMap()
// val links = document.head().getElementsByTag("link")
// for (link in links) {
// val rel = link.attr("rel")
// val href = link.attr("href")
// if (href.isNotEmpty() && (rel == "alternate" || rel == "feed")) {
// val type = link.attr("type")
// if (type == MIME_RSS || type == MIME_ATOM) {
// val title = link.attr("title")
// val processedUrl = processURL(baseUrl, href)
// if (processedUrl != null) res[processedUrl] = title.ifEmpty { href }
// }
// }
// }
// return res
// }
// private fun processURL(baseUrl: String, strUrl: String): String? {
// val uri = Uri.parse(strUrl)
// if (uri.isRelative) {
// val res = Uri.parse(baseUrl).buildUpon().path(strUrl).build()
// return res?.toString()
// } else return strUrl
// }
// companion object {
// private const val MIME_RSS = "application/rss+xml"
// private const val MIME_ATOM = "application/atom+xml"
// }
// }

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import ac.mdiq.podcini.playback.base.InTheatre.curEpisode
import ac.mdiq.podcini.playback.base.InTheatre.curIndexInQueue
import ac.mdiq.podcini.playback.base.InTheatre.curMedia
import ac.mdiq.podcini.playback.base.InTheatre.curQueue
import ac.mdiq.podcini.preferences.UserPreferences
import ac.mdiq.podcini.preferences.UserPreferences.fastForwardSecs
import ac.mdiq.podcini.preferences.UserPreferences.isSkipSilence
import ac.mdiq.podcini.preferences.UserPreferences.rewindSecs
import ac.mdiq.podcini.storage.database.Episodes
Expand Down Expand Up @@ -655,6 +657,8 @@ class LocalMediaPlayer(context: Context, callback: MediaPlayerCallback) : MediaP
// }
exoPlayer = ExoPlayer.Builder(context, defaultRenderersFactory)
.setTrackSelector(trackSelector!!)
.setSeekBackIncrementMs(rewindSecs * 1000L)
.setSeekForwardIncrementMs(fastForwardSecs * 1000L)
.setLoadControl(loadControl.build())
.build()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ object AutoDownloads {
}

class FeedBasedAutoDLAlgorithm : AutoDownloadAlgorithm() {


override fun autoDownloadEpisodeMedia(context: Context, feeds: List<Feed>?): Runnable {
return Runnable {
// true if we should auto download based on network status
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ class MainActivity : CastEnabledActivity() {
Text(stringResource(R.string.unrestricted_background_permission_text))
Row(verticalAlignment = Alignment.CenterVertically) {
Checkbox(checked = dontAskAgain, onCheckedChange = { dontAskAgain = it })
Text(stringResource(R.string.dont_ask_again))
Text(stringResource(R.string.checkbox_do_not_show_again))
}
}
},
Expand Down
Loading

0 comments on commit f547df6

Please sign in to comment.