Skip to content

fix: allow codec field to be optional#70

Merged
Secozzi merged 5 commits into
Secozzi:masterfrom
Secon-ary:patch-1
Jun 23, 2026
Merged

fix: allow codec field to be optional#70
Secozzi merged 5 commits into
Secozzi:masterfrom
Secon-ary:patch-1

Conversation

@Secon-ary

@Secon-ary Secon-ary commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Hi, thank you for the works. The extension is working great, but I encounter missing codec field error in some of my library. I tried to check said library using ffmpeg, turn out it did miss some audio codec. Though the movie and its audio is working fine.

So, this change is just to make codec filed to be optional. Take a note that I don't fully understand how Jellyfin nor video component work. So, I don't know whether this change will break other code or not. Please forgive my English, it's not my first language. Thanks!

Checklist:

  • Updated extVersionCode value in build.gradle for individual extensions
  • Referenced all related issues in the PR body (e.g. "Closes #xyz")
  • Added the isNsfw = true flag in build.gradle when appropriate
  • Have not changed source names
  • Have explicitly kept the id if a source's name or language were changed
  • Have tested the modifications by compiling and running the extension through Android Studio
  • Have removed web_hi_res_512.png when adding a new extension

Hi, thank you for the works. The extension is working great, but I encounter missing codec field error in some of my library. I tried to check said library using ffmpeg, turn out it did miss some audio codec. Though the movie and its audio is working fine. 

So, this change is just to make codec filed to be optional. Take a note that I don't fully understand how Jellyfin nor video component work. So, I don't know whether this change will break other code or not. Please forgive my English, it's not my first language. Thanks!
@Secozzi

Secozzi commented Jun 22, 2026

Copy link
Copy Markdown
Owner

The codec is only used in external subtitles, but since the codec for the subtitles is required, could you add a null check there?

Also, you need to bump extVersionCode in the build.gradle file

@Secon-ary

Copy link
Copy Markdown
Contributor Author

I have added null check and bump version code

Comment thread src/all/jellyfin/src/eu/kanade/tachiyomi/animeextension/all/jellyfin/Jellyfin.kt Outdated
Co-authored-by: Secozzi <49240133+Secozzi@users.noreply.github.com>
@Secon-ary

Copy link
Copy Markdown
Contributor Author

As in, if codec is null, we skip subtitles entirely?

@Secon-ary

Secon-ary commented Jun 23, 2026

Copy link
Copy Markdown
Contributor Author

Sorry, I just realize after committing your suggestion. Your suggestion is like this

                    if (media.supportsExternalStream) {
                        val subtitleUrl = baseUrl.toHttpUrl().newBuilder().apply {
                            addPathSegment("Videos")
                            addPathSegment(itemId)
                            addPathSegment(mediaSource.id!!)
                            addPathSegment("Subtitles")
                            addPathSegment(media.index.toString())
                            addPathSegment("0")
                            if (media.codec != null) {
                                addPathSegment("Stream.${media.codec}")
                        if (media.supportsExternalStream && media.codec != null) {
                            val subtitleUrl = baseUrl.toHttpUrl().newBuilder().apply {
                            addPathSegment("Videos")
                            addPathSegment(itemId)
                            addPathSegment(mediaSource.id!!)
                            addPathSegment("Subtitles")
                            addPathSegment(media.index.toString())
                            addPathSegment("0")
                            addPathSegment("Stream.${media.codec}")
                        }.build().toString()

Did you mean like this:

                   if (media.supportsExternalStream && media.codec != null) {
                       val subtitleUrl = baseUrl.toHttpUrl().newBuilder().apply {
                           addPathSegment("Videos")
                           addPathSegment(itemId)
                           addPathSegment(mediaSource.id!!)
                           addPathSegment("Subtitles")
                           addPathSegment(media.index.toString())
                           addPathSegment("0")
                           addPathSegment("Stream.${media.codec}")
                       }.build().toString()

@Secon-ary

Copy link
Copy Markdown
Contributor Author

I just go ahead and use this version:

                   if (media.supportsExternalStream && media.codec != null) {
                       val subtitleUrl = baseUrl.toHttpUrl().newBuilder().apply {
                           addPathSegment("Videos")
                           addPathSegment(itemId)
                           addPathSegment(mediaSource.id!!)
                           addPathSegment("Subtitles")
                           addPathSegment(media.index.toString())
                           addPathSegment("0")
                           addPathSegment("Stream.${media.codec}")
                       }.build().toString()

Let me know if that's not you wanted. I will revert it later.
Sorry, I haven't use Kotlin or done any mobile development in a long time.

@Secozzi

Secozzi commented Jun 23, 2026

Copy link
Copy Markdown
Owner

Sorry, I just realize after committing your suggestion. Your suggestion is like this

                    if (media.supportsExternalStream) {
                        val subtitleUrl = baseUrl.toHttpUrl().newBuilder().apply {
                            addPathSegment("Videos")
                            addPathSegment(itemId)
                            addPathSegment(mediaSource.id!!)
                            addPathSegment("Subtitles")
                            addPathSegment(media.index.toString())
                            addPathSegment("0")
                            if (media.codec != null) {
                                addPathSegment("Stream.${media.codec}")
                        if (media.supportsExternalStream && media.codec != null) {
                            val subtitleUrl = baseUrl.toHttpUrl().newBuilder().apply {
                            addPathSegment("Videos")
                            addPathSegment(itemId)
                            addPathSegment(mediaSource.id!!)
                            addPathSegment("Subtitles")
                            addPathSegment(media.index.toString())
                            addPathSegment("0")
                            addPathSegment("Stream.${media.codec}")
                        }.build().toString()

Did you mean like this:

                   if (media.supportsExternalStream && media.codec != null) {
                       val subtitleUrl = baseUrl.toHttpUrl().newBuilder().apply {
                           addPathSegment("Videos")
                           addPathSegment(itemId)
                           addPathSegment(mediaSource.id!!)
                           addPathSegment("Subtitles")
                           addPathSegment(media.index.toString())
                           addPathSegment("0")
                           addPathSegment("Stream.${media.codec}")
                       }.build().toString()

Ah yes, that's what i thought i suggested but it seems like Github messed it up

@Secozzi Secozzi merged commit e9e12e9 into Secozzi:master Jun 23, 2026
1 check passed
@Secon-ary Secon-ary deleted the patch-1 branch June 24, 2026 04:21
@Secon-ary

Copy link
Copy Markdown
Contributor Author

Great, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants