Skip to content

Commit 4dd7209

Browse files
authored
Feature: add new show lost categories beside series and anime (#8308)
* Start with adding tabs / show lists * Add new component sorted-select-list.vue * use component to add/remove and sort the show list categories. * Adjust the filter in home.vue * Add db migrations * Catch issue, where user removes a show lists, which still has shows configured with it. * upmerge * Vueify config-anime.vue * Introduce new app config 'AUTO_ANIME_TO_LIST', which will automatically add the show to the 'anime' showlist, when checked as anime. * Remove app.ANIMESUPPORT, as it's not used anywhere. * Move split home in tabs config item to config-general.vue (interface) * * Remove ANIMESUPPORT. is not used. * Generalized the disabling of "save" button, during netcall. Was not propertly implemented for config-*.vue pages. * Added AUTO_ANIME_TO_LIST variable. * Removed update_anime_support() function (not used anymore) * Removed is_anime_in_show_list() function (not used anymore) * Connect adding 'anime' list to the anime show config anime flag. Only when option "Connect anime to anime list" is enabled. * Update CHANGELOG.md * Reverted css Fixed snapshots Fixed lint * Fixed flake * Fixed config-anime.vue import. * build vendors * bundle runtime * Remove mako
1 parent fe70be4 commit 4dd7209

37 files changed

+1236
-515
lines changed

CHANGELOG.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
## Unreleased
22

33
#### New Features
4-
- Added Search shows by id ([#8058](https://github.com/pymedusa/Medusa/pull/8058))
4+
- Added Search shows by id ([#8308](https://github.com/pymedusa/Medusa/pull/8308))
5+
- Added UI option to create your own show list categories ([#8308](https://github.com/pymedusa/Medusa/pull/8308))
56

67
#### Improvements
8+
- Vueified Home page (Poster, small poster, banner, simple layouts) ([5345](https://github.com/pymedusa/Medusa/pull/5345))
9+
- Vueified Snatch Selection page ([7345](https://github.com/pymedusa/Medusa/pull/7345))
710

811
#### Fixes
912

medusa/__main__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -945,13 +945,13 @@ def initialize(self, console_logging=True):
945945

946946
app.USE_LISTVIEW = bool(check_setting_int(app.CFG, 'General', 'use_listview', 0))
947947

948-
app.ANIMESUPPORT = False
949948
app.USE_ANIDB = bool(check_setting_int(app.CFG, 'ANIDB', 'use_anidb', 0))
950949
app.ANIDB_USERNAME = check_setting_str(app.CFG, 'ANIDB', 'anidb_username', '', censor_log='normal')
951950
app.ANIDB_PASSWORD = check_setting_str(app.CFG, 'ANIDB', 'anidb_password', '', censor_log='low')
952951
app.ANIDB_USE_MYLIST = bool(check_setting_int(app.CFG, 'ANIDB', 'anidb_use_mylist', 0))
953952
app.ANIME_SPLIT_HOME = bool(check_setting_int(app.CFG, 'ANIME', 'anime_split_home', 0))
954953
app.ANIME_SPLIT_HOME_IN_TABS = bool(check_setting_int(app.CFG, 'ANIME', 'anime_split_home_in_tabs', 0))
954+
app.AUTO_ANIME_TO_LIST = bool(check_setting_int(app.CFG, 'ANIME', 'auto_anime_to_list', 0))
955955

956956
app.METADATA_KODI = check_setting_list(app.CFG, 'General', 'metadata_kodi', ['0'] * 10, transform=int)
957957
app.METADATA_KODI_12PLUS = check_setting_list(app.CFG, 'General', 'metadata_kodi_12plus', ['0'] * 10, transform=int)
@@ -1979,6 +1979,7 @@ def save_config():
19791979
new_config['ANIME'] = {}
19801980
new_config['ANIME']['anime_split_home'] = int(app.ANIME_SPLIT_HOME)
19811981
new_config['ANIME']['anime_split_home_in_tabs'] = int(app.ANIME_SPLIT_HOME_IN_TABS)
1982+
new_config['ANIME']['auto_anime_to_list'] = int(app.AUTO_ANIME_TO_LIST)
19821983

19831984
new_config.write()
19841985

medusa/app.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -445,14 +445,14 @@ def __init__(self):
445445
self.NMJ_DATABASE = None
446446
self.NMJ_MOUNT = None
447447

448-
self.ANIMESUPPORT = False
449448
self.USE_ANIDB = False
450449
self.ANIDB_USERNAME = None
451450
self.ANIDB_PASSWORD = None
452451
self.ANIDB_USE_MYLIST = False
453452
self.ADBA_CONNECTION = None
454453
self.ANIME_SPLIT_HOME = False
455454
self.ANIME_SPLIT_HOME_IN_TABS = False
455+
self.AUTO_ANIME_TO_LIST = False
456456

457457
self.USE_SYNOINDEX = False
458458

medusa/databases/main_db.py

+23
Original file line numberDiff line numberDiff line change
@@ -922,3 +922,26 @@ def execute(self):
922922
)
923923

924924
self.inc_minor_version()
925+
926+
927+
class AddShowLists(MoveSceneExceptions):
928+
"""Add show_lists field to tv_shows."""
929+
930+
def test(self):
931+
"""Test if the version is at least 44.16."""
932+
return self.connection.version >= (44, 16)
933+
934+
def execute(self):
935+
utils.backup_database(self.connection.path, self.connection.version)
936+
937+
log.info(u'Addin show_lists field to tv_shows.')
938+
if not self.hasColumn('tv_shows', 'show_lists'):
939+
self.addColumn('tv_shows', 'show_lists', 'text', 'series')
940+
941+
# Shows that are not flagged as anime, put in the anime list
942+
self.connection.action("update tv_shows set show_lists = 'series' where anime = 0")
943+
944+
# Shows that are flagged as anime, put in the anime list
945+
self.connection.action("update tv_shows set show_lists = 'anime' where anime = 1")
946+
947+
self.inc_minor_version()

medusa/helpers/__init__.py

-16
Original file line numberDiff line numberDiff line change
@@ -741,22 +741,6 @@ def fix_set_group_id(child_path):
741741
{'path': child_path, 'gid': parent_gid})
742742

743743

744-
def is_anime_in_show_list():
745-
"""Check if any shows in list contain anime.
746-
747-
:return: True if global showlist contains Anime, False if not
748-
"""
749-
for show in app.showList:
750-
if show.is_anime:
751-
return True
752-
return False
753-
754-
755-
def update_anime_support():
756-
"""Check if we need to support anime, and if we do, enable the feature."""
757-
app.ANIMESUPPORT = is_anime_in_show_list()
758-
759-
760744
def get_absolute_number_from_season_and_episode(series_obj, season, episode):
761745
"""Find the absolute number for a show episode.
762746

medusa/server/api/v2/config.py

+22-2
Original file line numberDiff line numberDiff line change
@@ -460,8 +460,6 @@ class ConfigHandler(BaseRequestHandler):
460460
'layout.wide': BooleanField(app, 'LAYOUT_WIDE'),
461461
'layout.posterSortdir': IntegerField(app, 'POSTER_SORTDIR'),
462462
'layout.themeName': StringField(app, 'THEME_NAME', setter=theme_name_setter),
463-
'layout.animeSplitHomeInTabs': BooleanField(app, 'ANIME_SPLIT_HOME'),
464-
'layout.animeSplitHome': BooleanField(app, 'ANIME_SPLIT_HOME'),
465463
'layout.timezoneDisplay': StringField(app, 'TIMEZONE_DISPLAY'),
466464
'layout.trimZero': BooleanField(app, 'TRIM_ZERO'),
467465
'layout.sortArticle': BooleanField(app, 'SORT_ARTICLE'),
@@ -475,6 +473,15 @@ class ConfigHandler(BaseRequestHandler):
475473
'layout.timeStyle': StringField(app, 'TIME_PRESET_W_SECONDS'),
476474
'layout.dateStyle': StringField(app, 'DATE_PRESET'),
477475
'layout.selectedRootIndex': IntegerField(app, 'SELECTED_ROOT'),
476+
477+
'layout.animeSplitHome': BooleanField(app, 'ANIME_SPLIT_HOME'),
478+
'layout.splitHomeInTabs': BooleanField(app, 'ANIME_SPLIT_HOME_IN_TABS'),
479+
480+
'anime.anidb.enabled': BooleanField(app, 'USE_ANIDB'),
481+
'anime.anidb.username': StringField(app, 'ANIDB_USERNAME'),
482+
'anime.anidb.password': StringField(app, 'ANIDB_PASSWORD'),
483+
'anime.anidb.useMylist': BooleanField(app, 'ANIDB_USE_MYLIST'),
484+
'anime.autoAnimeToList': BooleanField(app, 'AUTO_ANIME_TO_LIST')
478485
}
479486

480487
def get(self, identifier, path_param=None):
@@ -1202,3 +1209,16 @@ def data_layout():
12021209
section_data['selectedRootIndex'] = int_default(app.SELECTED_ROOT, -1) # All paths
12031210

12041211
return section_data
1212+
1213+
@staticmethod
1214+
def data_anime():
1215+
"""Anime configuration."""
1216+
return {
1217+
'anidb': {
1218+
'enabled': bool(app.USE_ANIDB),
1219+
'username': app.ANIDB_USERNAME,
1220+
'password': app.ANIDB_PASSWORD,
1221+
'useMylist': bool(app.ANIDB_USE_MYLIST)
1222+
},
1223+
'autoAnimeToList': bool(app.AUTO_ANIME_TO_LIST)
1224+
}

medusa/server/api/v2/series.py

+1
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ def patch(self, series_slug, path_param=None):
146146
'config.qualities.preferred': ListField(series, 'qualities_preferred'),
147147
'config.qualities.combined': IntegerField(series, 'quality'),
148148
'config.airdateOffset': IntegerField(series, 'airdate_offset'),
149+
'config.showLists': ListField(Series, 'show_lists'),
149150
}
150151

151152
for key, value in iter_nested_items(data):

medusa/server/web/config/anime.py

+6-42
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@
44

55
from __future__ import unicode_literals
66

7-
import os
8-
9-
from medusa import (
10-
app,
11-
config,
12-
logger,
13-
ui,
14-
)
157
from medusa.server.web.config.handler import Config
168
from medusa.server.web.core import PageTemplate
179

@@ -20,44 +12,16 @@
2012

2113
@route('/config/anime(/?.*)')
2214
class ConfigAnime(Config):
23-
"""
24-
Handler for Anime configuration
25-
"""
15+
"""Handler for Anime configuration."""
16+
2617
def __init__(self, *args, **kwargs):
2718
super(ConfigAnime, self).__init__(*args, **kwargs)
2819

2920
def index(self):
3021
"""
31-
Render the Anime configuration page
32-
"""
33-
34-
t = PageTemplate(rh=self, filename='config_anime.mako')
22+
Render the anime configuration page.
3523
36-
return t.render(controller='config', action='anime')
37-
38-
def saveAnime(self, use_anidb=None, anidb_username=None, anidb_password=None, anidb_use_mylist=None,
39-
split_home=None, split_home_in_tabs=None):
40-
"""
41-
Save anime related settings
24+
[Converted to VueRouter]
4225
"""
43-
44-
results = []
45-
46-
app.USE_ANIDB = config.checkbox_to_value(use_anidb)
47-
app.ANIDB_USERNAME = anidb_username
48-
app.ANIDB_PASSWORD = anidb_password
49-
app.ANIDB_USE_MYLIST = config.checkbox_to_value(anidb_use_mylist)
50-
app.ANIME_SPLIT_HOME = config.checkbox_to_value(split_home)
51-
app.ANIME_SPLIT_HOME_IN_TABS = config.checkbox_to_value(split_home_in_tabs)
52-
53-
app.instance.save_config()
54-
55-
if results:
56-
for x in results:
57-
logger.log(x, logger.ERROR)
58-
ui.notifications.error('Error(s) Saving Configuration',
59-
'<br>\n'.join(results))
60-
else:
61-
ui.notifications.message('Configuration Saved', os.path.join(app.CONFIG_FILE))
62-
63-
return self.redirect('/config/anime/')
26+
t = PageTemplate(rh=self, filename='index.mako')
27+
return t.render()

medusa/tv/series.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ def __init__(self, indexer, indexerid, lang='', quality=None,
244244
self.externals = {}
245245
self._cached_indexer_api = None
246246
self.plot = None
247+
self._show_lists = None
247248

248249
other_show = Show.find_by_id(app.showList, self.indexer, self.series_id)
249250
if other_show is not None:
@@ -1494,6 +1495,8 @@ def _load_from_db(self):
14941495
# Load external id's from indexer_mappings table.
14951496
self.externals = load_externals_from_db(self.indexer, self.series_id)
14961497

1498+
self._show_lists = sql_results[0]['show_lists']
1499+
14971500
# Get IMDb_info from database
14981501
main_db_con = db.DBConnection()
14991502
sql_results = main_db_con.select(
@@ -2023,8 +2026,6 @@ def save_to_db(self):
20232026
main_db_con = db.DBConnection()
20242027
main_db_con.upsert('tv_shows', new_value_dict, control_value_dict)
20252028

2026-
helpers.update_anime_support()
2027-
20282029
if self.imdb_id and self.imdb_info.get('year'):
20292030
control_value_dict = {'indexer': self.indexer, 'indexer_id': self.series_id}
20302031
new_value_dict = self.imdb_info
@@ -2158,6 +2159,7 @@ def to_json(self, detailed=False, episodes=False):
21582159
data['config']['release']['ignoredWordsExclude'] = bool(self.rls_ignore_exclude)
21592160
data['config']['release']['requiredWordsExclude'] = bool(self.rls_require_exclude)
21602161
data['config']['airdateOffset'] = self.airdate_offset
2162+
data['config']['showLists'] = self.show_lists
21612163

21622164
# Moved from detailed, as the home page, needs it to display the Xem icon.
21632165
data['xemNumbering'] = numbering_tuple_to_dict(self.xem_numbering)
@@ -2226,6 +2228,15 @@ def qualities_preferred(self, qualities_preferred):
22262228
"""Configure qualities (combined) by adding the preferred qualities to it."""
22272229
self.quality = Quality.combine_qualities(self.qualities_allowed, qualities_preferred)
22282230

2231+
@property
2232+
def show_lists(self):
2233+
"""Return series show lists."""
2234+
return self._show_lists.split(',') if self._show_lists else 'series'
2235+
2236+
@show_lists.setter
2237+
def show_lists(self, show_lists):
2238+
self._show_lists = ','.join(show_lists) if show_lists else 'series'
2239+
22292240
def get_all_possible_names(self, season=-1):
22302241
"""Get every possible variation of the name for a particular show.
22312242

themes-default/slim/package.json

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
"jest/**/@babel/core": "7.11.1"
3232
},
3333
"dependencies": {
34+
"@fortawesome/fontawesome-svg-core": "1.2.30",
35+
"@fortawesome/free-solid-svg-icons": "5.14.0",
36+
"@fortawesome/vue-fontawesome": "0.1.10",
3437
"axios": "0.19.2",
3538
"bootstrap": "3.4.1",
3639
"country-language": "0.1.7",

0 commit comments

Comments
 (0)