Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Recommended shows version 2 #5782

Merged
merged 86 commits into from
Aug 7, 2021
Merged
Changes from 1 commit
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
06eb0fd
* Cache recommended shows in ShowUpdater
p0psicles Nov 10, 2018
4b42002
Added recommended shows to store.
p0psicles Nov 25, 2018
dfd5058
Added templates.
p0psicles Nov 25, 2018
488f80b
* Fixed getting recommended shows from Imdb
p0psicles Nov 26, 2018
a8b7aec
Removed debuggers.
p0psicles Nov 26, 2018
c5011d9
Implemented external id's for the recommended shows.
p0psicles Nov 26, 2018
7b06255
Changed recommended store.
p0psicles Dec 3, 2018
3c7545d
Created a generic update queue, as a thread that can be used
p0psicles Dec 8, 2018
1992f7d
Added basic functionality of adding a show, from recommended show.
p0psicles Dec 16, 2018
be2680d
Merge remote-tracking branch 'remotes/origin/develop' into feature/re…
p0psicles Dec 16, 2018
4781832
Fix set local vue variable selectedShowOptions from the add-show-opti…
p0psicles Dec 16, 2018
5410a87
Merge remote-tracking branch 'origin/develop' into feature/rec-show-v2
p0psicles Dec 23, 2018
1152841
Fixed some post merge conflicts.
p0psicles Dec 23, 2018
d1088f4
Fixed some post merge conflicts.
p0psicles Dec 23, 2018
3e95527
Merge remote-tracking branch 'origin/develop' into feature/rec-show-v2
p0psicles Jan 12, 2019
e5a2483
Implemented isotope sorting.
p0psicles Jan 13, 2019
b3a253f
Add the ability to add a recommended show by multiple indexers.
p0psicles Jan 13, 2019
f51b5ad
Added filter option.
p0psicles Jan 13, 2019
b6458dc
When adding shows, update the mapped_indexer and mapped_series_id in …
p0psicles Jan 13, 2019
9b070ee
Handle exceptions for when there is no connectivity.
p0psicles Jan 13, 2019
087e8ea
Merge remote-tracking branch 'remotes/origin/develop' into feature/re…
p0psicles Sep 25, 2019
9396434
Fixed rebase conflicts.
p0psicles Oct 4, 2019
df7240c
Merge remote-tracking branch 'origin/develop' into feature/rec-show-v2
p0psicles Jul 9, 2021
b8da32a
Fix after merge conflicts
p0psicles Jul 9, 2021
7160d43
Add recommended.vue to index export
p0psicles Jul 9, 2021
b03e75a
Fix recommended.vue component
p0psicles Jul 10, 2021
a40aa62
Fix adding shows from recommended.vue
p0psicles Jul 10, 2021
b8c957b
mappedIndexer is not used.
p0psicles Jul 10, 2021
17cfb2c
runtime
p0psicles Jul 10, 2021
21bc723
Added field 'added' for adding a date.
p0psicles Jul 11, 2021
63e0c8c
Store recommended lists (subcats) in indexers/config.py
p0psicles Jul 11, 2021
ed8549d
Use indexers/config/indexers.js recommendedLists definition.
p0psicles Jul 11, 2021
64ffcb6
Use subcat, to specify the recommended list.
p0psicles Jul 11, 2021
83d6da3
Separated source and list. For ex. Source = trakt, List = popular.
p0psicles Jul 11, 2021
ccbabd1
Added trakt-authentication.vue component.
p0psicles Jul 13, 2021
f2a51b3
add feature: Route to add-new-show.vue
p0psicles Jul 13, 2021
6f7dd7d
Generate source->categories from recommeded table.
p0psicles Jul 13, 2021
34f6bc2
Added myAnimeList
p0psicles Jul 13, 2021
c2f41a4
Calculate three seasons for myanimelist (-3 months, now and + 3 months.
p0psicles Jul 16, 2021
376e739
Improved styling
p0psicles Jul 16, 2021
45551e3
Added button to start search for now shows, if list is empty.
p0psicles Jul 16, 2021
61a9d7f
Improved error handling / reporting
p0psicles Jul 17, 2021
00e6c18
Improved feedback
p0psicles Jul 17, 2021
1d0092e
Added config option for setting the recommended show update hour.
p0psicles Jul 17, 2021
356bcdd
Added feature to select individual trakt lists for caching.
p0psicles Jul 20, 2021
ad73335
Fix removed_from_medusa function.
p0psicles Jul 21, 2021
f48eaf6
Add the class "removed-from-medusa", but don't use it just yet.
p0psicles Jul 21, 2021
53fe37f
Pass force.
p0psicles Jul 23, 2021
2695972
Merge remote-tracking branch 'origin/develop' into feature/rec-show-v2
p0psicles Jul 23, 2021
64f0059
imdb: use tmdb api to get tvdb and tmdb id's.
p0psicles Jul 23, 2021
0859b28
Catch connection error utorrent
p0psicles Jul 25, 2021
00b619c
fix linting
p0psicles Jul 25, 2021
e340497
fix lint-css
p0psicles Jul 25, 2021
b5534a9
Merge remote-tracking branch 'origin/develop' into feature/rec-show-v2
p0psicles Jul 25, 2021
a120781
get genres when possible (not for anidb)
p0psicles Jul 25, 2021
c5e9c6a
Added support for Recommended list source anilist.co
p0psicles Jul 30, 2021
806a3ad
Disable selects until shows loaded.
p0psicles Jul 30, 2021
278bc0e
Adding loading notification
p0psicles Jul 30, 2021
e3493de
Add genres.
p0psicles Jul 30, 2021
c99edd4
also disable list select.
p0psicles Jul 30, 2021
cc5c173
restore check-overlay
p0psicles Jul 30, 2021
19c1d18
Clean up empty genres for anidb.
p0psicles Jul 30, 2021
665c620
Add save button, so you can enable trakt from the component.
p0psicles Aug 3, 2021
a3eeed6
Remove myanimelist references
p0psicles Aug 4, 2021
e1bf0ff
mvt adba
p0psicles Aug 4, 2021
261d70d
Added plot information to recommended shows.
p0psicles Aug 5, 2021
ff484d3
Moved recommended shows to dedicated database.
p0psicles Aug 5, 2021
9b18c3f
one to many underscore
p0psicles Aug 5, 2021
71993f7
fix lint
p0psicles Aug 6, 2021
f637e2c
fix pytest
p0psicles Aug 6, 2021
e514ab8
pylint
p0psicles Aug 6, 2021
fa53e86
Fix lint issue
p0psicles Aug 6, 2021
9708559
Merge remote-tracking branch 'origin/develop' into feature/rec-show-v2
p0psicles Aug 6, 2021
f9f8f3d
Yarn dev
p0psicles Aug 6, 2021
2b3dd16
Remove unused mako.
p0psicles Aug 6, 2021
c65bdbd
Merge branch 'feature/rec-show-v2' of https://github.com/pymedusa/Med…
p0psicles Aug 6, 2021
b207ff3
Remove more unused mako.
p0psicles Aug 6, 2021
2e9421d
Merge remote-tracking branch 'origin/develop' into feature/rec-show-v2
p0psicles Aug 7, 2021
714c70b
Update changelog
p0psicles Aug 7, 2021
27a6220
update changelog
p0psicles Aug 7, 2021
9a19f1c
build runtime
p0psicles Aug 7, 2021
ce0759a
update changelog
p0psicles Aug 7, 2021
34bd96c
Fix jest tests (snapshots)
p0psicles Aug 7, 2021
6d04afc
Merge branch 'feature/rec-show-v2' of https://github.com/pymedusa/Med…
p0psicles Aug 7, 2021
5567c23
Don't comment, but xit test.
p0psicles Aug 7, 2021
306a5fd
use it.skip in stead
p0psicles Aug 7, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Implemented isotope sorting.
p0psicles committed Jan 13, 2019
commit e5a248324056cbda71450a66eeca84bd9025dc36
2 changes: 1 addition & 1 deletion medusa/app.py
Original file line number Diff line number Diff line change
@@ -672,7 +672,7 @@ def __init__(self):

# show updater recommeded show caching
self.CACHE_RECOMMENDED_SHOWS = True
self.CACHE_RECOMMENDED_TRAKT = False
self.CACHE_RECOMMENDED_TRAKT = True
self.CACHE_RECOMMENDED_IMDB = False
self.CACHE_RECOMMENDED_ANIDB = True

8 changes: 4 additions & 4 deletions medusa/generic_update_queue.py
Original file line number Diff line number Diff line change
@@ -97,8 +97,8 @@ def run(self):
try:
TraktPopular().fetch_popular_shows(page_url=page_url)
except Exception as error:
log.info(u'Could not get trakt recommended shows for %s because of error: %s', page_url,
error)
log.info(u'Could not get trakt recommended shows for {page_url} because of error: {error}',
{'page_url': page_url, 'error': error})
log.debug(u'Not bothering getting the other trakt lists')

if self.recommended_list in (
@@ -108,7 +108,7 @@ def run(self):
try:
ImdbPopular().fetch_popular_shows()
except (RequestException, Exception) as error:
log.info(u'Could not get imdb recommended shows because of error: %s', error)
log.info(u'Could not get imdb recommended shows because of error: {error}', {'error': error})

if self.recommended_list in (
UpdateQueueActions.UPDATE_RECOMMENDED_LIST_ANIDB, UpdateQueueActions.UPDATE_RECOMMENDED_LIST_ALL
@@ -117,7 +117,7 @@ def run(self):
try:
AnidbPopular().fetch_popular_shows(REQUEST_HOT)
except Exception as error:
log.info(u'Could not get anidb recommended shows because of error: %s', error)
log.info(u'Could not get anidb recommended shows because of error: {error}', {'error': error})

log.info(u'Finished caching recommended shows')

4 changes: 2 additions & 2 deletions medusa/show/recommendations/trakt.py
Original file line number Diff line number Diff line change
@@ -14,12 +14,12 @@
from medusa.logger.adapters.style import BraceAdapter
from medusa.show.recommendations import ExpiringList
from medusa.show.recommendations.recommended import (
BasePopular,
BasePopular,
RecommendedShow,
create_key_from_series,
)

from six import text_type
from six import iteritems, text_type

from traktor import (TokenExpiredException, TraktApi, TraktException)

4 changes: 3 additions & 1 deletion themes-default/slim/src/app.js
Original file line number Diff line number Diff line change
@@ -54,6 +54,7 @@ const globalComponents = [
Backstretch,
Config,
FileBrowser,
isotope,
LanguageSelect,
NamePattern,
PlotInfo,
@@ -73,7 +74,8 @@ const app = new Vue({
store,
router,
components: {
Truncate
Truncate,
isotope
},
data() {
return {
112 changes: 51 additions & 61 deletions themes-default/slim/views/addShows_recommended_vue.mako
Original file line number Diff line number Diff line change
@@ -15,8 +15,23 @@ window.app = new Vue({
ANIDB: 11,
TRAKT: 12
};
const sortOptions = [
{ text: 'Name', value: 'name' },
{ text: 'Original', value: 'original' },
{ text: 'Votes', value: 'votes' },
{ text: '% Rating', value: 'rating' },
{ text: '% Rating > Votes', value: 'rating_votes' },
]
const sortDirectionOptions = [
{ text: 'Ascending', value: 'asc'},
{ text: 'Descending', value: 'desc'},
]
return {
externals,
sortOptions,
sortDirectionOptions,
sortOptionsValue: 'original',
sortDirectionOptionsValue: 'desc',
configLoaded: false,
rootDirs: [],
enableShowOptions: false,
@@ -40,7 +55,7 @@ window.app = new Vue({
{ text: 'Anidb', value: externals.ANIDB },
{ text: 'IMDB', value: externals.IMDB },
{ text: 'Trakt', value: externals.TRAKT },
{ text: 'all', value: -1}
{ text: 'all', value: -1 }
],
selectedList: 11,
shows: [],
@@ -51,15 +66,22 @@ window.app = new Vue({
selected: null,
option: {
getSortData: {
id: "seriesId"
id: 'seriesId',
title: function(itemElem) {
return itemElem.title.toLowerCase();
},
rating: 'rating',
votes: 'votes'
},
sortBy : "seriesId",
layoutMode: 'fitRows'
sortBy : 'votes',
layoutMode: 'fitRows',
sortAscending: false
},
imgLazyLoad: new LazyLoad({
// Example of options object -> see options section
threshold: 500
})
}),

};
},
created() {
@@ -166,51 +188,6 @@ window.app = new Vue({
});
};

/*
* Adds show by indexer and indexer_id with a number of optional parameters
* The show can be added as an anime show by providing the data attribute: data-isanime="1"
* @TODO: move to vue method. Eventually you want to have this go through the store.
*/
$.initAddShowById = function() {
$(document.body).on('click', 'button[data-add-show]', function(e) {
e.preventDefault();

if ($(this).is(':disabled')) {
return false;
}

$(this).html('Added').prop('disabled', true);
$(this).parent().find('button[data-blacklist-show]').prop('disabled', true);

const anyQualArray = [];
const bestQualArray = [];
$('select[name="allowed_qualities"] option:selected').each((i, d) => {
anyQualArray.push($(d).val());
});
$('select[name="preferred_qualities"] option:selected').each((i, d) => {
bestQualArray.push($(d).val());
});

const configureShowOptions = $('#configure_show_options').prop('checked');

$.get('addShows/addShowByID?indexername=' + $(this).attr('data-indexer') + '&seriesid=' + $(this).attr('data-indexer-id'), {
root_dir: $('#rootDirs option:selected').val(), // eslint-disable-line camelcase
configure_show_options: configureShowOptions, // eslint-disable-line camelcase
show_name: $(this).attr('data-show-name'), // eslint-disable-line camelcase
quality_preset: $('select[name="quality_preset"]').val(), // eslint-disable-line camelcase
default_status: $('#statusSelect').val(), // eslint-disable-line camelcase
any_qualities: anyQualArray.join(','), // eslint-disable-line camelcase
best_qualities: bestQualArray.join(','), // eslint-disable-line camelcase
season_folders: $('#season_folders').prop('checked'), // eslint-disable-line camelcase
subtitles: $('#subtitles').prop('checked'),
anime: $('#anime').prop('checked'),
scene: $('#scene').prop('checked'),
default_status_after: $('#statusSelectAfter').val() // eslint-disable-line camelcase
});
return false;
});
};

$.updateBlackWhiteList = function(showName) {
$('#white').children().remove();
$('#black').children().remove();
@@ -422,6 +399,7 @@ window.app = new Vue({
'Saved',
{ timeout: 20000 }
);
show.showInLibrary = true;
debugger;
}).catch(() => {
this.$snotify.error(
@@ -447,7 +425,24 @@ window.app = new Vue({
this.selectedShowOptions.release.whitelist = whitelist;
this.selectedShowOptions.quality.allowed = allowed;
this.selectedShowOptions.quality.preferred = preferred;
}
},
sort: function() {
const mapped = {
original: 'original-order',
rating: 'rating',
votes: 'votes',
name: 'title',
rating_votes: ['rating', 'votes']
}
const { option: isotopeOptions, sortOptionsValue } = this;
this.option.sortBy = mapped[sortOptionsValue];
this.$refs.filteredShows.arrange(isotopeOptions);
},
sortDirection: function() {
const { option: isotopeOptions, sortDirectionOptionsValue } = this;
this.option.sortAscending = sortDirectionOptionsValue === 'asc';
this.$refs.filteredShows.arrange(isotopeOptions);
},
}
});
</script>
@@ -476,20 +471,15 @@ window.app = new Vue({

<div class="show-option">
<span>Sort By:</span>
<select id="showsort" class="form-control form-control-inline input-sm">
<option value="name">Name</option>
<option value="original">Original</option>
<option value="votes">Votes</option>
<option value="rating">% Rating</option>
<option value="rating_votes" selected="true" >% Rating > Votes</option>
<select name="showsort" id="showsort" v-model="sortOptionsValue" class="form-control form-control-inline input-sm" @change="sort">
<option v-for="option in sortOptions" :value="option.value">{{option.text}}</option>
</select>
</div>

<div class="show-option">
<span style="margin-left:12px">Sort Order:</span>
<select id="showsortdirection" class="form-control form-control-inline input-sm">
<option value="asc">Asc</option>
<option value="desc" selected="true" >Desc</option>
<select name="showsortdirection" id="showsortdirection" v-model="sortDirectionOptionsValue" class="form-control form-control-inline input-sm" @change="sortDirection">
<option v-for="option in sortDirectionOptions" :value="option.value">{{option.text}}</option>
</select>
</div>
</div>
@@ -504,7 +494,7 @@ window.app = new Vue({
<p>###Exception here###??</p>
</div>

<isotope :list="filteredShowsByList" id="container" class="isoDefault" :options='option' @layout="isotopeLayout($event)">
<isotope ref="filteredShows" :list="filteredShowsByList" id="container" class="isoDefault" :options='option' @layout="isotopeLayout($event)">
<div v-for="show in filteredShowsByList" :key="show.seriesId" :class="containerClass(show)" :data-name="show.title" :data-rating="show.rating" :data-votes="show.votes" :data-anime="show.isAnime">
<div class="recommended-image">
<app-link :href="show.imageHref">
2 changes: 1 addition & 1 deletion themes/dark/assets/js/app.js
112 changes: 51 additions & 61 deletions themes/dark/templates/addShows_recommended_vue.mako

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion themes/light/assets/js/app.js
112 changes: 51 additions & 61 deletions themes/light/templates/addShows_recommended_vue.mako

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.