Skip to content

Commit

Permalink
Add a new notification center to the UI
Browse files Browse the repository at this point in the history
  • Loading branch information
LASER-Yi committed Aug 15, 2021
1 parent 56729e0 commit d7533ba
Show file tree
Hide file tree
Showing 15 changed files with 295 additions and 247 deletions.
6 changes: 0 additions & 6 deletions bazarr/get_episodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,6 @@ def sync_episodes(series_id=None, send_event=True):
episodes_to_add.append(episodeParser(episode))

if send_event:
show_progress(id='episodes_progress',
header='Syncing episodes...',
name='Completed successfully',
value=series_count,
count=series_count)

hide_progress(id='episodes_progress')

# Remove old episodes from DB
Expand Down
8 changes: 1 addition & 7 deletions bazarr/get_movies.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,8 @@ def update_movies(send_event=True):
tags_dict=tagsDict,
movie_default_profile=movie_default_profile,
audio_profiles=audio_profiles))

if send_event:
show_progress(id='movies_progress',
header='Syncing movies...',
name='Completed successfully',
value=movies_count,
count=movies_count)

hide_progress(id='movies_progress')

# Remove old movies from DB
Expand Down
6 changes: 0 additions & 6 deletions bazarr/get_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,6 @@ def update_series(send_event=True):
audio_profiles=audio_profiles))

if send_event:
show_progress(id='series_progress',
header='Syncing series...',
name='Completed successfully',
value=series_count,
count=series_count)

hide_progress(id='series_progress')

# Remove old series from DB
Expand Down
38 changes: 0 additions & 38 deletions bazarr/get_subtitle.py
Original file line number Diff line number Diff line change
Expand Up @@ -796,13 +796,6 @@ def series_download_subtitles(no):
logging.info("BAZARR All providers are throttled")
break

if count_episodes_details:
show_progress(id='series_search_progress_{}'.format(no),
header='Searching missing subtitles...',
name='Completed successfully',
value=count_episodes_details,
count=count_episodes_details)

hide_progress(id='series_search_progress_{}'.format(no))


Expand Down Expand Up @@ -975,13 +968,6 @@ def movies_download_subtitles(no):
logging.info("BAZARR All providers are throttled")
break

if count_movie:
show_progress(id='movie_search_progress_{}'.format(no),
header='Searching missing subtitles...',
name='Completed successfully',
value=count_movie,
count=count_movie)

hide_progress(id='movie_search_progress_{}'.format(no))


Expand Down Expand Up @@ -1189,12 +1175,6 @@ def wanted_search_missing_subtitles_series():
logging.info("BAZARR All providers are throttled")
return

show_progress(id='wanted_episodes_progress',
header='Searching subtitles...',
name='Completed successfully',
value=count_episodes,
count=count_episodes)

hide_progress(id='wanted_episodes_progress')

logging.info('BAZARR Finished searching for missing Series Subtitles. Check History for more information.')
Expand Down Expand Up @@ -1226,12 +1206,6 @@ def wanted_search_missing_subtitles_movies():
logging.info("BAZARR All providers are throttled")
return

show_progress(id='wanted_movies_progress',
header='Searching subtitles...',
name='Completed successfully',
value=count_movies,
count=count_movies)

hide_progress(id='wanted_movies_progress')

logging.info('BAZARR Finished searching for missing Movies Subtitles. Check History for more information.')
Expand Down Expand Up @@ -1559,12 +1533,6 @@ def upgrade_subtitles():
language_code, provider, score, subs_id, subs_path)
send_notifications(episode['sonarrSeriesId'], episode['sonarrEpisodeId'], message)

show_progress(id='upgrade_episodes_progress',
header='Upgrading episodes subtitles...',
name='Completed successfully',
value=count_episode_to_upgrade,
count=count_episode_to_upgrade)

hide_progress(id='upgrade_episodes_progress')

if settings.general.getboolean('use_radarr'):
Expand Down Expand Up @@ -1632,12 +1600,6 @@ def upgrade_subtitles():
history_log_movie(3, movie['radarrId'], message, path, language_code, provider, score, subs_id, subs_path)
send_notifications_movie(movie['radarrId'], message)

