6.0.11 commit
This commit is contained in:
parent
43054ec52e
commit
abb0736579
|
@ -126,8 +126,8 @@ android {
|
||||||
buildConfig true
|
buildConfig true
|
||||||
}
|
}
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
versionCode 3020210
|
versionCode 3020211
|
||||||
versionName "6.0.10"
|
versionName "6.0.11"
|
||||||
|
|
||||||
applicationId "ac.mdiq.podcini.R"
|
applicationId "ac.mdiq.podcini.R"
|
||||||
def commit = ""
|
def commit = ""
|
||||||
|
|
|
@ -130,7 +130,7 @@ class DownloadServiceInterfaceImpl : DownloadServiceInterface() {
|
||||||
override fun doWork(): Result {
|
override fun doWork(): Result {
|
||||||
Logd(TAG, "starting doWork")
|
Logd(TAG, "starting doWork")
|
||||||
ClientConfigurator.initialize(applicationContext)
|
ClientConfigurator.initialize(applicationContext)
|
||||||
val mediaId = inputData.getLong(DownloadServiceInterface.WORK_DATA_MEDIA_ID, 0)
|
val mediaId = inputData.getLong(WORK_DATA_MEDIA_ID, 0)
|
||||||
val media = Episodes.getEpisodeMedia(mediaId)
|
val media = Episodes.getEpisodeMedia(mediaId)
|
||||||
if (media == null) {
|
if (media == null) {
|
||||||
Log.e(TAG, "media is null for mediaId: $mediaId")
|
Log.e(TAG, "media is null for mediaId: $mediaId")
|
||||||
|
@ -146,7 +146,7 @@ class DownloadServiceInterfaceImpl : DownloadServiceInterface() {
|
||||||
if (isInterrupted) return
|
if (isInterrupted) return
|
||||||
notificationProgress.put(media.getEpisodeTitle(), request.progressPercent)
|
notificationProgress.put(media.getEpisodeTitle(), request.progressPercent)
|
||||||
}
|
}
|
||||||
setProgressAsync(Data.Builder().putInt(DownloadServiceInterface.WORK_DATA_PROGRESS, request.progressPercent).build()).get()
|
setProgressAsync(Data.Builder().putInt(WORK_DATA_PROGRESS, request.progressPercent).build()).get()
|
||||||
val nm = applicationContext.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
val nm = applicationContext.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||||
nm.notify(R.id.notification_downloading, generateProgressNotification())
|
nm.notify(R.id.notification_downloading, generateProgressNotification())
|
||||||
sleep(1000)
|
sleep(1000)
|
||||||
|
|
|
@ -17,6 +17,7 @@ import ac.mdiq.podcini.storage.database.RealmDB.upsertBlk
|
||||||
import ac.mdiq.podcini.storage.model.Episode
|
import ac.mdiq.podcini.storage.model.Episode
|
||||||
import ac.mdiq.podcini.storage.model.Feed
|
import ac.mdiq.podcini.storage.model.Feed
|
||||||
import ac.mdiq.podcini.preferences.OpmlTransporter.*
|
import ac.mdiq.podcini.preferences.OpmlTransporter.*
|
||||||
|
import ac.mdiq.podcini.storage.database.Episodes.getEpisodeByTitle
|
||||||
import ac.mdiq.podcini.storage.model.EpisodeFilter
|
import ac.mdiq.podcini.storage.model.EpisodeFilter
|
||||||
import ac.mdiq.podcini.storage.utils.EpisodeUtil.hasAlmostEnded
|
import ac.mdiq.podcini.storage.utils.EpisodeUtil.hasAlmostEnded
|
||||||
import ac.mdiq.podcini.storage.model.EpisodeSortOrder
|
import ac.mdiq.podcini.storage.model.EpisodeSortOrder
|
||||||
|
@ -167,7 +168,7 @@ class ImportExportPreferencesFragment : PreferenceFragmentCompat() {
|
||||||
exportPreferences()
|
exportPreferences()
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
findPreference<Preference>(PREF_MEDIAFILES_IMPORT)!!.onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
findPreference<Preference>(PREF_MEDIAFILES_IMPORT)?.onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
||||||
importMediaFiles()
|
importMediaFiles()
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
@ -750,15 +751,26 @@ class ImportExportPreferencesFragment : PreferenceFragmentCompat() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private fun copyRecursive(context: Context, srcFile: DocumentFile, srcRootDir: DocumentFile, destRootDir: File) {
|
private fun copyRecursive(context: Context, srcFile: DocumentFile, srcRootDir: DocumentFile, destRootDir: File) {
|
||||||
val relativePath = srcFile.uri.path?.substring(srcRootDir.uri.path!!.length) ?: return
|
val relativePath = srcFile.uri.path?.substring(srcRootDir.uri.path!!.length+1) ?: return
|
||||||
val destFile = File(destRootDir, relativePath)
|
|
||||||
if (srcFile.isDirectory) {
|
if (srcFile.isDirectory) {
|
||||||
|
val destFile = File(destRootDir, relativePath)
|
||||||
if (!destFile.exists()) destFile.mkdirs()
|
if (!destFile.exists()) destFile.mkdirs()
|
||||||
srcFile.listFiles().forEach { file ->
|
srcFile.listFiles().forEach { file ->
|
||||||
copyRecursive(context, file, srcFile, destFile)
|
copyRecursive(context, file, srcFile, destFile)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!destFile.exists()) copyFile(srcFile, destFile, context)
|
val nameParts = relativePath.split(".")
|
||||||
|
if (nameParts.size < 3) return
|
||||||
|
val ext = nameParts[nameParts.size-1]
|
||||||
|
val title = nameParts.dropLast(2).joinToString(".")
|
||||||
|
Logd(TAG, "copyRecursive title: $title")
|
||||||
|
val episode = getEpisodeByTitle(title) ?: return
|
||||||
|
val destName = "$title.${episode.id}.$ext"
|
||||||
|
val destFile = File(destRootDir, destName)
|
||||||
|
if (!destFile.exists()) {
|
||||||
|
copyFile(srcFile, destFile, context)
|
||||||
|
upsertBlk(episode) { it.media?.setfileUrlOrNull(destFile.name)}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private fun copyFile(sourceFile: DocumentFile, destFile: File, context: Context) {
|
private fun copyFile(sourceFile: DocumentFile, destFile: File, context: Context) {
|
||||||
|
|
|
@ -84,6 +84,12 @@ object Episodes {
|
||||||
return if (episode != null) realm.copyFromRealm(episode) else null
|
return if (episode != null) realm.copyFromRealm(episode) else null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getEpisodeByTitle(title: String): Episode? {
|
||||||
|
Logd(TAG, "getEpisodeByTitle called $title ")
|
||||||
|
val episode = realm.query(Episode::class).query("title == $0", title).first().find()
|
||||||
|
return if (episode != null) realm.copyFromRealm(episode) else null
|
||||||
|
}
|
||||||
|
|
||||||
fun getEpisodeMedia(mediaId: Long): EpisodeMedia? {
|
fun getEpisodeMedia(mediaId: Long): EpisodeMedia? {
|
||||||
Logd(TAG, "getEpisodeMedia called $mediaId")
|
Logd(TAG, "getEpisodeMedia called $mediaId")
|
||||||
val media = realm.query(EpisodeMedia::class).query("id == $0", mediaId).first().find()
|
val media = realm.query(EpisodeMedia::class).query("id == $0", mediaId).first().find()
|
||||||
|
|
|
@ -369,7 +369,7 @@ class PlayerDetailsFragment : Fragment() {
|
||||||
|
|
||||||
@UnstableApi private fun savePreference() {
|
@UnstableApi private fun savePreference() {
|
||||||
Logd(TAG, "Saving preferences")
|
Logd(TAG, "Saving preferences")
|
||||||
val editor = prefs!!.edit()
|
val editor = prefs?.edit() ?: return
|
||||||
if (curMedia != null) {
|
if (curMedia != null) {
|
||||||
Logd(TAG, "Saving scroll position: " + binding.itemDescriptionFragment.scrollY)
|
Logd(TAG, "Saving scroll position: " + binding.itemDescriptionFragment.scrollY)
|
||||||
editor.putInt(PREF_SCROLL_Y, binding.itemDescriptionFragment.scrollY)
|
editor.putInt(PREF_SCROLL_Y, binding.itemDescriptionFragment.scrollY)
|
||||||
|
|
|
@ -22,11 +22,11 @@
|
||||||
search:keywords="@string/import_export_search_keywords"
|
search:keywords="@string/import_export_search_keywords"
|
||||||
android:title="@string/media_files_export_label"
|
android:title="@string/media_files_export_label"
|
||||||
android:summary="@string/media_files_export_summary"/>
|
android:summary="@string/media_files_export_summary"/>
|
||||||
<Preference
|
<!-- <Preference-->
|
||||||
android:key="prefMediaFilesImport"
|
<!-- android:key="prefMediaFilesImport"-->
|
||||||
search:keywords="@string/import_export_search_keywords"
|
<!-- search:keywords="@string/import_export_search_keywords"-->
|
||||||
android:title="@string/media_files_import_label"
|
<!-- android:title="@string/media_files_import_label"-->
|
||||||
android:summary="@string/media_files_import_summary"/>
|
<!-- android:summary="@string/media_files_import_summary"/>-->
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory android:title="@string/preferences">
|
<PreferenceCategory android:title="@string/preferences">
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
# 6.0.11
|
||||||
|
|
||||||
|
* This is a minor release of subtraction: import of downloaded media files is temporarily disabled as it's more complicated than I thought. Although it works on files exported from Podcini.R, file names from earlier versions aren't easily recognizable.
|
||||||
|
|
||||||
# 6.0.10
|
# 6.0.10
|
||||||
|
|
||||||
* for better migrating from version 5, added export/import of downloaded media files: inter-operable with Podcini 5.5.4
|
* for better migrating from version 5, added export/import of downloaded media files: inter-operable with Podcini 5.5.4
|
||||||
|
|
|
@ -13,7 +13,7 @@ the following can be imported to it from Settings -> Import/Export:
|
||||||
* preferences files
|
* preferences files
|
||||||
* OPML file
|
* OPML file
|
||||||
* json file of episodes progress
|
* json file of episodes progress
|
||||||
* downloaded media files (5.5.4 only)
|
* downloaded media files (5.5.4 only, but currently not enabled for import)
|
||||||
|
|
||||||
An OPML file should be imported before importing episodes progress, but you can always re-do any of the above
|
An OPML file should be imported before importing episodes progress, but you can always re-do any of the above
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue