Skip to content

Commit

Permalink
Provider filter: add filter_local column to watch providers.
Browse files Browse the repository at this point in the history
  • Loading branch information
UweTrottmann committed Feb 2, 2024
1 parent 613875b commit bfdc9d5
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"formatVersion": 1,
"database": {
"version": 52,
"identityHash": "9673c86af9da24ea4d043f602f71b9ee",
"identityHash": "370f7a37b1f61520657ec12a805f3b9f",
"entities": [
{
"tableName": "series",
Expand Down Expand Up @@ -1472,7 +1472,7 @@
},
{
"tableName": "sg_watch_provider",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`_id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `provider_name` TEXT NOT NULL, `display_priority` INTEGER NOT NULL, `logo_path` TEXT NOT NULL, `type` INTEGER NOT NULL, `enabled` INTEGER NOT NULL)",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`_id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `provider_name` TEXT NOT NULL, `display_priority` INTEGER NOT NULL, `logo_path` TEXT NOT NULL, `type` INTEGER NOT NULL, `enabled` INTEGER NOT NULL, `filter_local` INTEGER NOT NULL DEFAULT false)",
"fields": [
{
"fieldPath": "_id",
Expand Down Expand Up @@ -1515,6 +1515,13 @@
"columnName": "enabled",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "filter_local",
"columnName": "filter_local",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "false"
}
],
"primaryKey": {
Expand Down Expand Up @@ -1604,7 +1611,7 @@
"views": [],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '9673c86af9da24ea4d043f602f71b9ee')"
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '370f7a37b1f61520657ec12a805f3b9f')"
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ import timber.log.Timber
),
AutoMigration(
from = SgRoomDatabase.VERSION_51_CUSTOM_RELEASE_TIME,
to = SgRoomDatabase.VERSION_52_PROVIDER_AND_GENRE_FILTERS
to = SgRoomDatabase.VERSION_52_WATCH_PROVIDER_FILTERS
)
]
)
Expand Down Expand Up @@ -123,8 +123,13 @@ abstract class SgRoomDatabase : RoomDatabase() {
* Add custom release time, day offset and time zone to shows.
*/
const val VERSION_51_CUSTOM_RELEASE_TIME = 51
const val VERSION_52_PROVIDER_AND_GENRE_FILTERS = 52
const val VERSION = VERSION_52_PROVIDER_AND_GENRE_FILTERS

/**
* - Add [SgWatchProviderShowMapping]
* - Add [SgWatchProvider.filter_local]
*/
const val VERSION_52_WATCH_PROVIDER_FILTERS = 52
const val VERSION = VERSION_52_WATCH_PROVIDER_FILTERS

@Volatile
private var instance: SgRoomDatabase? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

package com.battlelancer.seriesguide.streaming

import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.Index
import androidx.room.PrimaryKey
Expand All @@ -29,7 +30,17 @@ data class SgWatchProvider(
* to duplicates, but allows a different enabled set for shows than for movies.
*/
val type: Int,
val enabled: Boolean
/**
* If discover results should be filtered by this provider.
*/
val enabled: Boolean,
/**
* If local shows or movies should be filtered by this provider.
*
* Added with [com.battlelancer.seriesguide.provider.SgRoomDatabase.VERSION_52_WATCH_PROVIDER_FILTERS].
*/
@ColumnInfo(defaultValue = "false")
val filter_local: Boolean = false
) {
enum class Type(val id: Int) {
SHOWS(1),
Expand Down

0 comments on commit bfdc9d5

Please sign in to comment.