diff options
author | morpheus65535 <[email protected]> | 2022-10-05 22:51:54 -0400 |
---|---|---|
committer | morpheus65535 <[email protected]> | 2022-10-05 22:51:54 -0400 |
commit | af70cf1fc9c908494d3d2e5877d9dbfa0cd7a223 (patch) | |
tree | 7dd4c6dc7186277be4db8e3433b86f7805fe4b38 | |
parent | 25b8738c05d16d16e705211d30b5925314086cc3 (diff) | |
download | bazarr-af70cf1fc9c908494d3d2e5877d9dbfa0cd7a223.tar.gz bazarr-af70cf1fc9c908494d3d2e5877d9dbfa0cd7a223.zip |
Added support for series monitored status. #1964v1.1.2-beta.17
-rw-r--r-- | bazarr/api/series/series.py | 1 | ||||
-rw-r--r-- | bazarr/app/database.py | 3 | ||||
-rw-r--r-- | bazarr/app/signalr_client.py | 2 | ||||
-rw-r--r-- | bazarr/sonarr/sync/parser.py | 6 | ||||
-rw-r--r-- | bazarr/sonarr/sync/series.py | 3 | ||||
-rw-r--r-- | frontend/src/pages/Series/index.tsx | 13 | ||||
-rw-r--r-- | frontend/src/pages/views/ItemOverview.tsx | 16 | ||||
-rw-r--r-- | frontend/src/types/api.d.ts | 2 |
8 files changed, 32 insertions, 14 deletions
diff --git a/bazarr/api/series/series.py b/bazarr/api/series/series.py index 891cd4658..849824127 100644 --- a/bazarr/api/series/series.py +++ b/bazarr/api/series/series.py @@ -38,6 +38,7 @@ class Series(Resource): 'episodeMissingCount': fields.Integer(), 'fanart': fields.String(), 'imdbId': fields.String(), + 'monitored': fields.Boolean(), 'overview': fields.String(), 'path': fields.String(), 'poster': fields.String(), diff --git a/bazarr/app/database.py b/bazarr/app/database.py index e8898a404..fd87ce061 100644 --- a/bazarr/app/database.py +++ b/bazarr/app/database.py @@ -215,6 +215,7 @@ class TableShows(BaseModel): audio_language = TextField(null=True) fanart = TextField(null=True) imdbId = TextField(default='""', null=True) + monitored = TextField(null=True) overview = TextField(null=True) path = TextField(unique=True) poster = TextField(null=True) @@ -302,6 +303,7 @@ def migrate_db(): migrator.add_column('table_shows', 'seriesType', TextField(default='""', null=True)), migrator.add_column('table_shows', 'imdbId', TextField(default='""', null=True)), migrator.add_column('table_shows', 'profileId', IntegerField(null=True)), + migrator.add_column('table_shows', 'monitored', TextField(null=True)), migrator.add_column('table_episodes', 'format', TextField(null=True)), migrator.add_column('table_episodes', 'resolution', TextField(null=True)), migrator.add_column('table_episodes', 'video_codec', TextField(null=True)), @@ -384,6 +386,7 @@ def get_exclusion_clause(exclusion_type): monitoredOnly = settings.sonarr.getboolean('only_monitored') if monitoredOnly: where_clause.append((TableEpisodes.monitored == 'True')) + where_clause.append((TableShows.monitored == 'True')) else: monitoredOnly = settings.radarr.getboolean('only_monitored') if monitoredOnly: diff --git a/bazarr/app/signalr_client.py b/bazarr/app/signalr_client.py index 0d3693841..3fd5c4e29 100644 --- a/bazarr/app/signalr_client.py +++ b/bazarr/app/signalr_client.py @@ -13,6 +13,7 @@ from collections import deque from time import sleep from constants import headers +from app.event_handler import event_stream from sonarr.sync.episodes import sync_episodes, sync_one_episode from sonarr.sync.series import update_series, update_one_series from radarr.sync.movies import update_movies, update_one_movie @@ -274,6 +275,7 @@ def dispatcher(data): except Exception as e: logging.debug('BAZARR an exception occurred while parsing SignalR feed: {}'.format(repr(e))) finally: + event_stream(type='badges') return diff --git a/bazarr/sonarr/sync/parser.py b/bazarr/sonarr/sync/parser.py index 6c8613d8f..b464062fd 100644 --- a/bazarr/sonarr/sync/parser.py +++ b/bazarr/sonarr/sync/parser.py @@ -52,7 +52,8 @@ def seriesParser(show, action, tags_dict, serie_default_profile, audio_profiles) 'alternateTitles': alternate_titles, 'tags': str(tags), 'seriesType': show['seriesType'], - 'imdbId': imdbId} + 'imdbId': imdbId, + 'monitored': str(bool(show['monitored']))} else: return {'title': show["title"], 'path': show["path"], @@ -68,7 +69,8 @@ def seriesParser(show, action, tags_dict, serie_default_profile, audio_profiles) 'tags': str(tags), 'seriesType': show['seriesType'], 'imdbId': imdbId, - 'profileId': serie_default_profile} + 'profileId': serie_default_profile, + 'monitored': str(bool(show['monitored']))} def profile_id_to_language(id_, profiles): diff --git a/bazarr/sonarr/sync/series.py b/bazarr/sonarr/sync/series.py index 30a18f2f2..a61ebe34f 100644 --- a/bazarr/sonarr/sync/series.py +++ b/bazarr/sonarr/sync/series.py @@ -100,7 +100,8 @@ def update_series(send_event=True): TableShows.alternateTitles, TableShows.tags, TableShows.seriesType, - TableShows.imdbId).dicts() + TableShows.imdbId, + TableShows.monitored).dicts() for item in series_in_db: series_in_db_list.append(item) diff --git a/frontend/src/pages/Series/index.tsx b/frontend/src/pages/Series/index.tsx index 3237f9da7..6dfe07230 100644 --- a/frontend/src/pages/Series/index.tsx +++ b/frontend/src/pages/Series/index.tsx @@ -6,7 +6,9 @@ import { ItemEditModal } from "@/components/forms/ItemEditForm"; import { useModals } from "@/modules/modals"; import ItemView from "@/pages/views/ItemView"; import { useTableStyles } from "@/styles"; -import { faWrench } from "@fortawesome/free-solid-svg-icons"; +import { faBookmark as farBookmark } from "@fortawesome/free-regular-svg-icons"; +import { faBookmark, faWrench } from "@fortawesome/free-solid-svg-icons"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { Anchor, Container, Progress } from "@mantine/core"; import { useDocumentTitle } from "@mantine/hooks"; import { FunctionComponent, useMemo } from "react"; @@ -21,6 +23,15 @@ const SeriesView: FunctionComponent = () => { const columns: Column<Item.Series>[] = useMemo<Column<Item.Series>[]>( () => [ { + accessor: "monitored", + Cell: ({ value }) => ( + <FontAwesomeIcon + title={value ? "monitored" : "unmonitored"} + icon={value ? faBookmark : farBookmark} + ></FontAwesomeIcon> + ), + }, + { Header: "Name", accessor: "title", Cell: ({ row, value }) => { diff --git a/frontend/src/pages/views/ItemOverview.tsx b/frontend/src/pages/views/ItemOverview.tsx index 43d97b3e0..02a847878 100644 --- a/frontend/src/pages/views/ItemOverview.tsx +++ b/frontend/src/pages/views/ItemOverview.tsx @@ -1,5 +1,5 @@ import { Language } from "@/components/bazarr"; -import { BuildKey, isMovie } from "@/utilities"; +import { BuildKey } from "@/utilities"; import { useLanguageProfileBy, useProfileItemsToLanguages, @@ -165,14 +165,12 @@ const ItemOverview: FunctionComponent<Props> = (props) => { <Group align="flex-start" noWrap className={classes.group}> <Title my={0}> <Text inherit color="white"> - {item && isMovie(item) ? ( - <Box component="span" mr={12}> - <FontAwesomeIcon - title={item.monitored ? "monitored" : "unmonitored"} - icon={item.monitored ? faBookmark : farBookmark} - ></FontAwesomeIcon> - </Box> - ) : null} + <Box component="span" mr={12}> + <FontAwesomeIcon + title={item?.monitored ? "unmonitored" : "monitored"} + icon={item?.monitored ? faBookmark : farBookmark} + ></FontAwesomeIcon> + </Box> {item?.title} </Text> </Title> diff --git a/frontend/src/types/api.d.ts b/frontend/src/types/api.d.ts index 5451fe71b..933d2c408 100644 --- a/frontend/src/types/api.d.ts +++ b/frontend/src/types/api.d.ts @@ -109,6 +109,7 @@ declare namespace Item { type Base = PathType & TitleType & TagType & + MonitoredType & AudioLanguageType & { profileId: number | null; fanart: string; @@ -130,7 +131,6 @@ declare namespace Item { type Movie = Base & MovieIdType & - MonitoredType & SubtitleType & MissingSubtitleType & SceneNameType & { |