Skip to content

Commit

Permalink
Merge pull request #8359 from pymedusa/release/release-0.4.1
Browse files Browse the repository at this point in the history
Release/release 0.4.1
  • Loading branch information
p0psicles authored Aug 18, 2020
2 parents 471c8ed + 863bfc6 commit 20915b5
Show file tree
Hide file tree
Showing 18 changed files with 168 additions and 109 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
## 0.4.1 (2020-08-18)

#### New Features

#### Improvements

#### Fixes
- Fixed show titles displayed in white text on the schedule page ([#8338](https://github.com/pymedusa/Medusa/pull/8338))
- Fixed Series show list title shown, also when it's the only show list used ([#8338](https://github.com/pymedusa/Medusa/pull/8338))
- Fixed home table layouts Downloads sorting ([#8338](https://github.com/pymedusa/Medusa/pull/8338))
- Fixed home table layouts previous and next episode sorting ([#8337](https://github.com/pymedusa/Medusa/pull/8337))
- Fixed show's show lists not stored after restart ([#8337](https://github.com/pymedusa/Medusa/pull/8337))

## 0.4.0 (2020-08-15)

#### New Features
Expand Down
2 changes: 1 addition & 1 deletion medusa/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
log.logger.addHandler(logging.NullHandler())

INSTANCE_ID = text_type(uuid.uuid1())
VERSION = '0.4.0'
VERSION = '0.4.1'
USER_AGENT = 'Medusa/{version} ({system}; {release}; {instance})'.format(
version=VERSION, system=platform.system(), release=platform.release(),
instance=INSTANCE_ID)
Expand Down
3 changes: 2 additions & 1 deletion medusa/tv/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -2021,7 +2021,8 @@ def save_to_db(self):
'rls_require_exclude': self.rls_require_exclude,
'default_ep_status': self.default_ep_status,
'plot': self.plot,
'airdate_offset': self.airdate_offset}
'airdate_offset': self.airdate_offset,
'show_lists': self._show_lists}

main_db_con = db.DBConnection()
main_db_con.upsert('tv_shows', new_value_dict, control_value_dict)
Expand Down
59 changes: 15 additions & 44 deletions themes-default/slim/src/components/home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@
<div id="showTabs" v-if="stateLayout.splitHomeInTabs">
<vue-tabs @tab-change="tabChange">
<v-tab
v-for="showList in showLists"
:key="showList.listTitle"
:title="showList.listTitle"
v-for="showInList in showsInLists"
:key="showInList.listTitle"
:title="showInList.listTitle"
>
<template v-if="['banner', 'simple', 'small', 'poster'].includes(layout)">
<show-list :id="`${showList.listTitle.toLowerCase()}TabContent`"
<show-list :id="`${showInList.listTitle.toLowerCase()}TabContent`"
v-bind="{
listTitle: showList.listTitle, layout, shows: showList.shows, header: showLists.length > 1
listTitle: showInList.listTitle, layout, shows: showInList.shows, header: showInList.length > 1
}"
/>
</template>
Expand All @@ -50,16 +50,20 @@
<template v-else>
<template v-if="['banner', 'simple', 'small', 'poster'].includes(layout)">
<draggable tag="ul" v-model="showList" class="list-group" handle=".move-show-list">
<li v-for="showList in showLists" :key="showList.listTitle">
<li v-for="showInList in showsInLists" :key="showInList.listTitle">
<show-list
v-bind="{
listTitle: showList.listTitle, layout, shows: showList.shows, header: showLists.length > 1
listTitle: showInList.listTitle, layout, shows: showInList.shows, header: showInList.length > 1
}"
/>
</li>
</draggable>
</template>
</template>

<!-- No Shows added -->
<span v-if="showsInLists && showsInLists.filter(list => list.shows.length > 0).length === 0">Please add a show <app-link href="addShows">here</app-link> to get started</span>

</div>
</div>
<backstretch :slug="config.randomShowSlug" />
Expand All @@ -68,6 +72,7 @@

<script>
import { mapActions, mapGetters, mapState } from 'vuex';
import { AppLink } from './helpers';
import { ShowList } from './show-list';
import { VueTabs, VTab } from 'vue-nav-tabs/dist/vue-tabs.js';
import Draggable from 'vuedraggable';
Expand All @@ -76,6 +81,7 @@ import Backstretch from './backstretch.vue';
export default {
name: 'home',
components: {
AppLink,
Backstretch,
ShowList,
VueTabs,
Expand All @@ -102,7 +108,8 @@ export default {
stats: state => state.stats
}),
...mapGetters({
showsWithStats: 'showsWithStats'
showsWithStats: 'showsWithStats',
showsInLists: 'showsInLists'
}),
layout: {
get() {
Expand Down Expand Up @@ -139,42 +146,6 @@ export default {
setLayoutShow(mergedShowLayout);
}
},
showLists() {
const { config, filterByName, indexers, layout, stateLayout, showList, showsWithStats } = this;
const { rootDirs } = config;
const { selectedRootIndex } = stateLayout;
if (!indexers.indexers || showsWithStats.length === 0) {
return;
}
let shows = null;
// Filter root dirs
shows = showsWithStats.filter(show => selectedRootIndex === -1 || show.config.location.includes(rootDirs.slice(1)[selectedRootIndex]));
// Filter by text for the banner, simple and smallposter layouts.
// The Poster layout uses vue-isotope and this does not respond well to changes to the `list` property.
if (layout !== 'poster') {
shows = shows.filter(show => show.title.toLowerCase().includes(filterByName.toLowerCase()));
}
const categorizedShows = showList.filter(listTitle => {
return listTitle === 'series' || shows.filter(show => show.config.showLists.map(list => list.toLowerCase()).includes(listTitle.toLowerCase())).length > 0;
}).map(listTitle => ({ listTitle, shows: shows.filter(show => show.config.showLists.map(list => list.toLowerCase()).includes(listTitle.toLowerCase())) }));
// Check for shows that are not in any category anymore
const uncategorizedShows = shows.filter(show => {
return show.config.showLists.map(item => {
return showList.map(list => list.toLowerCase()).includes(item.toLowerCase());
}).every(item => !item);
});
if (uncategorizedShows.length > 0) {
categorizedShows.push({ listTitle: 'uncategorized', shows: uncategorizedShows });
}
return categorizedShows;
},
selectedRootIndexOptions() {
const { config } = this;
const { rootDirs } = config;
Expand Down
10 changes: 10 additions & 0 deletions themes-default/slim/src/components/schedule.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,14 @@ export default {
</script>

<style>
/* Also defined in style.css and dark.css, but i'm overwriting for light and dark, because the schedule table has coloring. */
td.tvShow a {
color: rgb(0, 0, 0);
text-decoration: none;
}
td.tvShow a:hover {
cursor: pointer;
color: rgb(66, 139, 202);
}
</style>
13 changes: 6 additions & 7 deletions themes-default/slim/src/components/show-list/index.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div>
<!-- Only show the list title when not in tabs -->
<div v-if="!stateLayout.splitHomeInTabs" class="showListTitle listTitle">
<div v-if="!stateLayout.splitHomeInTabs && (showsInLists && showsInLists.length > 1)" class="showListTitle listTitle">
<button type="button" class="nav-show-list move-show-list">
<span class="icon-bar" />
<span class="icon-bar" />
Expand Down Expand Up @@ -42,24 +42,20 @@
<div v-else-if="shows.length >= 1" :class="[['simple', 'small', 'banner'].includes(layout) ? 'table-layout' : '']">
<component :is="mappedLayout" v-bind="$props" />
</div>

<!-- No Shows added -->
<span v-else>Please add a show <app-link href="addShows">here</app-link> to get started</span>
</div>
</template>
<script>
import { mapActions, mapState } from 'vuex';
import { mapActions, mapGetters, mapState } from 'vuex';
import Banner from './banner.vue';
import Simple from './simple.vue';
import Poster from './poster.vue';
import Smallposter from './smallposter.vue';
import { AppLink, PosterSizeSlider, StateSwitch } from '../helpers';
import { PosterSizeSlider, StateSwitch } from '../helpers';
export default {
name: 'show-list',
components: {
AppLink,
Banner,
Simple,
Poster,
Expand Down Expand Up @@ -110,6 +106,9 @@ export default {
stateLayout: state => state.config.layout,
showsLoading: state => state.shows.loading
}),
...mapGetters({
showsInLists: 'showsInLists'
}),
mappedLayout() {
const { layout } = this;
if (layout === 'small') {
Expand Down
55 changes: 35 additions & 20 deletions themes-default/slim/src/mixins/show-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ export const showlistTableMixin = {
hidden: getCookie('Quality')
}, {
label: 'Downloads',
field: 'stats.tooltip.text',
field: 'stats.tooltip.percentage',
sortFn: this.sortDownloads,
type: 'boolean',
hidden: getCookie('Downloads')
}, {
label: 'Size',
Expand Down Expand Up @@ -79,7 +81,11 @@ export const showlistTableMixin = {
}),
...mapGetters({
fuzzyParseDateTime: 'fuzzyParseDateTime'
})
}),
maxNextAirDate() {
const { shows } = this;
return Math.max(...shows.filter(show => show.nextAirDate).map(show => Date.parse(show.nextAirDate)));
}
},
methods: {
prettyBytes: bytes => pretty(bytes),
Expand Down Expand Up @@ -125,40 +131,42 @@ export const showlistTableMixin = {
return 0;
}

if ((x === null || y === null) && x !== y) {
return x < y ? 1 : -1;
if (x === null || y === null) {
return x === null ? 1 : -1;
}

let xTsDiff = Date.parse(x) - Date.now();
let yTsDiff = Date.parse(y) - Date.now();
// Convert to timestamps
x = Date.parse(x);
y = Date.parse(y);

if (x && Date.parse(x) < Date.now()) {
xTsDiff += maxNextAirDate;
// This next airdate lies in the past. We need to correct this.
if (x < Date.now()) {
x += maxNextAirDate;
}

if (y && Date.parse(y) < Date.now()) {
yTsDiff += maxNextAirDate;
if (y < Date.now()) {
y += maxNextAirDate;
}

return (xTsDiff < yTsDiff ? -1 : (xTsDiff > yTsDiff ? 1 : 0));
return (x < y ? -1 : (x > y ? 1 : 0));
},
sortDatePrev(x, y) {
if (x === null && y === null) {
return 0;
}

if ((x === null || y === null) && x !== y) {
return x < y ? 1 : -1;
// Standardize dates and nulls
x = x ? Date.parse(x) : 0;
y = y ? Date.parse(y) : 0;

if (x === null || y === null) {
return x === null ? -1 : 1;
}

const xTsDiff = Date.parse(x) - Date.now();
const yTsDiff = Date.parse(y) - Date.now();
const xTsDiff = x - Date.now();
const yTsDiff = y - Date.now();

return (xTsDiff < yTsDiff ? -1 : (xTsDiff > yTsDiff ? 1 : 0));
},
maxNextAirDate() {
const { shows } = this;
return Math.max(...shows.filter(show => show.nextAirDate).map(show => Date.parse(show.nextAirDate)));
return xTsDiff < yTsDiff ? -1 : (xTsDiff > yTsDiff ? 1 : 0);
},
sortTitle(x, y) {
const { stateLayout } = this;
Expand All @@ -173,6 +181,13 @@ export const showlistTableMixin = {
}

return (titleX < titleY ? -1 : (titleX > titleY ? 1 : 0));
},
sortDownloads(x, y, _, rowX, rowY) {
if ((x === 0 || x === 100) && x === y) {
return rowX.stats.episodes.total < rowY.stats.episodes.total ? -1 : (rowX.stats.episodes.total < rowY.stats.episodes.total ? 1 : 0);
}

return x < y ? -1 : (x > y ? 1 : 0);
}
}
};
50 changes: 50 additions & 0 deletions themes-default/slim/src/store/modules/shows.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,56 @@ const getters = {
};
return show;
});
},
showsInLists: (state, getters, rootState) => {
const { layout, general } = rootState.config;
const { show } = layout;
const { showListOrder } = show;
const { rootDirs } = general;
const { selectedRootIndex, local } = layout;
const { showFilterByName } = local;

const { showsWithStats } = getters;

let shows = null;

// Filter root dirs
shows = showsWithStats.filter(show => selectedRootIndex === -1 || show.config.location.includes(rootDirs.slice(1)[selectedRootIndex]));

// Filter by text for the banner, simple and smallposter layouts.
// The Poster layout uses vue-isotope and this does not respond well to changes to the `list` property.
if (layout.home !== 'poster') {
shows = shows.filter(show => show.title.toLowerCase().includes(showFilterByName.toLowerCase()));
}

const categorizedShows = showListOrder.filter(
listTitle => shows.filter(
show => show.config.showLists.map(
list => list.toLowerCase()
).includes(listTitle.toLowerCase())
).length > 0
).map(
listTitle => ({ listTitle, shows: shows.filter(
show => show.config.showLists.map(list => list.toLowerCase()).includes(listTitle.toLowerCase())
) })
);

// Check for shows that are not in any category anymore
const uncategorizedShows = shows.filter(show => {
return show.config.showLists.map(item => {
return showListOrder.map(list => list.toLowerCase()).includes(item.toLowerCase());
}).every(item => !item);
});

if (uncategorizedShows.length > 0) {
categorizedShows.push({ listTitle: 'uncategorized', shows: uncategorizedShows });
}

if (categorizedShows.length === 0 && uncategorizedShows.length === 0) {
categorizedShows.push({ listTitle: 'Series', shows: [] });
}

return categorizedShows;
}
};

Expand Down
2 changes: 1 addition & 1 deletion themes/dark/assets/js/app.js

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

2 changes: 1 addition & 1 deletion themes/dark/assets/js/index.js

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

2 changes: 1 addition & 1 deletion themes/dark/assets/js/medusa-runtime.js

Large diffs are not rendered by default.

Loading

0 comments on commit 20915b5

Please sign in to comment.