Commit 2afbbf6f authored by echel0n's avatar echel0n

Revert "Refactored main shows page to load shows via web sockets."

This reverts commit 828d5f75
parent b3fcd78a
......@@ -62,7 +62,7 @@ from sickrage.core.webserver.handlers.home import HomeHandler, IsAliveHandler, T
DeleteShowHandler, RefreshShowHandler, UpdateShowHandler, SubtitleShowHandler, UpdateKODIHandler, UpdatePLEXHandler, \
UpdateEMBYHandler, SyncTraktHandler, DeleteEpisodeHandler, SetStatusHandler, TestRenameHandler, DoRenameHandler, \
SearchEpisodeHandler, GetManualSearchStatusHandler, SearchEpisodeSubtitlesHandler, \
SetSceneNumberingHandler, LoadShows
SetSceneNumberingHandler
from sickrage.core.webserver.handlers.home.add_shows import HomeAddShowsHandler, SearchIndexersForShowNameHandler, \
MassAddTableHandler, NewShowHandler, TraktShowsHandler, PopularShowsHandler, AddShowToBlacklistHandler, \
ExistingShowsHandler, AddShowByIDHandler, AddNewShowHandler, AddExistingShowsHandler
......@@ -243,7 +243,6 @@ class WebServer(object):
(r'%s/browser(/?)' % sickrage.app.config.web_root, WebFileBrowserHandler),
(r'%s/browser/complete(/?)' % sickrage.app.config.web_root, WebFileBrowserCompleteHandler),
(r'%s/home(/?)' % sickrage.app.config.web_root, HomeHandler),
(r'%s/home/loadShows(/?)' % sickrage.app.config.web_root, LoadShows),
(r'%s/home/is_alive(/?)' % sickrage.app.config.web_root, IsAliveHandler),
(r'%s/home/testSABnzbd(/?)' % sickrage.app.config.web_root, TestSABnzbdHandler),
(r'%s/home/testTorrent(/?)' % sickrage.app.config.web_root, TestTorrentHandler),
......
......@@ -85,6 +85,8 @@ class HomeHandler(BaseHandler, ABC):
if not get_show_list().count():
return self.redirect('/home/addShows/')
self.run_task(self.load_shows, ui_modules=self.ui)
# showlists = OrderedDict({'Shows': []})
# if sickrage.app.config.anime_split_home:
# for show in sorted(get_show_list(), key=cmp_to_key(lambda x, y: x.name < y.name)):
......@@ -106,6 +108,27 @@ class HomeHandler(BaseHandler, ABC):
action='index'
)
def load_shows(self, ui_modules):
show_count = get_show_list().count()
shows_loading = [int(x['indexer_id']) for x in sickrage.app.show_queue.loading_show_list]
for show in get_show_list(session=self.db_session):
if sickrage.app.config.home_layout == 'poster':
WebSocketMessage('show', {'action': ('show_grid_append', 'show_grid_prepend')[show.indexer_id in shows_loading],
'show_count': show_count,
'item': self.render_string("/templates/show-container-grid.mako", show=show, is_anime=show.is_anime,
is_loading=show.indexer_id in shows_loading, ui_modules=ui_modules)}).push()
else:
WebSocketMessage('show', {'action': ('show_list_append', 'show_list_prepend')[show.indexer_id in shows_loading],
'show_count': show_count,
'item': self.render_string("/templates/show-container-list.mako", show=show, is_anime=show.is_anime,
is_loading=show.indexer_id in shows_loading, ui_modules=ui_modules)}).push()
if sickrage.app.config.home_layout == 'poster':
WebSocketMessage('show', {'action': 'load_show_grid'}).push()
else:
WebSocketMessage('show', {'action': 'load_show_list'}).push()
def statistics(self):
show_stat = {}
......@@ -150,30 +173,6 @@ class HomeHandler(BaseHandler, ABC):
return show_stat, overall_stats
class LoadShows(BaseHandler, ABC):
@authenticated
async def get(self, *args, **kwargs):
show_count = get_show_list().count()
shows_loading = [int(x['indexer_id']) for x in sickrage.app.show_queue.loading_show_list]
for show in get_show_list(session=self.db_session):
if sickrage.app.config.home_layout == 'poster':
WebSocketMessage('show', {'action': ('show_grid_append', 'show_grid_prepend')[show.indexer_id in shows_loading],
'show_count': show_count,
'item': self.render_string("/templates/show-container-grid.mako", show=show, is_anime=show.is_anime,
is_loading=show.indexer_id in shows_loading)}).push()
else:
WebSocketMessage('show', {'action': ('show_list_append', 'show_list_prepend')[show.indexer_id in shows_loading],
'show_count': show_count,
'item': self.render_string("/templates/show-container-list.mako", show=show, is_anime=show.is_anime,
is_loading=show.indexer_id in shows_loading)}).push()
if sickrage.app.config.home_layout == 'poster':
WebSocketMessage('show', {'action': 'load_show_grid'}).push()
else:
WebSocketMessage('show', {'action': 'load_show_list'}).push()
class IsAliveHandler(BaseHandler, ABC):
def get(self, *args, **kwargs):
self.set_header('Content-Type', 'text/javascript')
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -66,5 +66,4 @@ class WebSocketMessage(object):
sleep(0.1)
for client in clients:
sleep(0.1)
sickrage.app.io_loop.add_callback(client.write_message, self.json())
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment