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

Feature/UI component add anime white blacklist #11812

Merged
merged 21 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions .github/workflows/python-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: [3.7, 3.8, 3.9, '3.10', '3.11']
python-version: [3.7, 3.8, 3.9, '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
pip install -r test_requirements.txt
- name: Test with tox
run: tox
- name: Upload coverage to Codecov
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/version-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]
python-version: [3.12]

steps:
- uses: actions/checkout@v2
Expand Down
16 changes: 8 additions & 8 deletions ext/boto/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@
# This is probably running on App Engine.
expanduser = (lambda x: x)

from boto.vendored import six
import six

from boto.vendored.six import BytesIO, StringIO
from boto.vendored.six.moves import filter, http_client, map, _thread, \
urllib, zip
from boto.vendored.six.moves.queue import Queue
from boto.vendored.six.moves.urllib.parse import parse_qs, quote, unquote, \
from six import BytesIO, StringIO
from six.moves import filter, http_client, map, _thread, urllib, zip
from six.moves.queue import Queue
from six.moves.urllib.parse import parse_qs, quote, unquote, \
urlparse, urlsplit
from boto.vendored.six.moves.urllib.parse import unquote_plus
from boto.vendored.six.moves.urllib.request import urlopen
from six.moves.urllib.parse import unquote_plus
from six.moves.urllib.request import urlopen


if six.PY3:
# StandardError was removed, so use the base exception type instead
Expand Down
23 changes: 14 additions & 9 deletions ext/boto/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class MyFancyAuth(AuthPlugin):
"""

import glob
import imp
import importlib.util
import os.path


Expand Down Expand Up @@ -66,16 +66,21 @@ def get_plugin(cls, requested_capability=None):
return result


def _load_module_with_importlib(name, path):
spec = importlib.util.find_spec(name, path)
if spec:
mod = importlib.util.module_from_spec(spec)
spec.loader.exec_module(mod)
return mod
else:
raise ImportError(f"Module {name} not found in path {path}")


def _import_module(filename):
(path, name) = os.path.split(filename)
(name, ext) = os.path.splitext(name)

(file, filename, data) = imp.find_module(name, [path])
try:
return imp.load_module(name, file, filename, data)
finally:
if file:
file.close()
(name, _) = os.path.splitext(name)

return _load_module_with_importlib(name, [path])

_plugin_loaded = False

Expand Down
8 changes: 4 additions & 4 deletions ext/imdbpie/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
import diskcache
from dateutil.tz import tzutc
from dateutil.parser import parse
import boto.utils
from six import ensure_text
from six.moves.urllib.parse import urlparse, parse_qs, quote
from boto import provider
from boto.provider import Provider
from boto.connection import HTTPRequest
from boto.auth import HmacAuthV3HTTPHandler

Expand All @@ -42,7 +42,7 @@ def canonical_query_string(self, http_request):
return ''
qs_parts = []
for param in sorted(http_request.params):
value = boto.utils.get_utf8_value(http_request.params[param])
value = ensure_text(http_request.params[param])
param_ = quote(param, safe='-_.~')
value_ = quote(value, safe='-_.~')
qs_parts.append('{0}={1}'.format(param_, value_))
Expand Down Expand Up @@ -118,7 +118,7 @@ def get_auth_headers(self, url_path):
handler = ZuluHmacAuthV3HTTPHandler(
host=HOST,
config={},
provider=provider.Provider(
provider=Provider(
name='aws',
access_key=creds['accessKeyId'],
secret_key=creds['secretAccessKey'],
Expand Down
8 changes: 4 additions & 4 deletions lib/pkg_resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
except ImportError:
importlib_machinery = None

from pkg_resources.extern import appdirs
import appdirs
from pkg_resources.extern import packaging
__import__('pkg_resources.extern.packaging.version')
__import__('pkg_resources.extern.packaging.specifiers')
Expand Down Expand Up @@ -2169,7 +2169,7 @@ def resolve_egg_link(path):
return next(dist_groups, ())


register_finder(pkgutil.ImpImporter, find_on_path)
register_finder(pkgutil.zipimporter, find_on_path)

if hasattr(importlib_machinery, 'FileFinder'):
register_finder(importlib_machinery.FileFinder, find_on_path)
Expand Down Expand Up @@ -2210,7 +2210,7 @@ def _handle_ns(packageName, path_item):
# capture warnings due to #1111
with warnings.catch_warnings():
warnings.simplefilter("ignore")
loader = importer.find_module(packageName)
loader = importer.find_spec(packageName)

if loader is None:
return None
Expand Down Expand Up @@ -2324,7 +2324,7 @@ def file_ns_handler(importer, path_item, packageName, module):
return subpath


register_namespace_handler(pkgutil.ImpImporter, file_ns_handler)
register_namespace_handler(pkgutil.zipimporter, file_ns_handler)
register_namespace_handler(zipimport.zipimporter, file_ns_handler)

if hasattr(importlib_machinery, 'FileFinder'):
Expand Down
21 changes: 19 additions & 2 deletions medusa/process_tv.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,23 @@ def __init__(self, path, process_method=None, failed=False, episodes=[], process
self.episodes = episodes
self.process_single_resource = process_single_resource

def _is_tv_download_dir(self, path):
"""Check if the path exists, combine with the tv_download_dir path if available."""
if not app.TV_DOWNLOAD_DIR:
self.log_and_output('tv_download_dir not set, not using it', level=logging.DEBUG)
return False

if not os.path.isdir(app.TV_DOWNLOAD_DIR):
self.log_and_output('tv_download_dir set, but cant resove to a local directory', level=logging.DEBUG)
return False

if not helpers.real_path(path) != helpers.real_path(app.TV_DOWNLOAD_DIR):
self.log_and_output('real path didnt match for the path: [] but cant resove to a local directory',
level=logging.DEBUG, **{'path': helpers.real_path(path), 'tv_download_dir': helpers.real_path(app.TV_DOWNLOAD_DIR)})
return False

return True

@property
def directory(self):
"""Return the root directory we are going to process."""
Expand All @@ -305,13 +322,13 @@ def directory(self, path):

# If the client and the application are not on the same machine,
# translate the directory into a network directory
elif all([app.TV_DOWNLOAD_DIR, os.path.isdir(app.TV_DOWNLOAD_DIR),
helpers.real_path(path) == helpers.real_path(app.TV_DOWNLOAD_DIR)]):
elif self._is_tv_download_dir(path):
directory = os.path.join(
app.TV_DOWNLOAD_DIR,
os.path.abspath(path).split(os.path.sep)[-1]
)
self.log_and_output('Trying to use folder: {directory}', level=logging.DEBUG, **{'directory': directory})

else:
self.log_and_output(
'Unable to figure out what folder to process.'
Expand Down
3 changes: 3 additions & 0 deletions test_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ pytest-cov==4.1.0
pytest-flake8==1.1.1
pytest-tornado==0.8.1
PyYAML==6.0.1
setuptools==68.0.0
six==1.16.0
tox
tox-gh-actions
tornado==6.1
urllib3<2.0.0
vcrpy
Expand Down
1 change: 1 addition & 0 deletions themes-default/slim/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ module.exports = {
selfClosingTag: 'always',
},
],
'import/no-named-as-default-member': 'off',
},
// Please do not use root `globals` because they can't be overriden.
globals: {},
Expand Down
4 changes: 2 additions & 2 deletions themes-default/slim/src/components/display-show.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@

<template slot="table-footer-row" slot-scope="{headerRow}">
<tr colspan="9999" :id="`season-${headerRow.season}-footer`" class="seasoncols border-bottom shadow">
<th class="col-footer" colspan="15" align="left">Season contains {{headerRow.children.length}} episodes with total filesize: {{addFileSize(headerRow)}}</th>
<th class="col-footer" colspan="15">Season contains {{headerRow.children.length}} episodes with total filesize: {{addFileSize(headerRow)}}</th>
</tr>
<tr class="spacer" />
</template>
Expand Down Expand Up @@ -1217,7 +1217,7 @@ tablesorter.css
}

.displayShow >>> .vgt-table tr:hover {
opacity: 0.9;
opacity: 0.8;
}

.displayShow >>> .unaired {
Expand Down
48 changes: 5 additions & 43 deletions themes-default/slim/src/components/edit-show.vue
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,9 @@ export default {
methods: {
...mapActions({
getShow: 'getShow',
setShow: 'setShow',
setCurrentShow: 'setCurrentShow',
setShowConfig: 'setShowConfig'
setShowConfig: 'setShowConfig',
saveShowConfig: 'saveShowConfig'
}),
loadShow() {
const { setCurrentShow, getShow, showSlug } = this;
Expand All @@ -398,7 +398,7 @@ export default {
setCurrentShow(showSlug);
},
async saveShow(subject) {
const { show, showLoaded } = this;
const { show, showLoaded, saveShowConfig } = this;

// We want to wait until the page has been fully loaded, before starting to save stuff.
if (!showLoaded) {
Expand All @@ -412,54 +412,16 @@ export default {
// Disable the save button until we're done.
this.saving = true;

const showConfig = show.config;
const data = {
config: {
aliases: showConfig.aliases,
defaultEpisodeStatus: showConfig.defaultEpisodeStatus,
dvdOrder: showConfig.dvdOrder,
seasonFolders: showConfig.seasonFolders,
anime: showConfig.anime,
scene: showConfig.scene,
sports: showConfig.sports,
paused: showConfig.paused,
location: showConfig.location,
airByDate: showConfig.airByDate,
subtitlesEnabled: showConfig.subtitlesEnabled,
release: {
requiredWords: showConfig.release.requiredWords,
ignoredWords: showConfig.release.ignoredWords,
requiredWordsExclude: showConfig.release.requiredWordsExclude,
ignoredWordsExclude: showConfig.release.ignoredWordsExclude
},
qualities: {
preferred: showConfig.qualities.preferred,
allowed: showConfig.qualities.allowed
},
airdateOffset: showConfig.airdateOffset,
showLists: showConfig.showLists,
templates: showConfig.templates,
searchTemplates: showConfig.searchTemplates
},
language: show.language
};

if (data.config.anime) {
data.config.release.blacklist = showConfig.release.blacklist;
data.config.release.whitelist = showConfig.release.whitelist;
}

const { showSlug, setShow } = this;
try {
await setShow({ showSlug, data });
await saveShowConfig({ show });
this.$snotify.success(
'You may need to "Re-scan files" or "Force Full Update".',
'Saved',
{ timeout: 5000 }
);
} catch (error) {
this.$snotify.error(
`Error while trying to save ${this.show.title}: ${error.message || 'Unknown'}`,
`Error while trying to save ${show.title}: ${error.message || 'Unknown'}`,
'Error'
);
} finally {
Expand Down
13 changes: 12 additions & 1 deletion themes-default/slim/src/components/show-results.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@
>
</span>

<span v-else-if="props.column.label === 'Group'" class="align-center release-group">
{{props.row.releaseGroup}}
<manage-whitelist v-if="show.config.anime && props.row.releaseGroup" :show="show" :releaseGroup="props.row.releaseGroup" />
</span>

<span v-else-if="props.column.label === 'Quality'" class="align-center">
<quality-pill v-if="props.row.quality !== 0" :quality="props.row.quality" />
</span>
Expand Down Expand Up @@ -95,13 +100,15 @@
import QualityPill from './helpers/quality-pill.vue';
import { episodeToSlug, humanFileSize } from '../utils/core';
import { VTooltip } from 'v-tooltip';
import ManageWhitelist from './show-results/manage-whitelist.vue';

export default {
name: 'show-results',
components: {
VueGoodTable,
StateSwitch,
QualityPill
QualityPill,
ManageWhitelist
},
directives: {
tooltip: VTooltip
Expand Down Expand Up @@ -241,7 +248,7 @@

const result = await getProviderCacheResults({ showSlug: show.id.slug, season, episode });

// TODO: put a modal in between

Check warning on line 251 in themes-default/slim/src/components/show-results.vue

View workflow job for this annotation

GitHub Actions / build (16.x)

Unexpected 'todo' comment: 'TODO: put a modal in between'
if (result.providersSearched > 0 && result.totalSearchResults.length === 0) {
forceSearch();
}
Expand Down Expand Up @@ -461,4 +468,8 @@
#no-result {
color: rgb(255, 255, 255);
}

.release-group {
position: relative;
}
</style>
Loading
Loading