Compare commits

...

128 Commits

Author SHA1 Message Date
0fd7cc964f
update gradle wrapper, agp, kotlin and libraries
* kotline 1.9.22 -> 2.0.20
* ktor 2.3.6 -> 3.0.0
* agp 8.3.0 -> 8.7.1
2024-10-29 22:07:06 +01:00
b07a6fd407
update gradle wrapper, agp, kotlin and libraries 2024-03-03 21:21:12 +01:00
7d661712f7
update to kotlin 1.9.0 2023-11-15 15:50:13 +01:00
8fcf047e99
update agp and libraries
* agp 8.1.2 -> 8.1.3
* ktor 2.3.4 -> 2.3.6
* androidx.core 1.10.1 -> 1.12.0
* androidx.navigation 2.6.0 -> 2.7.5
* androidx.lifecycle 2.6.1 -> 2.6.1
* com.google.android.material 1.9.0 -> 1.10.0
* gradle wrapper 8.2.1 -> 8.4
2023-11-15 15:37:44 +01:00
17dbe945e5
mograte MyListFragment to use a simple ViewModel
fixes crashes in MyListFragment if the User closes the fragment with a loading job still running, part of #56
2023-10-15 18:44:22 +02:00
5f609d4c33
update agp and libraries
* agp 8.1.0 -> 8.1.2
* ktor 2.3.2 -> 2.3.4
* kotlinx-serialization-json 1.5.1 -> 1.6.0
2023-09-29 23:47:47 +02:00
6515f657d0
partially revert c448b44fc4 2023-08-11 15:07:33 +02:00
c448b44fc4
updatelibraries and agp
* agp 8.0.2 -> 8.1.0
* kotlinx-coroutines-android 1.7.2 -> 1.7.3
* navigation-fragment-ktx 2.6.0 -> 2.7.0
* navigation-ui-ktx 2.6.0 -> 2.7.0
2023-08-11 14:58:17 +02:00
88ebc378d3
add changelog for beta3; update gradle wrapper to 8.2.1 2023-08-11 14:41:55 +02:00
1a012cba7d
add support for dedicated subtitle and audio language settings 2023-07-21 21:42:55 +02:00
59a457430e
migrate more Crunchyroll API endpoints to v2 2023-07-21 17:22:45 +02:00
0662d656ac
update libraries, agp and kotlin
* kotlin 1.8.10 -> 1.8.22
* kotlinx-coroutines-android 1.6.4 -> 1.7.2
* kotlinx-serialization-json 1.5.0 -> 1.5.1
* core-ktx 1.10.0 -> 1.10.1
* core-splashscreen 1.0.0 -> 1.0.1
* navigation-fragment-ktx 2.5.3 -> 2.6.0
* navigation-ui-ktx 2.5.3 -> 2.6.0
* security-crypto 1.1.0-alpha05 -> 1.1.0-alpha06
* material 1.8.0 -> 1.9.0
* ktor 2.2.4 -> 2.3.2
* exo-player 2.18.5 -> 2.18.7
* agp 8.0.0 -> 8.0.2
2023-07-21 11:43:38 +02:00
3549a3d2a7
migrate Crunchyroll.objects() to new v2 endpoint
fixes #71
2023-07-21 11:39:48 +02:00
c89ae54929
fix typo in changelog for 1.1.0-beta2 2023-04-16 16:51:59 +02:00
3aa03783a9
add changelogs for 1.1.0-beta2 2023-04-16 16:49:09 +02:00
4bceacf75c
make versions in DataTypes -> Episodes -> Episode nullable since it is in fact nullable 2023-04-16 16:24:28 +02:00
cf02bee7d4
minor fixes
* fix episode count in MediaFragement
* fix tmdb language tag
* update media type detection to use the episode field as episodeNumber may be messinging from certain episodes of tv shows
2023-04-16 13:49:22 +02:00
01d026cc7f
update libraries, agp and gradle
* core-ktx 1.9.0 -> 1.10.0
* lifecycle-runtime-ktx 2.5.1 -> 2.6.1
* lifecycle-viewmodel-ktx 2.5.1 -> 2.6.1
* glide 4.15.0 -> 4.15.1
* exoplayer 2.18.3 -> 2.18.5
* agp 7.4.2 -> 8.0.0
* gradle wrapper 7.6 -> 8.1
2023-04-16 00:06:40 +02:00
7580093649 Merge pull request 'migrate to material 3' (#70) from feature/material-3 into develop
Reviewed-on: #70
2023-04-15 23:51:08 +02:00
f266731115
remove old theme definition 2023-04-15 23:50:40 +02:00
a6a23c8560
fix onboarding colors for light/dark theme 2023-04-15 23:46:13 +02:00
2cb05de810
fix theme selection dialog to work with system theme also use system as new default 2023-04-15 22:48:59 +02:00
5cf4527a92
clean up color and theme definitions
also use separate theme definition for light/dark
2023-04-15 22:35:19 +02:00
14ad34138c
fix onboarding fragments and bottom sheet login 2023-04-15 22:02:49 +02:00
47e1f6bd49
initial migration to material 3 2023-03-29 16:16:31 +02:00
fdcb76e26e
update glide and kotlinx-serialization
* glide 4.14.2 -> 4.15.0
* kotlinx-serialization 1.4.1 -> 1.5.0
2023-03-01 17:24:02 +01:00
7004d73b9f
update libraries and kotlin
* kotlin 1.7.20 -> 1.8.10
* ktor 2.2.1 -> 2.2.4
* exo player 2.18.2 -> 2.18.3
* androidx.appcompat 1.6.0 -> 1.6.1
* androidx.security:security-crypto 1.1.0-alpha04 -> 1.1.0-alpha05
* com.google.android.material 1.7.0 -> 1.8.0
2023-03-01 17:17:23 +01:00
a13eb15adf
add changelog for 1.1.0-beta1 2023-02-19 17:06:33 +01:00
d40ab9519c
migrate playheads() to crunchyroll v2 api 2023-02-19 16:53:54 +01:00
2e7db26d1d
migrate more api calls to v2 2023-02-19 15:13:31 +01:00
8b7fb3ac5f
fix crunchyroll parser to work with the latest api changes 2023-02-19 14:21:46 +01:00
097383a082
fix playback & update to agp 7.4.0
updated the crunchyroll parser to use the new streams endpoint to retrieve the media streams
2023-01-25 19:51:38 +01:00
9380f98098
add watchlist to MyListsFragment 2022-12-26 19:43:40 +01:00
e0f05169f5
fix shimmer items having the wrong size, update MediaFragmentSimilar to not depend on a specific view model 2022-12-26 19:40:03 +01:00
e113a9c795
Merge library and search into one fragment
closes #55
2022-12-26 16:10:38 +01:00
8e397e13d2
fix padding for ItemMedia
fixes missing shadows in light theme
2022-12-22 18:08:32 +01:00
31e7adac03
update gradle wrapper to version 7.6 2022-12-22 16:16:28 +01:00
63f5e69094
update ktor
ktor 2.1.3 -> 2.2.1
2022-12-11 20:00:39 +01:00
bf6f2d916e
make MeidaFragment poster and backdrop responsive 2022-12-04 15:25:05 +01:00
81a20e0aa9 Merge pull request 'add dynamic spanCount for library/search fragemnt and MediaFragmentSimilar' (#68) from feature/dynamic_span_count into develop
Reviewed-on: #68
2022-12-04 15:24:18 +01:00
ed8f3fdcda
set spanCount according to screen width 2022-12-04 14:48:25 +01:00
fffbeaeb49
make MediaItem width fully dynamic, based on the parents width (50% of parent width) and update SearchFragment to use MediaItemListAdapter and remove now unused MediaItemAdapter 2022-12-04 13:51:29 +01:00
21caa8eb1b
update MediaItem to suport dynamic size
* this is needed for dynamic span count to correctly work
* this also fixes issues with poster image cropping when the MediaItem size was < 195dp
2022-12-03 00:05:57 +01:00
bbc819551b
disable platform diagnostics for exo player 2022-12-02 23:59:39 +01:00
2004a3f483
replace runBlocking{} in setCurrentEpisode with suspend
this fixes the player frezzing for a few 100ms when loading a new episode
2022-11-26 18:34:32 +01:00
0a31c2fd88
update dependencies
* exoplayer 2.17.1 -> 2.18.2
* security-crypto 1.1.0-alpha03 -> 1.1.0-alpha04
* androidx:junit 1.1.3 -> 1.1.4
* androidx:espresso-core 3.4.0 -> 3.5.0
2022-11-26 18:09:50 +01:00
f49b5a2730
rework the player activity starting behaviour
* add callbacks on player finish to update episode watch head progress in gui
* directly start the player from the fragment and not from MainActivity
2022-11-26 17:46:25 +01:00
a95813e91e
use the series id of upNextSeries to select the current season and only fall back to preferred local if not found 2022-11-26 15:52:20 +01:00
8bdaa8122b
replace usage of private exo_white with player_white 2022-11-05 11:58:41 +01:00
e2ea0a364e
update agp, kotlin and libraries 2022-11-05 11:57:35 +01:00
777c6e0212
add ScrollView to player language/subtitles selection 2022-11-05 11:24:16 +01:00
71d5c58653
add crunchy intro metadata to parser and update the skip intro function, closes #66 2022-10-28 23:03:21 +02:00
6624e71228
add more items to the shimmer layout on the home screen 2022-10-14 17:08:51 +02:00
d33de371d1 Merge pull request 'version 1.0.0' (#67) from develop into master
Reviewed-on: #67
2022-10-12 15:36:38 +02:00
1ecd25bb06
update version and changelog for 1.0.0 release 2022-10-12 15:25:48 +02:00
fa28eb35ab
fix crash in TMDBApiController when searchMovie() returns no title
* make title/name optional
* for movies use the movie search endpoint instead of multi

fixes #65
2022-09-21 21:06:52 +02:00
d3fe81224b
add missing play button functionality for highlight media in HomeFragment 2022-09-20 19:47:42 +02:00
34c7f9d081
replace TextView in shimmer items with dummy ImageView with rounded corners 2022-09-20 15:20:49 +02:00
e835715b9c
fix item_media width
don't hardcode layout_width to 195dp, set layout_constraintWidth_max and image_poster layout_constraintWidth this fixes issues if the screen is not wide enough to show multiple item_media elements
2022-09-18 13:53:19 +02:00
001141337d
add shimmer for highlight in home screen, update agp to version 7.3.0 2022-09-18 13:33:22 +02:00
5cd3d25ebe
fix shimmer for light theme 2022-09-15 18:02:48 +02:00
215e01c53a
add changelog for beta3 release 2022-09-14 22:00:00 +02:00
1751963574
update gradle wrapper to version 7.5.1 2022-09-14 21:42:23 +02:00
9c3548a866
add shimmer effect while loading to the lists in home fragment 2022-09-14 21:31:27 +02:00
ebd96f9849
compileSdkVersion 33 and library updates
* core-ktx 1.8.0 -> 1.9.0
* appcompat 1.5.0 -> 1.5.1
* navigation-fragment-ktx 2.5.1 -> 2.5.2
* navigation-ui-ktx 2.5.1 -> 2.5.2
2022-09-14 20:33:08 +02:00
85b17d7a76
improve buttonNextEp hiding behaviour
* the button will be diabled on PlayerActivity.playNextEpisode()
* the button will only be enabled if PlayerViewModel.playNextEpisode() returns
* remainingTime will be set to 0, if duration < 0, this fixes the button reapring after a few 100 ms when beeing pressed

fixes #53
2022-08-27 13:59:30 +02:00
f128efea0d
set compileSdkVersion and targetSdkVersion to 32 2022-08-27 13:56:15 +02:00
da94003368
update agp and libraries
* agp 7.2.1 -> 7.2.2
* kotlinx-coroutines-android 1.6.3 -> 1.6.4
* core-splashscreen 1.0.0-rc01 -> 1.0.0
* appcompat 1.4.2 -> 1.5.0
* navigation-fragment-ktx 2.5.0 -> 2.5.1
* navigation-ui-ktx 2.5.0 -> 2.5.1
* lifecycle-runtime-ktx 2.5.0 -> 2.5.1
* lifecycle-viewmodel-ktx 2.5.0 -> 2.5.1
2022-08-19 22:54:38 +02:00
3fdc2aff1b Merge pull request 'update ktor to version 2.x' (#63) from feature/ktor_update into develop
Reviewed-on: #63
2022-08-19 22:40:55 +02:00
326da147f1
update ktor to version 2.1.0 2022-08-19 18:18:09 +02:00
f398c82f62
update ktor to version 2.0.3 2022-08-19 18:15:37 +02:00
821f8b5590
add subscription status and tier to the AccountFragment 2022-07-21 22:06:41 +02:00
0028cb6dd7
fix EpisodesListDialogFragment current episode selection
fix EpisodesListDialogFragment not selecting the correct episode, if the episode number doens't start at 0, if episodes are count across seasons
2022-07-21 18:49:29 +02:00
127bd030b9
add unit test for token type serialization 2022-07-16 15:08:13 +02:00
3cadaa5c7a
update playhead every 30 seconds while playback is active 2022-07-16 14:35:22 +02:00
97966f5ad3
fix a crash when url or vcodes are missing for a stream
always initialize them, also initialize hardsub_locale since it might be optional too
2022-07-16 14:13:08 +02:00
4c55bb771f
partially revert c34b95795f 2022-07-16 13:48:28 +02:00
8eb737a831
use a separate scope to update playheads
viewModelScope will be cleard when the activity is stopped, but the playhead update should be done anyway

fixes #62
2022-07-10 13:50:53 +02:00
522b893dc8
update kotlin coroutines library
* kotlinx-coroutines-android 1.6.2 -> 1.6.3
2022-07-10 13:26:23 +02:00
69e0b6bcca
update kotlin and libraries
* kotlin 1.6.21 -> 1.7.10
* navigation-fragment-ktx 2.4.2 -> 2.5.0
* navigation-ui-ktx 2.4.2 -> 2.5.0
* lifecycle-runtime-ktx 2.4.1 -> 2.5.0
* lifecycle-viewmodel-ktx 2.4.1 -> 2.5.0
2022-07-10 13:19:59 +02:00
c34b95795f
fix rwd/ffwd button pos when animation is running, clean up rwd/ffwd animation handling 2022-07-10 12:53:03 +02:00
9059306e90
add icon to fastlane metadata 2022-06-07 22:04:45 +02:00
ed0c0a4c61
update libraries
* kotlinx-coroutines 1.6.1 -> 1.6.2
* core-ktx 1.7.0 -> 1.8.0
* appcompat 1.4.1 -> 1.4.2
* constraintlayout 2.1.3 -> 2.1.4
* material 1.5.0 -> 1.6.1
* glide 4.13.1 -> 4.13.2
2022-06-06 13:53:49 +02:00
03a79346b7
update version code and name -> beta3
update after tagging of beta2
2022-06-06 13:45:13 +02:00
ad1e3068cd
update changelog for beta2 release 2022-06-06 13:33:21 +02:00
de1f19c2b7
catch exceprion in playheads() and postPlayheads() & update agp
* fix a crash, if there is no internet connection while in playback (closes #60)
* agp 7.2.0 -> 7.2.1
2022-06-06 13:14:41 +02:00
12bbc2ef5f
add recommendations to home fragment 2022-05-22 11:21:49 +02:00
0186cef79e
fix player progress bar skip intro/next ep button overlapping 2022-05-22 10:39:17 +02:00
bc5509cf93
use newSingleThreadContext instead of mutex for token refresh
fixes #57
2022-05-20 15:07:07 +02:00
ef9a0f00d0
hide the playbutton on media items in library- and searchfragment 2022-05-18 20:59:28 +02:00
b85d7ae025
update kotlin, agp, dependecies
* kotlin 1.6.10 -> 1.6.21
* agp 7.1.3 -> 7.2.0
* splashscreen 1.0.0-beta02 -> 1.0.0-rc1
* coroutines 1.6.0 -> 1.6.1
* serialization-json 1.3.2 -> 1.3.3
2022-05-18 20:58:02 +02:00
69c9666d2b
fix crash if media is present in metadb, but season/episode are not present 2022-04-22 23:51:51 +02:00
7d6c300f7e
implement runtime cache for Crunchyroll.browse() 2022-04-16 17:52:10 +02:00
1ebc1194e6
add categories support to Crunchyroll.browse() 2022-04-16 17:23:53 +02:00
c48328723b
increase touch target height for exo_progress 2022-04-15 17:55:01 +02:00
95c8a72c94
add playhead progress indicator to player episodes list 2022-04-15 17:47:17 +02:00
fc04e8e222
remove kotlin-android-extensions, use viewBinding in Player
also replace exo_progress_placeholder with exoplayer2.ui.DefaultTimeBar since the placehoder wont work with viewbinding
2022-04-15 17:25:31 +02:00
a898a70653
migrate player episodes list to DialogFragment; change hideBars() behaviour 2022-04-15 16:28:15 +02:00
58aab72097
fix FullScreenDialogStyle 2022-04-15 13:39:18 +02:00
35157b78f5
migrate player language settings to DialogFragment; update hideBars()
* player language settings is now aDialogFragment
* update hideBars() to work with any window & view combination
* update hideBars() to use WindowCompat
2022-04-15 13:32:16 +02:00
c6a00ea061
update agp
7.1.2 -> 7.1.3
2022-04-15 11:04:06 +02:00
80a7fc4398
merge PlayerEpisodeItemAdapter into EpisodeItemAdapter 2022-04-10 21:24:09 +02:00
dd6ca8b90e
up next rework
* start playback, when up next episode is clicked
* add playhead progress indicator to up next episodes
2022-04-10 20:15:13 +02:00
e80e81af0f
use MediaItemListAdapter in MediaFragmentSimilar instead of MediaItemAdapter 2022-04-10 17:46:02 +02:00
f852600dc7
port HomeFragment to ViewModel and Kotlin flow; update gradle wrapper 2022-04-10 17:39:30 +02:00
aa49169034
fix (workaround) a crash in MediaFragment if one opens and closes multiple new MediaFragment via the similar tab 2022-04-03 17:33:29 +02:00
7abb5cd3e8
fix fragments cleanup on recreation
after back press if other MediaFragments where created via similar tab
2022-04-03 17:22:28 +02:00
3a71bdd2c7
use fragment as scope for MediaFragmentViewModel 2022-04-03 16:55:54 +02:00
629c144c5b
add similarTo function to crunchyroll parser
This will allow us to show similar tv shows in MediaFragment
2022-04-03 16:14:22 +02:00
b2196f11da
add playhead progress indicator to MediaFragment epsiodes 2022-04-03 14:57:14 +02:00
5b5a74a1de
fix crunchroll parser login crash if login failed 2022-04-02 20:08:29 +02:00
7a860a7270
update ExoPlayer
exoplayer 2.15.0 -> 2.17.1
2022-04-02 19:47:49 +02:00
e97ad9a245
update libraries
* kotlinx-coroutines-android 1.5.2 -> 1.6.0
* kotlinx-serialization 1.3.1 -> 1.3.2
* glide 4.12.0 -> 4.13.1
* ktor 1.6.7 -> 1.6.8
2022-04-02 19:28:19 +02:00
cf435fdb72
replace LoginDialog with material-components based LoginModalBottomSheet 2022-04-02 18:54:17 +02:00
42895a6fba
Make token refresh thread safe 2022-03-30 20:42:46 +02:00
eaf1cf78e9
Set episodes title length to max 3 lines, ellipsize at end 2022-03-30 20:27:10 +02:00
1af82f8370
update playheads on season change
updated playheads are needed for the "completed ep" indicator
2022-03-30 20:12:04 +02:00
d31a19a4f1
update fastlane metadata 2022-03-30 00:05:20 +02:00
b27666ee69 Merge pull request 'add metadb support for crunchyroll' (#54) from featur/metadb_crunchyroll into develop
Reviewed-on: #54
2022-03-29 23:24:57 +02:00
e76cbda04d
fix Onboarding not working; fix deprecation in Activity.hideBars() 2022-03-29 23:23:10 +02:00
7fbf639a70
add metadb support for crunchyroll
also remove gson snice it's unused now
2022-03-29 22:39:16 +02:00
ff63b3d7a4
update gradle wrapper & core-splashscreen
* wrapper 7.3.3 -> 7.4.1
* core-splashscreen 1.0.0-beta01 -> 1.0.0-beta02
2022-03-29 22:39:02 +02:00
7d32cecd89
hide unused dev settings 2022-03-20 12:56:01 +01:00
72280f29d8
add option to disable playhead updates/reporting 2022-03-20 12:38:49 +01:00
cd4cfb7a0c
update libraries & targetSdk; use core-splashscreen for splashscreen
* targetSdk 30 -> 31
* core-ktx 1.6.0 -> 1.7.0
* appcompat 1.3.1 -> 1.4.1
* constraintlayout 2.1.0 -> 2.1.3
* navigation-fragment-ktx 2.3.5 -> 2.4.1
* navigation-ui-ktx 2.3.5 -> 2.4.1
* lifecycle-runtime-ktx 2.3.5 -> 2.4.1
* lifecycle-viewmodel-ktx 2.3.5 -> 2.4.1
* material 1.4.0 -> 1.5.0
2022-03-19 22:09:47 +01:00
19552d3950 Merge pull request 'version 0.4.2' (#44) from develop into master
Reviewed-on: #44
2021-07-09 18:56:34 +02:00
49e0b1ec29 Merge pull request 'release 0.4.1' (#37) from develop into master
Reviewed-on: #37
2021-03-13 22:19:29 +01:00
af66d968cc Merge pull request 'release 0.4.0' (#34) from develop into master
Reviewed-on: #34
2021-03-04 20:38:28 +01:00
135 changed files with 4167 additions and 2394 deletions

View File

@ -26,4 +26,4 @@ Currently you need to have an Crunchyroll account to contribute to Teapod. Contr
#### Why is it called Teapod?
Teapod is a Acronym for "The ultimate anime app on demand", hence this project is called Teapod and not Teapot.
Teapod © 2020-2022 [@Seil0](https://git.mosad.xyz/Seil0)
Teapod © 2020-2023 [@Seil0](https://git.mosad.xyz/Seil0)

View File

@ -1,20 +1,26 @@
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-android-extensions'
id 'org.jetbrains.kotlin.plugin.serialization' version "$kotlin_version"
}
kotlin {
jvmToolchain 17
sourceSets.configureEach {
languageSettings.optIn("kotlin.RequiresOptIn")
}
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
compileSdk 34
buildToolsVersion = '34.0.0'
defaultConfig {
applicationId "org.mosad.teapod"
minSdkVersion 23
targetSdkVersion 30
versionCode 9000 //00.09.000
versionName "1.0.0-beta1"
minSdk 23
targetSdk 33
versionCode 100992 //01.00.000
versionName "1.1.0-beta3"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
resValue "string", "build_time", buildTime()
@ -23,6 +29,7 @@ android {
buildFeatures {
viewBinding true
buildConfig true
}
buildTypes {
@ -33,51 +40,47 @@ android {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
namespace 'org.mosad.teapod'
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2'
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.9.0'
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3'
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
implementation 'androidx.security:security-crypto:1.1.0-alpha03'
implementation 'androidx.core:core-ktx:1.13.1'
implementation 'androidx.core:core-splashscreen:1.0.1'
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.navigation:navigation-fragment-ktx:2.8.3'
implementation 'androidx.navigation:navigation-ui-ktx:2.8.3'
implementation 'androidx.security:security-crypto:1.1.0-alpha06'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.6'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.6'
implementation "androidx.paging:paging-runtime-ktx:3.3.2"
implementation 'com.google.android.material:material:1.4.0'
implementation 'com.google.code.gson:gson:2.8.8' // TODO remove, still used by metadb
implementation 'com.google.android.exoplayer:exoplayer-core:2.15.0'
implementation 'com.google.android.exoplayer:exoplayer-hls:2.15.0'
implementation 'com.google.android.exoplayer:exoplayer-dash:2.15.0'
implementation 'com.google.android.exoplayer:exoplayer-ui:2.15.0'
implementation 'com.google.android.exoplayer:extension-mediasession:2.15.0'
implementation 'com.google.android.material:material:1.12.0'
implementation "com.google.android.exoplayer:exoplayer-core:$exo_version"
implementation "com.google.android.exoplayer:exoplayer-hls:$exo_version"
implementation "com.google.android.exoplayer:exoplayer-dash:$exo_version"
implementation "com.google.android.exoplayer:exoplayer-ui:$exo_version"
implementation "com.google.android.exoplayer:extension-mediasession:$exo_version"
implementation 'com.github.bumptech.glide:glide:4.12.0'
implementation 'com.facebook.shimmer:shimmer:0.5.0'
implementation 'com.github.bumptech.glide:glide:4.16.0'
implementation 'jp.wasabeef:glide-transformations:4.3.0'
implementation 'com.afollestad.material-dialogs:core:3.3.0' // TODO remove once unused
implementation 'com.afollestad.material-dialogs:bottomsheets:3.3.0' // TODO remove once unused
implementation "io.ktor:ktor-client-core:$ktor_version"
implementation "io.ktor:ktor-client-android:$ktor_version"
implementation "io.ktor:ktor-client-serialization:$ktor_version"
implementation "io.ktor:ktor-client-content-negotiation:$ktor_version"
implementation "io.ktor:ktor-serialization-kotlinx-json:$ktor_version"
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
}

View File

@ -24,10 +24,6 @@
-keep class org.json.** { *; }
#Gson
-keepattributes Signature
-dontwarn sun.misc.**
# kotlinx.serialization
# Keep `Companion` object fields of serializable classes.
# This avoids serializer lookup through `getDeclaredClasses` as done for named companion objects.
@ -56,6 +52,9 @@
# @Serializable and @Polymorphic are used at runtime for polymorphic serialization.
-keepattributes RuntimeVisibleAnnotations,AnnotationDefault
# This is generated automatically by the Android Gradle plugin.
-dontwarn org.slf4j.impl.StaticLoggerBinder
#misc
-dontwarn java.lang.instrument.ClassFileTransformer
-dontwarn java.lang.ClassValue

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.mosad.teapod">
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET" />
@ -11,34 +10,29 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme.Dark">
android:theme="@style/AppTheme">
<activity
android:name="org.mosad.teapod.ui.activity.SplashActivity"
android:label="@string/app_name"
android:theme="@style/SplashTheme"
android:screenOrientation="portrait">
android:exported="true"
android:name="org.mosad.teapod.ui.activity.main.MainActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.App.Starting">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:exported="false"
android:name="org.mosad.teapod.ui.activity.onboarding.OnboardingActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:launchMode="singleTop"
android:windowSoftInputMode="adjustPan">
</activity>
<activity
android:name="org.mosad.teapod.ui.activity.main.MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait">
</activity>
<activity
android:exported="false"
android:name="org.mosad.teapod.ui.activity.player.PlayerActivity"
android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|layoutDirection"
android:autoRemoveFromRecents="true"
android:label="@string/app_name"
android:launchMode="singleTask"
android:parentActivityName="org.mosad.teapod.ui.activity.main.MainActivity"
android:supportsPictureInPicture="true"

View File

@ -25,46 +25,46 @@ package org.mosad.teapod.parser.crunchyroll
import android.util.Log
import io.ktor.client.*
import io.ktor.client.call.*
import io.ktor.client.features.json.*
import io.ktor.client.features.json.serializer.*
import io.ktor.client.plugins.*
import io.ktor.client.plugins.contentnegotiation.*
import io.ktor.client.request.*
import io.ktor.client.request.forms.*
import io.ktor.client.statement.*
import io.ktor.http.*
import io.ktor.serialization.*
import io.ktor.serialization.kotlinx.json.*
import kotlinx.coroutines.*
import kotlinx.serialization.SerializationException
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.buildJsonObject
import kotlinx.serialization.json.put
import org.mosad.teapod.preferences.EncryptedPreferences
import org.mosad.teapod.preferences.Preferences
import org.mosad.teapod.util.concatenate
private val json = Json { ignoreUnknownKeys = true }
object Crunchyroll {
private val TAG = javaClass.name
private val client = HttpClient {
install(JsonFeature) {
serializer = KotlinxSerializer(json)
install(ContentNegotiation) {
json(Json {
ignoreUnknownKeys = true
})
}
}
private const val baseUrl = "https://beta-api.crunchyroll.com"
private const val staticUrl = "https://static.crunchyroll.com"
private const val basicApiTokenUrl = "https://gitlab.com/-/snippets/2274956/raw/main/snippetfile1.txt"
private var basicApiToken: String = ""
private lateinit var token: Token
private var tokenValidUntil: Long = 0
@OptIn(DelicateCoroutinesApi::class, ExperimentalCoroutinesApi::class)
private val tokenRefreshContext = newSingleThreadContext("TokenRefreshContext")
private var accountID = ""
private var externalID = ""
private var policy = ""
private var signature = ""
private var keyPairID = ""
private val browsingCache = arrayListOf<Item>()
private val browsingCache = hashMapOf<String, BrowseResult>()
/**
* Load the pai token, see:
@ -74,7 +74,7 @@ object Crunchyroll {
*/
fun initBasicApiToken() = runBlocking {
withContext(Dispatchers.IO) {
basicApiToken = (client.get(basicApiTokenUrl) as HttpResponse).readText()
basicApiToken = client.get { url(basicApiTokenUrl) }.bodyAsText()
Log.i(TAG, "basic auth token: $basicApiToken")
}
}
@ -98,15 +98,27 @@ object Crunchyroll {
var success = false// is false
withContext(Dispatchers.IO) {
// TODO handle exceptions
val response: HttpResponse = client.submitForm("$baseUrl$tokenEndpoint", formParameters = formData) {
header("Authorization", "Basic $basicApiToken")
}
token = response.receive()
tokenValidUntil = System.currentTimeMillis() + (token.expiresIn * 1000)
Log.i(TAG, "getting token ...")
Log.i(TAG, "login complete with code ${response.status}")
success = (response.status == HttpStatusCode.OK)
val status = try {
val response: HttpResponse = client.submitForm("$baseUrl$tokenEndpoint", formParameters = formData) {
header("Authorization", "Basic $basicApiToken")
}
token = response.body()
tokenValidUntil = System.currentTimeMillis() + (token.expiresIn * 1000)
response.status
} catch (ex: ClientRequestException) {
val status = ex.response.status
if (status == HttpStatusCode.Unauthorized) {
Log.e(TAG, "Could not complete login: " +
"${status.value} ${status.description}. " +
"Probably wrong username or password")
}
status
}
Log.i(TAG, "Login complete with code $status")
success = (status == HttpStatusCode.OK)
}
return@runBlocking success
@ -126,10 +138,12 @@ object Crunchyroll {
params: List<Pair<String, Any?>> = listOf(),
bodyObject: Any = Any()
): T = coroutineScope {
if (System.currentTimeMillis() > tokenValidUntil) refreshToken()
withContext(tokenRefreshContext) {
if (System.currentTimeMillis() > tokenValidUntil) refreshToken()
}
return@coroutineScope (Dispatchers.IO) {
val response: T = client.request(url) {
val response = client.request(url) {
method = httpMethod
header("Authorization", "${token.tokenType} ${token.accessToken}")
params.forEach {
@ -138,21 +152,24 @@ object Crunchyroll {
// for json set body and content type
if (bodyObject is JsonObject) {
body = bodyObject
setBody(bodyObject)
contentType(ContentType.Application.Json)
}
}
response
response.body<T>()
}
}
/**
* Send a HTTP GET request with [params] to the [endpoint] at [url], if url is empty use baseUrl
*/
private suspend inline fun <reified T> requestGet(
endpoint: String,
params: List<Pair<String, Any?>> = listOf(),
url: String = ""
): T {
val path = url.ifEmpty { "$baseUrl$endpoint" }
val path = url.ifEmpty { baseUrl }.plus(endpoint)
return request(path, HttpMethod.Get, params)
}
@ -191,27 +208,10 @@ object Crunchyroll {
}
/**
* Basic functions: index, account
* Basic functions: account
* Needed for other functions to work properly!
*/
/**
* Retrieve the identifiers necessary for streaming. If the identifiers are
* retrieved, set the corresponding global var. The identifiers are valid for 24h.
*/
suspend fun index() {
val indexEndpoint = "/index/v2"
val index: Index = requestGet(indexEndpoint)
policy = index.cms.policy
signature = index.cms.signature
keyPairID = index.cms.keyPairId
Log.i(TAG, "Policy : $policy")
Log.i(TAG, "Signature : $signature")
Log.i(TAG, "Key Pair ID : $keyPairID")
}
/**
* Retrieve the account id and set the corresponding global var.
* The account id is needed for other calls.
@ -223,72 +223,103 @@ object Crunchyroll {
val account: Account = try {
requestGet(indexEndpoint)
} catch (ex: SerializationException) {
} catch (ex: Exception) {
Log.e(TAG, "SerializationException in account(). This is bad!", ex)
NoneAccount
}
accountID = account.accountId
externalID = account.externalId
}
/**
* General element/media functions: browse, search, objects, season_list
*/
// TODO categories
/**
* Browse the media available on crunchyroll.
*
* @param sortBy
* @param n Number of items to return, defaults to 10
*
* @param start start of the item list, used for pagination, default = 0
* @param n number of items to return, default = 10
* @param sortBy the sort order, see **[SortBy]**
* @param ratings add user rating to the objects, default = false
* @param seasonTag filter by season tag, if present
* @param categories filter by category, if present
* @return A **[BrowseResult]** object is returned.
*/
suspend fun browse(
sortBy: SortBy = SortBy.ALPHABETICAL,
seasonTag: String = "",
start: Int = 0,
n: Int = 10
n: Int = 10,
sortBy: SortBy = SortBy.ALPHABETICAL,
ratings: Boolean = false,
seasonTag: String = "",
categories: List<Categories> = emptyList()
): BrowseResult {
val browseEndpoint = "/content/v1/browse"
val noneOptParams = listOf(
"locale" to Preferences.preferredLocale.toLanguageTag(),
"sort_by" to sortBy.str,
val browseEndpoint = "/content/v2/discover/browse"
val parameters = mutableListOf(
"start" to start,
"n" to n
"n" to n,
"sort_by" to sortBy.str,
"ratings" to ratings,
"preferred_audio_language" to Preferences.preferredSubtitleLocale.toLanguageTag(),
"locale" to Preferences.preferredSubtitleLocale.toLanguageTag(),
)
// if a season tag is present add it to the parameters
val parameters = if (seasonTag.isNotEmpty()) {
concatenate(noneOptParams, listOf("season_tag" to seasonTag))
if (seasonTag.isNotEmpty()) {
parameters.add("season_tag" to seasonTag)
}
// if a season tag is present add it to the parameters
if (categories.isNotEmpty()) {
parameters.add("categories" to categories.joinToString(",") { it.str })
}
// fetch result if not already cached
if (browsingCache.contains(parameters.toString())) {
Log.d(TAG, "browse result cached: $parameters")
} else {
noneOptParams
Log.d(TAG, "browse result not cached, fetching: $parameters")
val browseResult: BrowseResult = try {
requestGet(browseEndpoint, parameters)
}catch (ex: Exception) {
Log.e(TAG, "SerializationException in browse().", ex)
NoneBrowseResult
}
// if the cache has more than 10 entries clear it, so it doesn't become a memory problem
// Note: this value is totally guessed and should be replaced by a properly researched value
if (browsingCache.size > 10) {
browsingCache.clear()
}
// add results to cache
browsingCache[parameters.toString()] = browseResult
}
val browseResult: BrowseResult = try {
requestGet(browseEndpoint, parameters)
}catch (ex: SerializationException) {
Log.e(TAG, "SerializationException in browse().", ex)
NoneBrowseResult
}
// add results to cache TODO improve
browsingCache.clear()
browsingCache.addAll(browseResult.items)
return browseResult
return browsingCache[parameters.toString()] ?: NoneBrowseResult
}
/**
* TODO
* Search fo a query term.
* Note: currently this function only supports series/tv shows.
*
* @param query The query term as String
* @param n The maximum number of results to return, default = 10
* @param ratings add user rating to the objects, default = false
* @return A **[SearchResult]** object
*/
suspend fun search(query: String, n: Int = 10): SearchResult {
val searchEndpoint = "/content/v1/search"
suspend fun search(query: String, n: Int = 10, ratings: Boolean = false): SearchResult {
val searchEndpoint = "/content/v2/discover/search"
val parameters = listOf(
"locale" to Preferences.preferredLocale.toLanguageTag(),
"q" to query,
"n" to n,
"type" to "series"
"type" to "series",
"ratings" to ratings,
"preferred_audio_language" to Preferences.preferredSubtitleLocale.toLanguageTag(),
"locale" to Preferences.preferredSubtitleLocale.toLanguageTag()
)
// TODO episodes have thumbnails as image, and not poster_tall/poster_tall,
@ -296,8 +327,8 @@ object Crunchyroll {
return try {
requestGet(searchEndpoint, parameters)
}catch (ex: SerializationException) {
Log.e(TAG, "SerializationException in search(), with query = \"$query\".", ex)
} catch (ex: Exception) {
Log.e(TAG, "Exception in search(), with query = \"$query\".", ex)
NoneSearchResult
}
}
@ -307,38 +338,22 @@ object Crunchyroll {
* Note: episode objects are currently not supported
*
* @param objects The object IDs as list of Strings
* @param ratings add user rating to the objects
* @return A **[Collection]** of Panels
*/
suspend fun objects(objects: List<String>): Collection<Item> {
val episodesEndpoint = "/cms/v2/DE/M3/crunchyroll/objects/${objects.joinToString(",")}"
suspend fun objects(objects: List<String>, ratings: Boolean = false): CollectionV2<Item> {
val episodesEndpoint = "/content/v2/cms/objects/${objects.joinToString(",")}"
val parameters = listOf(
"locale" to Preferences.preferredLocale.toLanguageTag(),
"Signature" to signature,
"Policy" to policy,
"Key-Pair-Id" to keyPairID
"ratings" to ratings,
"preferred_audio_language" to Preferences.preferredAudioLocale.toLanguageTag(),
"locale" to Preferences.preferredSubtitleLocale.toLanguageTag()
)
return try {
requestGet(episodesEndpoint, parameters)
}catch (ex: SerializationException) {
Log.e(TAG, "SerializationException in objects().", ex)
NoneCollection
}
}
/**
* List all available seasons as **[SeasonListItem]**.
*/
@Suppress("unused")
suspend fun seasonList(): DiscSeasonList {
val seasonListEndpoint = "/content/v1/season_list"
val parameters = listOf("locale" to Preferences.preferredLocale.toLanguageTag())
return try {
requestGet(seasonListEndpoint, parameters)
}catch (ex: SerializationException) {
Log.e(TAG, "SerializationException in seasonList().", ex)
NoneDiscSeasonList
} catch (ex: Exception) {
Log.e(TAG, "Exception in objects().", ex)
NoneCollectionV2
}
}
@ -350,87 +365,118 @@ object Crunchyroll {
* series id == crunchyroll id?
*/
suspend fun series(seriesId: String): Series {
val seriesEndpoint = "/cms/v2/${token.country}/M3/crunchyroll/series/$seriesId"
val seriesEndpoint = "/content/v2/cms/series/$seriesId"
val parameters = listOf(
"locale" to Preferences.preferredLocale.toLanguageTag(),
"Signature" to signature,
"Policy" to policy,
"Key-Pair-Id" to keyPairID
"preferred_audio_language" to Preferences.preferredAudioLocale.toLanguageTag(),
"locale" to Preferences.preferredSubtitleLocale.toLanguageTag()
)
return try {
requestGet(seriesEndpoint, parameters)
}catch (ex: SerializationException) {
Log.e(TAG, "SerializationException in series().", ex)
} catch (ex: Exception) {
Log.e(TAG, "Exception in series() for id $seriesId.", ex)
NoneSeries
}
}
/**
* TODO
* Get the next episode for a series.
*
* FIXME up_next returns no content if the is no next episode
*
* @param seriesId The series id for which to call up next
* @return A **[UpNextSeriesItem]** with a Panel representing the up next episode
*/
suspend fun upNextSeries(seriesId: String): UpNextSeriesItem {
val upNextSeriesEndpoint = "/content/v1/up_next_series"
suspend fun upNextSeries(seriesId: String): UpNextSeriesList {
val upNextSeriesEndpoint = "/content/v2/discover/up_next/$seriesId"
val parameters = listOf(
"series_id" to seriesId,
"locale" to Preferences.preferredLocale.toLanguageTag()
"preferred_audio_language" to Preferences.preferredAudioLocale.toLanguageTag(),
"locale" to Preferences.preferredSubtitleLocale.toLanguageTag()
)
return try {
requestGet(upNextSeriesEndpoint, parameters)
}catch (ex: SerializationException) {
Log.e(TAG, "SerializationException in upNextSeries().", ex)
NoneUpNextSeriesItem
}
}
suspend fun seasons(seriesId: String): Seasons {
val seasonsEndpoint = "/cms/v2/${token.country}/M3/crunchyroll/seasons"
val parameters = listOf(
"series_id" to seriesId,
"locale" to Preferences.preferredLocale.toLanguageTag(),
"Signature" to signature,
"Policy" to policy,
"Key-Pair-Id" to keyPairID
)
return try {
requestGet(seasonsEndpoint, parameters)
}catch (ex: SerializationException) {
Log.e(TAG, "SerializationException in seasons().", ex)
NoneSeasons
}
}
suspend fun episodes(seasonId: String): Episodes {
val episodesEndpoint = "/cms/v2/${token.country}/M3/crunchyroll/episodes"
val parameters = listOf(
"season_id" to seasonId,
"locale" to Preferences.preferredLocale.toLanguageTag(),
"Signature" to signature,
"Policy" to policy,
"Key-Pair-Id" to keyPairID
)
return try {
requestGet(episodesEndpoint, parameters)
}catch (ex: SerializationException) {
Log.e(TAG, "SerializationException in episodes().", ex)
NoneEpisodes
}
}
suspend fun playback(url: String): Playback {
return try {
requestGet("", url = url)
}catch (ex: SerializationException) {
Log.e(TAG, "SerializationException in playback(), with url = $url.", ex)
NonePlayback
} catch (ex: NoTransformationFoundException) {
// should be 204 No Content
NoneUpNextSeriesList
} catch (ex: JsonConvertException) {
Log.e(TAG, "JsonConvertException in upNextSeries() with seriesId=$seriesId", ex)
NoneUpNextSeriesList
} catch (ex: Exception) {
Log.e(TAG, "Exception in upNextSeries() for seriesId $seriesId.", ex)
NoneUpNextSeriesList
}
}
/**
* Additional media functions: watchlist (series), playhead
* Get all available seasons for a series.
*
* @param seriesId The series id for which to get the seasons
* @return A **[Seasons]** object with a list of **[Season]**
*/
suspend fun seasons(seriesId: String): Seasons {
val seasonsEndpoint = "/content/v2/cms/series/$seriesId/seasons"
val parameters = listOf(
"preferred_audio_language" to Preferences.preferredSubtitleLocale.toLanguageTag(),
"locale" to Preferences.preferredSubtitleLocale.toLanguageTag()
)
return try {
requestGet(seasonsEndpoint, parameters)
} catch (ex: Exception) {
Log.e(TAG, "Exception in seasons() for seriesId $seriesId.", ex)
NoneSeasons
}
}
/**
* Get all available episodes for a season.
*