Skip to content

Commit

Permalink
- Always download S1 poster (if settings allow)
Browse files Browse the repository at this point in the history
- Option to disable renaming
- Option to disable renaming of seasons
- Option to don't ignore S1 if it's the only season
  • Loading branch information
Arial-Z committed Jan 24, 2024
1 parent e6076fc commit 8fb2727
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 29 deletions.
8 changes: 7 additions & 1 deletion config/default.env
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,16 @@ LOG_FOLDER=$SCRIPT_FOLDER/config/logs
WANTED_RATING=audience
# Source for RATING (MAL / ANILIST)
RATING_SOURCE=ANILIST
# Allow renaming animes (Yes/No)
ALLOW_RENAMING=Yes
# Use the english name as title (and also sort_title) instead of the romaji one, the romaji title will be set as original title (Yes/No)
MAIN_TITLE_ENG=No
# Use the english name as sort_title instead of the romaji one (Yes/No)
SORT_TITLE_ENG=No
# Use the native name as original_title instead of the romaji/english one (Yes/No)
ORIGINAL_TITLE_NATIVE=Yes
# Rename season to the anilist title of that season (Yes/No)
RENAME_SEASONS=Yes
#Grab anilist tags higher or equal than percentage (0-100)
ANILIST_TAGS_P=70
# Download poster (Yes/No)
Expand All @@ -51,8 +55,10 @@ POSTER_DOWNLOAD=Yes
POSTER_SEASON_DOWNLOAD=Yes
# Source for poster (MAL / ANILIST)
POSTER_SOURCE=ANILIST
# Ignore seasons rating and poster (Yes/No)
# Ignore seasons title, rating and poster (Yes/No)
IGNORE_SEASONS=No
# Ignore season 1 if it's the only season (Yes/No)
IGNORE_S1=Yes
# Anilist have some full uppercase title, this settings will remove them "86 EIGHTY-SIX" > "86 Eighty-Six" (Yes/No)
REDUCE_TITLE_CAPS=Yes
#Add the anime season to the season label in plex (Fall 2022, Spring 2021, ...)
Expand Down
59 changes: 31 additions & 28 deletions functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ function get-season-infos () {
then
printf " 0:\n label.remove: score\n" >> "$METADATA"
else
if [[ $last_season -eq 1 ]]
if [[ $last_season -eq 1 && $IGNORE_S1 == "Yes" ]]
then
anilist_id=$anilist_backup_id
if [[ $RATING_SOURCE == "ANILIST" ]]
Expand All @@ -498,6 +498,7 @@ function get-season-infos () {
printf " 1:\n label.remove: score\n" >> "$METADATA"
fi
total_score=$(echo | awk -v v1="$score_season" -v v2="$total_score" '{print v1 + v2}')
get-season-poster
else
anilist_id=$(jq --arg tvdb_id "$tvdb_id" --arg season_number "$season_number" '.[] | select( .tvdb_id == $tvdb_id ) | select( .tvdb_season == $season_number ) | select( .tvdb_epoffset == "0" ) | .anilist_id' -r "$SCRIPT_FOLDER/config/tmp/list-animes-id.json" | head -n 1)
if [[ -n "$anilist_id" ]]
Expand All @@ -522,22 +523,21 @@ function get-season-infos () {
then
((no_rating_seasons++))
fi
if [[ $MAIN_TITLE_ENG == "Yes" ]]
if [[ $SEASON_YEAR == "Yes" ]]
then
if [[ $SEASON_YEAR == "Yes" ]]
anime_season=$(get-animes-season-year)
if [[ $ALLOW_RENAMING == "Yes" && $RENAME_SEASONS == "Yes" ]]
then
anime_season=$(get-animes-season-year)
printf " %s:\n title: |-\n %s\n user_rating: %s\n label: %s,score\n" "$season_number" "$english_title" "$score_season" "$anime_season" >> "$METADATA"
printf " %s:\n title: |-\n %s\n user_rating: %s\n label: %s,score\n" "$season_number" "$romaji_title" "$score_season" "$anime_season" >> "$METADATA"
else
printf " %s:\n title: |-\n %s\n user_rating: %s\n label: score\n" "$season_number" "$english_title" "$score_season" >> "$METADATA"
printf " %s:\n user_rating: %s\n label: %s,score\n" "$season_number" "$score_season" "$anime_season" >> "$METADATA"
fi
else
if [[ $SEASON_YEAR == "Yes" ]]
if [[ $ALLOW_RENAMING == "Yes" && $RENAME_SEASONS == "Yes" ]]
then
anime_season=$(get-animes-season-year)
printf " %s:\n title: |-\n %s\n user_rating: %s\n label: %s,score\n" "$season_number" "$romaji_title" "$score_season" "$anime_season" >> "$METADATA"
else
printf " %s:\n title: |-\n %s\n user_rating: %s\n label: score\n" "$season_number" "$romaji_title" "$score_season" >> "$METADATA"
else
printf " %s:\n user_rating: %s\n label: score\n" "$season_number" "$score_season" >> "$METADATA"
fi
fi
total_score=$(echo | awk -v v1="$score_season" -v v2="$total_score" '{print v1 + v2}')
Expand Down Expand Up @@ -588,27 +588,30 @@ function write-metadata () {
then
english_title=$romaji_title
fi
if [[ $MAIN_TITLE_ENG == "Yes" ]]
if [[ $ALLOW_RENAMING == "Yes" ]]
then
if [[ $ORIGINAL_TITLE_NATIVE == "Yes" ]]
if [[ $MAIN_TITLE_ENG == "Yes" ]]
then
printf " title: |-\n %s\n sort_title: |-\n %s\n original_title: |-\n %s\n" "$english_title" "$english_title" "$native_title" >> "$METADATA"
else
printf " title: |-\n %s\n sort_title: |-\n %s\n original_title: |-\n %s\n" "$english_title" "$english_title" "$romaji_title" >> "$METADATA"
fi
else
printf " title: |-\n %s\n" "$romaji_title" >> "$METADATA"
if [[ $SORT_TITLE_ENG == "Yes" ]]
then
printf " sort_title: |-\n %s\n" "$english_title" >> "$METADATA"
else
printf " sort_title: |-\n %s\n" "$romaji_title" >> "$METADATA"
fi
if [[ $ORIGINAL_TITLE_NATIVE == "Yes" ]]
then
printf " original_title: |-\n %s\n" "$native_title" >> "$METADATA"
if [[ $ORIGINAL_TITLE_NATIVE == "Yes" ]]
then
printf " title: |-\n %s\n sort_title: |-\n %s\n original_title: |-\n %s\n" "$english_title" "$english_title" "$native_title" >> "$METADATA"
else
printf " title: |-\n %s\n sort_title: |-\n %s\n original_title: |-\n %s\n" "$english_title" "$english_title" "$romaji_title" >> "$METADATA"
fi
else
printf " original_title: |-\n %s\n" "$english_title" >> "$METADATA"
printf " title: |-\n %s\n" "$romaji_title" >> "$METADATA"
if [[ $SORT_TITLE_ENG == "Yes" ]]
then
printf " sort_title: |-\n %s\n" "$english_title" >> "$METADATA"
else
printf " sort_title: |-\n %s\n" "$romaji_title" >> "$METADATA"
fi
if [[ $ORIGINAL_TITLE_NATIVE == "Yes" ]]
then
printf " original_title: |-\n %s\n" "$native_title" >> "$METADATA"
else
printf " original_title: |-\n %s\n" "$english_title" >> "$METADATA"
fi
fi
fi
anime_tags=$(get-tags)
Expand Down

0 comments on commit 8fb2727

Please sign in to comment.