Skip to content

Commit

Permalink
Merge pull request #6836 from pymedusa/release/release-0.3.4
Browse files Browse the repository at this point in the history
Release 0.3.4
  • Loading branch information
medariox authored Jun 13, 2019
2 parents 4d4a63c + 68de2da commit 74c3f12
Show file tree
Hide file tree
Showing 72 changed files with 420 additions and 459 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 0.3.4 (2019-06-13)

#### Fixes
- Fixed Jackett providers returning empty torrents on magnet redirect (2) ([#6827](https://github.com/pymedusa/Medusa/pull/6827))
- Fixed APIv2 exception when serializing allowed extensions to JSON ([#6835](https://github.com/pymedusa/Medusa/pull/6835))

-----

## 0.3.3 (2019-06-12)

#### New Features
Expand Down
2 changes: 1 addition & 1 deletion medusa/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def __init__(self):
self.TV_DOWNLOAD_DIR = None
self.UNPACK = False
self.SKIP_REMOVED_FILES = False
self.ALLOWED_EXTENSIONS = {'srt', 'nfo', 'sub', 'idx'}
self.ALLOWED_EXTENSIONS = ['srt', 'nfo', 'sub', 'idx']

self.NZBS = False
self.NZBS_UID = None
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.3.3'
VERSION = '0.3.4'
USER_AGENT = 'Medusa/{version} ({system}; {release}; {instance})'.format(
version=VERSION, system=platform.system(), release=platform.release(),
instance=INSTANCE_ID)
Expand Down
19 changes: 8 additions & 11 deletions medusa/providers/torrent/torrent_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
from medusa.logger.adapters.style import BraceAdapter
from medusa.providers.generic_provider import GenericProvider

from requests.exceptions import InvalidSchema

log = BraceAdapter(logging.getLogger(__name__))
log.logger.addHandler(logging.NullHandler())

Expand Down Expand Up @@ -151,18 +149,17 @@ def get_redirect_url(self, url):
"""Get the final address that the provided URL redirects to."""
log.debug('Retrieving redirect URL for {url}', {'url': url})

try:
response = self.session.get(url, stream=True)
if response:
response.close()
return response.url
response = self.session.get(url, stream=True)
if response:
response.close()
return response.url

# Jackett redirects to a magnet causing InvalidSchema.
# Use an alternative method to get the redirect URL.
except InvalidSchema:
response = self.session.get(url, allow_redirects=False)
if response and response.headers.get('Location'):
return response.headers['Location']
log.debug('Using alternative method to retrieve redirect URL')
response = self.session.get(url, allow_redirects=False)
if response and response.headers.get('Location'):
return response.headers['Location']

log.debug('Unable to retrieve redirect URL for {url}', {'url': url})
return url
Expand Down
1 change: 0 additions & 1 deletion themes-default/slim/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ module.exports = {
'apiRoute': 'readonly',
'axios': 'readonly',
'webRoot': 'readonly',
'apiRoot': 'readonly',
'apiKey': 'readonly',
'Vuex': 'readonly',
}
Expand Down
69 changes: 8 additions & 61 deletions themes-default/slim/src/app.js
Original file line number Diff line number Diff line change
@@ -1,79 +1,26 @@
import Vue from 'vue';
import Vuex from 'vuex';
import VueRouter from 'vue-router';
import AsyncComputed from 'vue-async-computed';
import Snotify from 'vue-snotify';
import store from './store';

import { registerGlobalComponents } from './global-vue-shim';
import router from './router';
import store from './store';
import { isDevelopment } from './utils/core';
import {
AnidbReleaseGroupUi,
AppHeader,
AppLink,
Asset,
Backstretch,
Config,
FileBrowser,
LanguageSelect,
NamePattern,
PlotInfo,
RootDirs,
ScrollButtons,
SelectList,
Show,
ShowSelector,
SubMenu
} from './components';

Vue.config.devtools = true;
Vue.config.performance = true;

Vue.use(Vuex);
Vue.use(VueRouter);
// Register plugins
Vue.use(AsyncComputed);
Vue.use(Snotify);

// Global components
const globalComponents = [
AnidbReleaseGroupUi,
AppHeader,
AppLink,
Asset,
Backstretch,
Config,
FileBrowser,
LanguageSelect,
NamePattern,
PlotInfo,
RootDirs,
ScrollButtons,
SelectList,
Show,
ShowSelector,
SubMenu
];

globalComponents.forEach(component => {
Vue.component(component.name, component);
});

// Load x-template components
window.components.forEach(component => {
// Skip already registered components
if (!Object.keys(Vue.options.components).includes(component.name)) {
if (isDevelopment) {
console.debug(`Registering ${component.name}`);
}
Vue.component(component.name, component);
}
});
// @TODO: Remove this before v1.0.0
registerGlobalComponents();

const app = new Vue({
name: 'App',
store,
router,
components: {
},
store,
data() {
return {
globalLoading: false,
Expand All @@ -85,7 +32,7 @@ const app = new Vue({
console.log('App Mounted!');
}

if (!document.location.pathname.includes('/login')) {
if (!window.location.pathname.includes('/login')) {
const { $store } = this;
Promise.all([
$store.dispatch('login', { username: window.username }),
Expand Down
1 change: 1 addition & 0 deletions themes-default/slim/src/components/show-header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ export default {
},
computed: {
...mapState({
config: state => state.config,
shows: state => state.shows.shows,
indexerConfig: state => state.config.indexers.config.indexers,
failedDownloads: state => state.config.failedDownloads,
Expand Down
2 changes: 1 addition & 1 deletion themes-default/slim/src/components/snatch-selection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { AppLink } from './helpers';
import ShowHeader from './show-header.vue';
export default {
name: 'snatchSelection',
name: 'snatch-selection',
template: '#snatch-selection-template',
components: {
AppLink,
Expand Down
3 changes: 3 additions & 0 deletions themes-default/slim/src/components/status.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<script>
import { mapState } from 'vuex';
export default {
name: 'status',
template: '#status-template',
computed: mapState(['config']),
mounted() {
$('#schedulerStatusTable').tablesorter({
widgets: ['saveSort', 'zebra'],
Expand Down
167 changes: 167 additions & 0 deletions themes-default/slim/src/global-vue-shim.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
// @TODO: Remove this file before v1.0.0
import Vue from 'vue';
import VueMeta from 'vue-meta';
import AsyncComputed from 'vue-async-computed';
import Snotify from 'vue-snotify';

import {
AddShowOptions,
AnidbReleaseGroupUi,
AppHeader,
AppLink,
Asset,
Backstretch,
ConfigTemplate,
ConfigTextbox,
ConfigTextboxNumber,
ConfigToggleSlider,
FileBrowser,
Home,
LanguageSelect,
ManualPostProcess,
PlotInfo,
QualityChooser,
QualityPill,
RootDirs,
ScrollButtons,
SelectList,
Show,
ShowSelector,
SnatchSelection,
StateSwitch,
Status,
SubMenu
} from './components';
import store from './store';
import { isDevelopment } from './utils/core';

/**
* Register global components and x-template components.
*/
export const registerGlobalComponents = () => {
// Start with the x-template components
let { components } = window;

// Add global components (in use by `main.mako`)
// @TODO: These should be registered in an `App.vue` component when possible,
// along with some of the `main.mako` template
components = components.concat([
AppHeader,
ScrollButtons,
SubMenu
]);

// Add global components (in use by pages/components that are not SFCs yet)
// Use this when it's not possible to use `components: { ... }` in a component's definition.
// If a component that uses any of these is a SFC, please use the `components` key when defining it.
// @TODO: Instead of globally registering these,
// they should be registered in each component that uses them
components = components.concat([
AddShowOptions,
AnidbReleaseGroupUi,
AppLink,
Asset,
Backstretch,
ConfigTemplate,
ConfigTextbox,
ConfigTextboxNumber,
ConfigToggleSlider,
FileBrowser,
LanguageSelect,
PlotInfo,
QualityChooser,
QualityPill, // @FIXME: (sharkykh) Used in a hack/workaround in `static/js/ajax-episode-search.js`
RootDirs,
SelectList,
ShowSelector,
StateSwitch
]);

// Add components for pages that use `pageComponent`
// @TODO: These need to be converted to Vue SFCs
components = components.concat([
Home,
ManualPostProcess,
Show,
SnatchSelection,
Status
]);

// Register the components globally
components.forEach(component => {
if (isDevelopment) {
console.debug(`Registering ${component.name}`);
}
Vue.component(component.name, component);
});
};

export default () => {
const warningTemplate = (name, state) =>
`${name} is using the global Vuex '${state}' state, ` +
`please replace that with a local one using: mapState(['${state}'])`;

Vue.mixin({
data() {
// These are only needed for the root Vue
if (this.$root === this) {
return {
globalLoading: true,
pageComponent: false
};
}
return {};
},
mounted() {
if (this.$root === this && !window.location.pathname.includes('/login')) {
const { username } = window;
Promise.all([
/* This is used by the `app-header` component
to only show the logout button if a username is set */
store.dispatch('login', { username }),
store.dispatch('getConfig')
]).then(([_, config]) => {
this.$emit('loaded');
// Legacy - send config.main to jQuery (received by index.js)
const event = new CustomEvent('medusa-config-loaded', { detail: config.main });
window.dispatchEvent(event);
}).catch(error => {
console.debug(error);
alert('Unable to connect to Medusa!'); // eslint-disable-line no-alert
});
}

this.$once('loaded', () => {
this.$root.globalLoading = false;
});
},
// Make auth and config accessible to all components
// @TODO: Remove this completely
computed: {
// Deprecate the global `Vuex.mapState(['auth', 'config'])`
auth() {
if (isDevelopment && !this.__VUE_DEVTOOLS_UID__) {
console.warn(warningTemplate(this._name, 'auth'));
}
return this.$store.state.auth;
},
config() {
if (isDevelopment && !this.__VUE_DEVTOOLS_UID__) {
console.warn(warningTemplate(this._name, 'config'));
}
return this.$store.state.config;
}
}
});

if (isDevelopment) {
console.debug('Loading local Vue');
}

// Register plugins
Vue.use(AsyncComputed);
Vue.use(VueMeta);
Vue.use(Snotify);

registerGlobalComponents();
};
Loading

0 comments on commit 74c3f12

Please sign in to comment.