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

Replace ItemQuery with GetItemsRequest #3654

Merged
merged 5 commits into from
Jun 9, 2024

Conversation

nielsvanvelzen
Copy link
Member

@nielsvanvelzen nielsvanvelzen commented Jun 8, 2024

There are probably some bugs in this one...

Changes

  • Replace ItemQuery with GetItemsRequest
  • Rewrite GenericFolderFragment and CollectionFragment in Kotlin
  • Fully remove ApiClient from ItemRowAdapter 🎉
  • Fix item update magic code clearing everything
  • Optimize item updating by using collection instead of array
  • Fix crash when opening Live TV recordings user view
  • Remove StdItemQuery

Behavior of the "New premieres" row is slightly changed to make it more efficient and consume less API resources. It still does some client side filtering that can be removed once Jellyfin 10.10 is released (requires jellyfin/jellyfin#12027).

Issues

@nielsvanvelzen nielsvanvelzen added sdk-migration To fix this we need to migrate some code to the new SDK refactor Improvements to code realiability, readability and quality labels Jun 8, 2024
@nielsvanvelzen nielsvanvelzen added this to the v0.17.0 milestone Jun 8, 2024
@nielsvanvelzen
Copy link
Member Author

With this the only places left using the legacy ApiClient are:

  • Old playback code
  • Most Live TV related UI
  • A few browsing related places (like KeyProcessor)

Additionally we still use some of the utility classes like Response<T> that needs cleaning.

Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Android Lint found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

ItemFields.CHILD_COUNT,
),
)
rows.add(BrowseRowDef(genre.name, itemsRequest, 40))

Check warning

Code scanning / detekt

Report magic numbers. Magic number is a numeric literal that is not defined as a constant and hence it's unclear what the purpose of this number is. It's better to declare such numbers as constants and give them a proper name. By default, -1, 0, 1, and 2 are not considered to be magic numbers. Warning

This expression contains a magic number. Consider defining it to a well named constant.
parentId = mFolder.id,
includeItemTypes = setOf(BaseItemKind.MOVIE),
)
mRows.add(BrowseRowDef(getString(R.string.lbl_movies), movies, 100))

Check warning

Code scanning / detekt

Report magic numbers. Magic number is a numeric literal that is not defined as a constant and hence it's unclear what the purpose of this number is. It's better to declare such numbers as constants and give them a proper name. By default, -1, 0, 1, and 2 are not considered to be magic numbers. Warning

This expression contains a magic number. Consider defining it to a well named constant.
parentId = mFolder.id,
includeItemTypes = setOf(BaseItemKind.SERIES),
)
mRows.add(BrowseRowDef(getString(R.string.lbl_tv_series), series, 100))

Check warning

Code scanning / detekt

Report magic numbers. Magic number is a numeric literal that is not defined as a constant and hence it's unclear what the purpose of this number is. It's better to declare such numbers as constants and give them a proper name. By default, -1, 0, 1, and 2 are not considered to be magic numbers. Warning

This expression contains a magic number. Consider defining it to a well named constant.
parentId = mFolder.id,
excludeItemTypes = setOf(BaseItemKind.MOVIE, BaseItemKind.SERIES),
)
mRows.add(BrowseRowDef(getString(R.string.lbl_other), others, 100))

Check warning

Code scanning / detekt

Report magic numbers. Magic number is a numeric literal that is not defined as a constant and hence it's unclear what the purpose of this number is. It's better to declare such numbers as constants and give them a proper name. By default, -1, 0, 1, and 2 are not considered to be magic numbers. Warning

This expression contains a magic number. Consider defining it to a well named constant.
else -> getString(R.string.lbl_by_name)
}

mRows.add(BrowseRowDef(header, byName, 100))

Check warning

Code scanning / detekt

Report magic numbers. Magic number is a numeric literal that is not defined as a constant and hence it's unclear what the purpose of this number is. It's better to declare such numbers as constants and give them a proper name. By default, -1, 0, 1, and 2 are not considered to be magic numbers. Warning

This expression contains a magic number. Consider defining it to a well named constant.
),
)

rows.add(BrowseRowDef("#", numbersItemsRequest, 40))

Check warning

Code scanning / detekt

Report magic numbers. Magic number is a numeric literal that is not defined as a constant and hence it's unclear what the purpose of this number is. It's better to declare such numbers as constants and give them a proper name. By default, -1, 0, 1, and 2 are not considered to be magic numbers. Warning

This expression contains a magic number. Consider defining it to a well named constant.
),
)

rows.add(BrowseRowDef(letter.toString(), letterItemsRequest, 40))

Check warning

Code scanning / detekt

Report magic numbers. Magic number is a numeric literal that is not defined as a constant and hence it's unclear what the purpose of this number is. It's better to declare such numbers as constants and give them a proper name. By default, -1, 0, 1, and 2 are not considered to be magic numbers. Warning

This expression contains a magic number. Consider defining it to a well named constant.
@nielsvanvelzen nielsvanvelzen merged commit 8d12542 into jellyfin:master Jun 9, 2024
6 checks passed
@nielsvanvelzen nielsvanvelzen deleted the itemquery branch June 9, 2024 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Improvements to code realiability, readability and quality sdk-migration To fix this we need to migrate some code to the new SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant