Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix media details tag for multiple versions support #3336

Conversation

MichaelRUSF
Copy link
Contributor

Changes
Changes the media details tag to check the audio stream based on the media source index.

Fixes
Currently, the media details tag only reflects the first movie regardless of the version selected.

if (stream.getChannelLayout() != null && stream.getChannelLayout().trim().length() > 0) {
addBlockText(context, layout, stream.getChannelLayout().toUpperCase());
if (audioStream.getChannelLayout() != null && audioStream.getChannelLayout().trim().length() > 0) {
addBlockText(context, layout, audioStream.getChannelLayout().toUpperCase());

Check warning

Code scanning / Android Lint

Implied default locale in case conversion Warning

Implicitly using the default locale is a common source of bugs: Use toUpperCase(Locale) instead. For strings meant to be internal use Locale.ROOT, otherwise Locale.getDefault().
@@ -48,66 +48,64 @@
}
}

public static void addInfoRow(Context context, BaseItemDto item, LinearLayout layout, boolean includeRuntime, boolean includeEndTime) {

Check notice

Code scanning / Android Lint

Unknown nullness Note

Unknown nullability; explicitly declare as @Nullable or @NonNull to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations
@@ -48,66 +48,64 @@
}
}

public static void addInfoRow(Context context, BaseItemDto item, LinearLayout layout, boolean includeRuntime, boolean includeEndTime) {

Check notice

Code scanning / Android Lint

Unknown nullness Note

Unknown nullability; explicitly declare as @Nullable or @NonNull to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations
@@ -48,66 +48,64 @@
}
}

