Skip to content

Commit

Permalink
Chore: minor adjustment (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
xjasonlyu authored Dec 13, 2023
1 parent 3533b66 commit da55252
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
6 changes: 4 additions & 2 deletions Contents/Code/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def search(self, results, media, lang, manual=False):
)
position = pid.position # update position
search_results.append(api.get_movie_info(
pid.provider, pid.id, pid.update is not True))
provider=pid.provider, id=pid.id, lazy=(pid.update is not True)))
except ValueError: # fallback to name based search
search_results = api.search_movie(q=media.name)

Expand Down Expand Up @@ -290,7 +290,9 @@ def update(self, metadata, media, lang, force=False):
# Basic Metadata
metadata.summary = m.summary
metadata.original_title = original_title
metadata.tagline = DEFAULT_TAGLINE_TEMPLATE.format(date=release_date)

# Set pid to tagline field
metadata.tagline = '{pid:s}'.format(pid=pid)

# Content Rating
metadata.content_rating = DEFAULT_RATING
Expand Down
14 changes: 9 additions & 5 deletions Contents/Code/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,13 @@
PLUGIN_NAME = 'MetaTube'
DEFAULT_USER_AGENT = '%s.bundle' % PLUGIN_NAME

# Content Rating
DEFAULT_RATING = 'JP-18+'
DEFAULT_COUNTRY = 'Japan'

# Chinese Subtitle
CHINESE_SUBTITLE = '中文字幕'

# Default Values
DEFAULT_RATING = 'JP-18+'
DEFAULT_COUNTRY = 'Japan'
DEFAULT_TITLE_TEMPLATE = '{number} {title}'
DEFAULT_TAGLINE_TEMPLATE = '配信開始日 {date}'

# Supported Languages
LANGUAGES = [
Expand All @@ -45,6 +42,13 @@
Locale.Language.Swedish,
]

# File Extensions
VIDEO_EXTENSIONS = ('.mp4', '.m4v', '.mkv', '.wmv', '.avi',
'.flv', '.mov', '.3gp', '.rm', '.rmvb',
'.ts', '.m2ts', '.mpegts', '.mpeg')
SUBTITLE_EXTENSIONS = ('.srt', '.ass', '.ssa', '.smi',
'.sub', '.idx', '.vtt', '.psb')

# Preference Keys
KEY_API_SERVER = 'api_server'
KEY_API_TOKEN = 'api_token'
Expand Down
7 changes: 2 additions & 5 deletions Contents/Code/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
from base64 import b64decode
from datetime import datetime

from constants import CHINESE_SUBTITLE

VIDEO_EXTENSIONS = ('.mp4', '.wmv', '.avi', '.rm', '.rmvb', '.m4v', 'webm',
'.ogg', '.mkv', '.flv', '.mov', '.3gp', '.ts', '.mpg')
from constants import * # import all


def parse_date(s):
Expand Down Expand Up @@ -70,7 +67,7 @@ def has_external_chinese_subtitle(video_name, *filenames):
return False

r = re.compile(
r'\.(chinese|ch[ist]|zh(-(cn|hk|tw|hans|hant))?)\.(ass|srt|ssa|stl|sub|vid|vtt)$', re.IGNORECASE)
r'\.(ch[ist]|zho?(-(cn|hk|sg|tw))?)\.(ass|srt|ssa|smi|sub|idx|psb|vtt)$', re.IGNORECASE)
for filename in filenames:
if r.search(filename) and r.sub('', filename).upper() == basename.upper():
return True
Expand Down

0 comments on commit da55252

Please sign in to comment.