Skip to content

Commit

Permalink
Merge pull request #3423 from pymedusa/develop
Browse files Browse the repository at this point in the history
Release 0.1.20
  • Loading branch information
medariox authored Dec 6, 2017
2 parents ca2c5c4 + 1c2a401 commit 1a8dc66
Show file tree
Hide file tree
Showing 112 changed files with 6,656 additions and 4,987 deletions.
5 changes: 5 additions & 0 deletions .codebeatignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
static/js/vender.js
static/js/lib/*

ext/**
lib/**
6 changes: 6 additions & 0 deletions .docker/root/etc/cont-init.d/30-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/with-contenv bash

# permissions
chown -R abc:abc \
/app \
/config
5 changes: 5 additions & 0 deletions .docker/root/etc/services.d/medusa/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/with-contenv bash

exec \
s6-setuidgid abc python /app/medusa/start.py \
--nolaunch --datadir /config
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.git
.gitignore
.github
.gitattributes
READMETEMPLATE.md
README.md
7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: python
python:
- 2.7.9
- 2.7.10
sudo: false
branches:
except:
Expand All @@ -16,10 +16,9 @@ install:
- 'curl -o- -L https://yarnpkg.com/install.sh | bash'
- 'export PATH="$HOME/.yarn/bin:$PATH" && yarn install && cd vue && yarn install && cd ..'
script:
- 'cd vue && yarn test && cd ..'
- yarn test-js
- tox -v --recreate
- yarn test-api
- 'cd vue && yarn test && cd ..'
- yarn test
cache:
yarn: true
directories:
Expand Down
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM lsiobase/alpine.python:3.6
MAINTAINER bobbysteel

# set version label
ARG BUILD_DATE
ARG VERSION
LABEL build_version="Version:- ${VERSION} Build-date:- ${BUILD_DATE}"

# install packages
RUN \
apk add --no-cache \
--repository http://nl.alpinelinux.org/alpine/edge/community \
mediainfo gdbm

# install app
COPY . /app/medusa/

# copy local files
COPY .docker/root/ /

# ports and volumes
EXPOSE 8081
VOLUME /config /downloads /tv /anime
2 changes: 1 addition & 1 deletion dredd/api-description.yml
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ paths:
items:
$ref: '#/definitions/Log'
examples:
'application/json':
'application/json; charset=UTF-8':
- $ref: '#/definitions/Log/example'
- $ref: '#/definitions/Log/example'
- $ref: '#/definitions/Log/example'
Expand Down
3 changes: 2 additions & 1 deletion dredd/dredd_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ def configure_transaction(transaction):
expected_content_type = expected['headers'].get('Content-Type')
expected_status_code = int(expected['statusCode'])
if expected_status_code == 204 or response.get('x-expect', {}).get('no-body', False):
del expected['body']
if expected.get('body'):
del expected['body']
if expected_content_type:
print('Skipping content-type validation for {name!r}.'.format(name=transaction['name']))
del expected['headers']['Content-Type']
Expand Down
2 changes: 1 addition & 1 deletion ext/subliminal/providers/addic7ed.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Addic7edSubtitle(Subtitle):

def __init__(self, language, hearing_impaired, page_link, series, season, episode, title, year, version,
download_link):
super(Addic7edSubtitle, self).__init__(language, hearing_impaired, page_link)
super(Addic7edSubtitle, self).__init__(language, hearing_impaired=hearing_impaired, page_link=page_link)
self.series = series
self.season = season
self.episode = episode
Expand Down
23 changes: 18 additions & 5 deletions ext/subliminal/providers/legendastv.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,13 @@ class LegendasTVProvider(Provider):
subtitle_class = LegendasTVSubtitle

def __init__(self, username=None, password=None):

# Provider needs UNRAR installed. If not available raise ConfigurationError
try:
rarfile.custom_check(rarfile.UNRAR_TOOL)
except rarfile.RarExecError:
raise ConfigurationError('UNRAR tool not available')

if any((username, password)) and not all((username, password)):
raise ConfigurationError('Username and password must be specified')

Expand Down Expand Up @@ -238,7 +245,7 @@ def is_valid_title(title, title_id, sanitized_title, season, year):
return
return True

@region.cache_on_arguments(expiration_time=SHOW_EXPIRATION_TIME)
@region.cache_on_arguments(expiration_time=SHOW_EXPIRATION_TIME, should_cache_fn=lambda value: value)
def search_titles(self, title, season, title_year):
"""Search for titles matching the `title`.
Expand Down Expand Up @@ -356,10 +363,16 @@ def get_archives(self, title_id, language_code, title_type, season, episode):
# episode
if season and episode:
# discard mismatches on episode in non-pack archives
if not archive.pack and 'episode' in guess and guess['episode'] != episode:
logger.debug('Mismatched episode %s, discarding archive: %s',
guess['episode'], archive.name)
continue

# Guessit may return int for single episode or list for multi-episode
# Check if archive name has multiple episodes releases on it
if not archive.pack and 'episode' in guess:
wanted_episode = set(episode) if isinstance(episode, list) else {episode}
archive_episode = guess['episode'] if isinstance(guess['episode'], list) else {guess['episode']}

if not wanted_episode.intersection(archive_episode):
logger.debug('Mismatched episode %s, discarding archive: %s', guess['episode'], clean_name)
continue

# extract text containing downloads, rating and timestamp
data_text = archive_soup.find('p', class_='data').text
Expand Down
14 changes: 10 additions & 4 deletions ext/subliminal/providers/opensubtitles.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ class OpenSubtitlesSubtitle(Subtitle):

def __init__(self, language, hearing_impaired, page_link, subtitle_id, matched_by, movie_kind, hash, movie_name,
movie_release_name, movie_year, movie_imdb_id, series_season, series_episode, filename, encoding):
super(OpenSubtitlesSubtitle, self).__init__(language, hearing_impaired, page_link, encoding)
super(OpenSubtitlesSubtitle, self).__init__(language, hearing_impaired=hearing_impaired,
page_link=page_link, encoding=encoding)
self.subtitle_id = subtitle_id
self.matched_by = matched_by
self.movie_kind = movie_kind
Expand Down Expand Up @@ -59,7 +60,8 @@ def get_matches(self, video):
if isinstance(video, Episode) and self.movie_kind == 'episode':
# tag match, assume series, year, season and episode matches
if self.matched_by == 'tag':
matches |= {'series', 'year', 'season', 'episode'}
if not video.imdb_id or self.movie_imdb_id == video.imdb_id:
matches |= {'series', 'year', 'season', 'episode'}
# series
if video.series and sanitize(self.series_name) == sanitize(video.series):
matches.add('series')
Expand Down Expand Up @@ -88,7 +90,8 @@ def get_matches(self, video):
elif isinstance(video, Movie) and self.movie_kind == 'movie':
# tag match, assume title and year matches
if self.matched_by == 'tag':
matches |= {'title', 'year'}
if not video.imdb_id or self.movie_imdb_id == video.imdb_id:
matches |= {'title', 'year'}
# title
if video.title and sanitize(self.movie_name) == sanitize(video.title):
matches.add('title')
Expand Down Expand Up @@ -158,7 +161,10 @@ def query(self, languages, hash=None, size=None, imdb_id=None, query=None, seaso
if hash and size:
criteria.append({'moviehash': hash, 'moviebytesize': str(size)})
if imdb_id:
criteria.append({'imdbid': imdb_id[2:]})
if season and episode:
criteria.append({'imdbid': imdb_id[2:], 'season': season, 'episode': episode})
else:
criteria.append({'imdbid': imdb_id[2:]})
if tag:
criteria.append({'tag': tag})
if query and season and episode:
Expand Down
2 changes: 1 addition & 1 deletion ext/subliminal/providers/podnapisi.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class PodnapisiSubtitle(Subtitle):

def __init__(self, language, hearing_impaired, page_link, pid, releases, title, season=None, episode=None,
year=None):
super(PodnapisiSubtitle, self).__init__(language, hearing_impaired, page_link)
super(PodnapisiSubtitle, self).__init__(language, hearing_impaired=hearing_impaired, page_link=page_link)
self.pid = pid
self.releases = releases
self.title = title
Expand Down
Loading

0 comments on commit 1a8dc66

Please sign in to comment.