public static void addInfoRow(Context context, BaseItemDto item, LinearLayout layout, boolean includeRuntime, boolean includeEndTime) {

Check notice

Code scanning / Android Lint

Unknown nullness Note

Unknown nullability; explicitly declare as @Nullable or @NonNull to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations
@nielsvanvelzen nielsvanvelzen added the bug Something isn't working label Feb 3, 2024
@nielsvanvelzen nielsvanvelzen added this to the v0.17.0 milestone Feb 3, 2024
@nielsvanvelzen nielsvanvelzen enabled auto-merge (rebase) February 3, 2024 13:59
@nielsvanvelzen
Copy link
Member

Awesome, thanks!

@nielsvanvelzen nielsvanvelzen merged commit b8f74fa into jellyfin:master Feb 3, 2024
4 checks passed
@@ -125,22 +125,22 @@
if (item.getMovieCount() != null && item.getMovieCount() > 0) {
TextView amt = new TextView(context);
amt.setTextSize(textSize);
amt.setText(item.getMovieCount().toString()+" "+context.getResources().getString(R.string.lbl_movies)+" ");
amt.setText(item.getMovieCount().toString() + " " + context.getResources().getString(R.string.lbl_movies) + " ");

Check warning

Code scanning / Android Lint

TextView Internationalization Warning

Number formatting does not take into account locale settings. Consider using String.format instead.
layout.addView(amt);
hasSpecificCounts = true;

}
if (item.getSeriesCount() != null && item.getSeriesCount() > 0) {
TextView amt = new TextView(context);
amt.setTextSize(textSize);
amt.setText(item.getSeriesCount().toString()+" "+context.getResources().getString(R.string.lbl_tv_series)+" ");
amt.setText(item.getSeriesCount().toString() + " " + context.getResources().getString(R.string.lbl_tv_series) + " ");

Check warning

Code scanning / Android Lint

TextView Internationalization Warning

Number formatting does not take into account locale settings. Consider using String.format instead.
layout.addView(amt);
hasSpecificCounts = true;
}
if (!hasSpecificCounts && item.getChildCount() != null && item.getChildCount() > 0) {
TextView amt = new TextView(context);
amt.setTextSize(textSize);
amt.setText(item.getChildCount().toString()+" "+ context.getResources().getString(item.getChildCount() > 1 ? R.string.lbl_items : R.string.lbl_item) +" ");
amt.setText(item.getChildCount().toString() + " " + context.getResources().getString(item.getChildCount() > 1 ? R.string.lbl_items : R.string.lbl_item) + " ");

Check warning

Code scanning / Android Lint

TextView Internationalization Warning

Number formatting does not take into account locale settings. Consider using String.format instead.
@@ -150,7 +150,7 @@
if (count != null && count > 0) {
TextView amt = new TextView(context);
amt.setTextSize(textSize);
amt.setText(count.toString()+" "+ label +" ");
amt.setText(count.toString() + " " + label + " ");

Check warning

Code scanning / Android Lint

TextView Internationalization Warning

Number formatting does not take into account locale settings. Consider using String.format instead.
case "ac3": codec = "DD"; break;
default: codec = stream.getCodec().toUpperCase();
} else if (audioStream.getCodec() != null & audioStream.getCodec().trim().length() > 0) {
switch (audioStream.getCodec().toLowerCase()) {

Check warning

Code scanning / Android Lint

Implied default locale in case conversion Warning

Implicitly using the default locale is a common source of bugs: Use toLowerCase(Locale) instead. For strings meant to be internal use Locale.ROOT, otherwise Locale.getDefault().
layout.addView(amt);
hasSpecificCounts = true;
}
if (!hasSpecificCounts && item.getChildCount() != null && item.getChildCount() > 0) {
TextView amt = new TextView(context);
amt.setTextSize(textSize);
amt.setText(item.getChildCount().toString()+" "+ context.getResources().getString(item.getChildCount() > 1 ? R.string.lbl_items : R.string.lbl_item) +" ");
amt.setText(item.getChildCount().toString() + " " + context.getResources().getString(item.getChildCount() > 1 ? R.string.lbl_items : R.string.lbl_item) + " ");

Check warning

Code scanning / Android Lint

TextView Internationalization Warning

Do not concatenate text displayed with setText. Use resource string with placeholders.
@@ -150,7 +150,7 @@
if (count != null && count > 0) {
TextView amt = new TextView(context);
amt.setTextSize(textSize);
amt.setText(count.toString()+" "+ label +" ");
amt.setText(count.toString() + " " + label + " ");

Check warning

Code scanning / Android Lint

TextView Internationalization Warning

Do not concatenate text displayed with setText. Use resource string with placeholders.
@@ -159,13 +159,13 @@
if (item.getAirDays() != null && item.getAirDays().size() > 0) {
TextView textView = new TextView(context);
textView.setTextSize(textSize);
textView.setText(item.getAirDays().get(0) + " " + Utils.getSafeValue(item.getAirTime(), "") + " ");
textView.setText(item.getAirDays().get(0) + " " + Utils.getSafeValue(item.getAirTime(), "") + " ");

Check warning

Code scanning / Android Lint

TextView Internationalization Warning

Do not concatenate text displayed with setText. Use resource string with placeholders.
@@ -175,7 +175,7 @@
private static void addProgramInfo(@NonNull Context context, BaseItemDto item, LinearLayout layout) {
TextView name = new TextView(context);
name.setTextSize(textSize);
name.setText(BaseItemExtensionsKt.getProgramSubText(item, context)+" ");
name.setText(BaseItemExtensionsKt.getProgramSubText(item, context) + " ");

Check warning

Code scanning / Android Lint

TextView Internationalization Warning

Do not concatenate text displayed with setText. Use resource string with placeholders.
@@ -261,7 +261,7 @@
layout.addView(tomato);
TextView amt = new TextView(context);
amt.setTextSize(textSize);
amt.setText(nfp.format(item.getCriticRating()/100) + " ");
amt.setText(nfp.format(item.getCriticRating() / 100) + " ");

Check warning

Code scanning / Android Lint

TextView Internationalization Warning

Do not concatenate text displayed with setText. Use resource string with placeholders.
@nielsvanvelzen nielsvanvelzen modified the milestones: v0.17.0, v0.16.5 Feb 11, 2024
@MichaelRUSF MichaelRUSF deleted the Audio_tag_fix_for_multiple_versions branch February 13, 2024 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants