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

FIX: m-team rss, stat, download issue #792

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
.vscode/
Dockerfile-dev
config/sites.json
config/temp
config/plugins
config/*.db
config/*.dat
config/backup_file
config/archive_file
nastools_test.py
/node_modules/**
package-lock.json
Expand Down
14 changes: 7 additions & 7 deletions app/media/meta/metavideov2.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,21 @@ class MetaVideoV2(MetaBase):
_seasons_re = r"(?:第)?\s*(?:\d+|[一二三四五六七八九十]+)\s*(季)?\s*\.\s*(?:第)?\s*(?:\d+|[一二三四五六七八九十]+)\s*(季)"
_seasons_re_2 = r"(?:[Ss]0*|Season|season)([0-9]+)\s*\.\s*(?:[Ss]0*|Season|season)([0-9]+)"
_season_re = r"(?:第)?\s*(?:\d+|[一二三四五六七八九十]+)\s*(季)"
_season_re_2 = r"(?<![a-zA-Z0-9_])(?i)[sS](eason)?\s*0*\d+"
_season_re_2 = r"(?<![a-zA-Z0-9_])[sS](eason)?\s*0*\d+"
_season_all_re = r"(?<![^\s.\\-])\s*(?<!第)(?:\d+|[一二三四五六七八九十]+)\s*(季)\s*(全)(?![^\s.\\-]*[\d一二三四五六七八九十])"
_season_all_re_2 = r"(全|共)\s*(?:\d+|[一二三四五六七八九十]+)\s*(季)"
_episodes_re = r"(?:第)?\s*(?<![sS])(?:\d+|[一二三四五六七八九十]+)\s*(?:集|话|話)?\s*\.\s*(?:第)?\s*(?:\d+|[一二三四五六七八九十]+)\s*(?:集|话|話)"
_episodes_re_2 = r"(?:[Ee]0*|episode|ep)([0-9]+)\s*\.\s*(?:[Ee]0*|episode|ep)([0-9]+)"
_episode_re = r"(?:第)?\s*(?:\d+|[一二三四五六七八九十]+)\s*(?:集|话|話)"
_episode_re_2 = r"(?<![a-zA-Z0-9_])(?i)(?:e|ep|episode)\s*0*\d+"
_episode_re_2 = r"(?<![a-zA-Z0-9_])(?:e|ep|episode)\s*0*\d+"
_episode_all_re = r"(?<![^\s.\\-])\s*(?<!第)(?:\d+|[一二三四五六七八九十]+)\s*(寄|集|话|話)\s*(全)(?![^\s.\\-]*[\d一二三四五六七八九十])"
_episode_all_re_2 = r"(全|共)\s*(?:\d+|[一二三四五六七八九十]+)\s*(寄|集|话|話)"
_numbers_re = r"\d+|[一二三四五六七八九十]+"
_years_re = r"(\d{4}(?!p|P))\s*\.\s*(\d{4})(?![pP])"
_release_date_re = r"\d{2,4}年\d+(?:月)?(?:新番|合集|)"
_other_re = r"\[(?:★|❤|GB|JP|KR|CN|TW|US|SG|招募翻译(?:校对)?|招募翻譯(?:校對)?|)\]"
_special_resource_team = r"(?i)(HDCTV)"
_special_streaming_service = r"(?i)(Jade|ViuTv)"
_special_resource_team = r"(HDCTV)"
_special_streaming_service = r"(Jade|ViuTv)"

def __init__(self,
title,
Expand Down Expand Up @@ -311,10 +311,10 @@ def __init_resource_type(self):
self.resource_type = re.sub(r'(?i)disney', 'DSNP', self.resource_type)
self.resource_type = re.sub(r'(?i)hbo max', 'HMAX', self.resource_type)

if re.findall(r'%s' % self._special_resource_team, self._original_title):
if re.findall(r'%s' % self._special_resource_team, self._original_title, flags=re.IGNORECASE):
self.resource_type = re.sub(r'(?i)ctv', '', self.resource_type)

special_streaming_services_matches = re.findall(r'%s' % self._special_streaming_service, self._original_title)
special_streaming_services_matches = re.findall(r'%s' % self._special_streaming_service, self._original_title, flags=re.IGNORECASE)
if len(special_streaming_services_matches) > 1:
special_streaming_services_text = ' '.join(special_streaming_services_matches)
else:
Expand Down Expand Up @@ -468,7 +468,7 @@ def __fix_resource_team(self):
else:
self.resource_team = None

special_resource_team_matches = re.findall(r'%s' % self._special_resource_team, self._original_title)
special_resource_team_matches = re.findall(r'%s' % self._special_resource_team, self._original_title, flags=re.IGNORECASE)
if len(special_resource_team_matches) > 1:
special_resource_team_text = ' '.join(special_resource_team_matches)
else:
Expand Down
6 changes: 3 additions & 3 deletions app/sites/siteuserinfo/mteam_torrent.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ def _mt_get_sys_roles(self):
sysrole._classUp = int(result.get("classUp"))
sysrole._registerWeek = int(result.get("registerWeek"))
sysrole._downloaded = int(result.get("downloaded"))
sysrole._shareRate = int(result.get("shareRate"))
sysrole._shareRateLimit = int(result.get("shareRateLimit"))
sysrole._sortPoint = int(result.get("sortPoint"))
sysrole._shareRate = float(result.get("shareRate"))
sysrole._shareRateLimit = float(result.get("shareRateLimit"))
sysrole._sortPoint = float(result.get("sortPoint"))
g_sys_role_list.append(sysrole)
log.info(f"【MTeamUserInfo】 获取馒头系统角色成功,共有{len(g_sys_role_list)}个角色")
elif res is not None:
Expand Down
13 changes: 12 additions & 1 deletion app/utils/string_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,22 @@ def get_url_domain(url):
"""
获取URL的域名部分,不含WWW和HTTP
"""
common_prefixes: list = ["www."]
site_prefixes: dict = {"m-team": ["api.", "rss.", "kp."]}
if not url:
return ""
_, netloc = StringUtils.get_url_netloc(url)
if netloc:
return netloc.lower().replace("www.", "")
netloc_lower: str = netloc.lower()
# trim common prefix
for common_prefix in common_prefixes:
netloc_lower = netloc_lower.replace(common_prefix, "")
# remove site custom prefix
for site_key in site_prefixes.keys():
if site_key in netloc_lower:
for prefix in site_prefixes[site_key]:
netloc_lower = netloc_lower.replace(prefix, "")
return netloc_lower
return ""

@staticmethod
Expand Down
3 changes: 3 additions & 0 deletions start.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
$CONFIG_DIR=Join-Path -Path (Get-Location).Path -ChildPath 'config'
$Env:NASTOOL_CONFIG=Join-Path -Path $CONFIG_DIR -ChildPath 'config.yaml'
Start-Process python -Args run.py
2 changes: 1 addition & 1 deletion web/backend/user.sites.bin

Large diffs are not rendered by default.