show_progress(id='upgrade_movies_progress',
header='Upgrading movies subtitles...',
name='Completed successfully',
value=count_movie_to_upgrade,
count=count_movie_to_upgrade)

hide_progress(id='upgrade_movies_progress')

logging.info('BAZARR Finished searching for Subtitles to upgrade. Check History for more information.')
Expand Down
12 changes: 0 additions & 12 deletions bazarr/list_subtitles.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,12 +458,6 @@ def series_full_scan_subtitles():
count=count_episodes)
store_subtitles(episode['path'], path_mappings.path_replace(episode['path']))

show_progress(id='episodes_disk_scan',
header='Full disk scan...',
name='Completed successfully',
value=count_episodes,
count=count_episodes)

hide_progress(id='episodes_disk_scan')

gc.collect()
Expand All @@ -482,12 +476,6 @@ def movies_full_scan_subtitles():
count=count_movies)
store_subtitles_movie(movie['path'], path_mappings.path_replace_movie(movie['path']))

show_progress(id='movies_disk_scan',
header='Full disk scan...',
name='Completed successfully',
value=count_movies,
count=count_movies)

hide_progress(id='movies_disk_scan')

gc.collect()
Expand Down
9 changes: 5 additions & 4 deletions frontend/src/@redux/actions/site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ export const siteRemoveNotifications = createAction<string>(
"site/notifications/remove"
);

export const siteAddProgress = createAction<Server.Progress[]>(
"site/progress/add"
);
export const siteAddProgress =
createAction<Server.Progress[]>("site/progress/add");

export const siteRemoveProgress = createAction<string>("site/progress/remove");
export const siteRemoveProgress = createAction<string[]>(
"site/progress/remove"
);

export const siteChangeSidebar = createAction<string>("site/sidebar/update");

Expand Down
4 changes: 2 additions & 2 deletions frontend/src/@redux/reducers/site.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createReducer } from "@reduxjs/toolkit";
import { remove, uniqBy } from "lodash";
import { pullAllWith, remove, uniqBy } from "lodash";
import apis from "../../apis";
import {
siteAddNotifications,
Expand Down Expand Up @@ -73,7 +73,7 @@ const reducer = createReducer(defaultSite, (builder) => {
);
})
.addCase(siteRemoveProgress, (state, action) => {
remove(state.progress, (n) => n.id === action.payload);
pullAllWith(state.progress, action.payload, (l, r) => l.id === r);
})
.addCase(siteChangeSidebar, (state, action) => {
state.sidebar = action.payload;
Expand Down
4 changes: 1 addition & 3 deletions frontend/src/@socketio/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@ export function createDefaultReducer(): SocketIO.Reducer[] {
update: bindReduxAction(siteAddProgress),
delete: (ids) => {
setTimeout(() => {
ids.forEach((id) => {
reduxStore.dispatch(siteRemoveProgress(id));
});
reduxStore.dispatch(siteRemoveProgress(ids));
}, 3 * 1000);
},
},
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/App/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { SystemApi } from "../apis";
import { ActionButton, SearchBar, SearchResult } from "../components";
import { useGotoHomepage } from "../utilites";
import "./header.scss";
import NotificationCenter from "./Notification";

async function SearchItem(text: string) {
const results = await SystemApi.search(text);
Expand Down Expand Up @@ -58,7 +59,7 @@ const Header: FunctionComponent<Props> = () => {

const offline = useIsOffline();

const dropdown = useMemo(
const serverActions = useMemo(
() => (
<Dropdown alignRight>
<Dropdown.Toggle className="dropdown-hidden" as={Button}>
Expand Down Expand Up @@ -117,6 +118,7 @@ const Header: FunctionComponent<Props> = () => {
<SearchBar onSearch={SearchItem}></SearchBar>
</Col>
<Col className="d-flex flex-row align-items-center justify-content-end pr-2">
<NotificationCenter></NotificationCenter>
<Button
href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XHHRWXT9YB7WE&source=url"
target="_blank"
Expand All @@ -134,7 +136,7 @@ const Header: FunctionComponent<Props> = () => {
Connecting...
</ActionButton>
) : (
dropdown
serverActions
)}
</Col>
</Row>
Expand Down

0 comments on commit d7533ba

Please sign in to comment.