Skip to content

Commit

Permalink
Merge pull request #777 from EstrellaXD/3.1-dev
Browse files Browse the repository at this point in the history
3.1.14
  • Loading branch information
Rewrite0 authored May 31, 2024
2 parents f47f77d + 66518fd commit 1cb15ca
Show file tree
Hide file tree
Showing 33 changed files with 9,030 additions and 6,601 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,3 @@ dev-dist

# test file
test.*
test_*
8 changes: 7 additions & 1 deletion backend/src/module/models/config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from os.path import expandvars
from typing import Literal

from pydantic import BaseModel, Field
from pydantic import BaseModel, Field, validator


class Program(BaseModel):
Expand Down Expand Up @@ -102,6 +102,12 @@ class ExperimentalOpenAI(BaseModel):
"", description="Azure OpenAI deployment id, ignored when api type is openai"
)

@validator("api_base")
def validate_api_base(cls, value: str):
if value == "https://api.openai.com/":
return "https://api.openai.com/v1"
return value


class Config(BaseModel):
program: Program = Program()
Expand Down
67 changes: 34 additions & 33 deletions backend/src/module/parser/analyser/torrent_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,36 +69,37 @@ def torrent_parser(
file_type: str = "media",
) -> EpisodeFile | SubtitleFile:
media_path = get_path_basename(torrent_path)
for rule in RULES:
if torrent_name:
match_obj = re.match(rule, torrent_name, re.I)
else:
match_obj = re.match(rule, media_path, re.I)
if match_obj:
group, title = get_group(match_obj.group(1))
if not season:
title, season = get_season_and_title(title)
else:
title, _ = get_season_and_title(title)
episode = int(match_obj.group(2))
suffix = Path(torrent_path).suffix
if file_type == "media":
return EpisodeFile(
media_path=torrent_path,
group=group,
title=title,
season=season,
episode=episode,
suffix=suffix,
)
elif file_type == "subtitle":
language = get_subtitle_lang(media_path)
return SubtitleFile(
media_path=torrent_path,
group=group,
title=title,
season=season,
language=language,
episode=episode,
suffix=suffix,
)
match_names = [torrent_name, media_path]
if torrent_name is None:
match_names = match_names[1:]
for match_name in match_names:
for rule in RULES:
match_obj = re.match(rule, match_name, re.I)
if match_obj:
group, title = get_group(match_obj.group(1))
if not season:
title, season = get_season_and_title(title)
else:
title, _ = get_season_and_title(title)
episode = int(match_obj.group(2))
suffix = Path(torrent_path).suffix
if file_type == "media":
return EpisodeFile(
media_path=torrent_path,
group=group,
title=title,
season=season,
episode=episode,
suffix=suffix,
)
elif file_type == "subtitle":
language = get_subtitle_lang(media_path)
return SubtitleFile(
media_path=torrent_path,
group=group,
title=title,
season=season,
language=language,
episode=episode,
suffix=suffix,
)
5 changes: 2 additions & 3 deletions webui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"@vueuse/components": "^10.4.1",
"@vueuse/core": "^8.9.4",
"axios": "^0.27.2",
"lodash": "^4.17.21",
"naive-ui": "^2.34.4",
"pinia": "^2.1.3",
"rxjs": "^7.8.1",
Expand All @@ -42,19 +41,19 @@
"@storybook/testing-library": "0.0.14-next.2",
"@storybook/vue3": "^7.0.12",
"@storybook/vue3-vite": "^7.0.12",
"@types/lodash": "^4.14.194",
"@types/node": "^18.16.14",
"@unocss/preset-attributify": "^0.55.3",
"@unocss/preset-rem-to-px": "^0.51.13",
"@unocss/reset": "^0.51.13",
"@vitejs/plugin-vue": "^4.2.0",
"@vitejs/plugin-vue": "^4.2.3",
"@vitejs/plugin-vue-jsx": "^3.1.0",
"@vue/runtime-dom": "^3.3.4",
"eslint": "^8.41.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-storybook": "^0.6.12",
"husky": "^8.0.3",
"prettier": "^2.8.8",
"radash": "^12.1.0",
"sass": "^1.62.1",
"storybook": "^7.0.12",
"typescript": "^4.9.5",
Expand Down
Loading

0 comments on commit 1cb15ca

Please sign in to comment.