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

Prepare new release #40

Merged
merged 88 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
f2fc3f9
limit API call for airing info
Feb 26, 2024
2abe0c7
Fix json download folder
Feb 26, 2024
2078086
Re add log for airing info
Feb 26, 2024
68e6dc0
Fix log
Feb 26, 2024
6cc8ee5
Fix airing loop wrong log indent
Feb 26, 2024
4982e7e
Update VERSION
Arial-Z Feb 27, 2024
14dd139
Fix ignore seasons in override
Mar 6, 2024
b2f99a9
Fix ignore seasons override
Mar 6, 2024
daee825
Add version check and clean data folder if new
Mar 6, 2024
70f00a9
invert season and year
Arial-Z Mar 18, 2024
abfd0b4
Add seasons part and userlists
Mar 20, 2024
7b30912
fix part detect
Mar 20, 2024
76d9b59
fix season part log
Mar 20, 2024
1386d45
Add seasons userlists
Mar 21, 2024
80a09ea
Fix double label score
Mar 21, 2024
0783c77
Improve label
Mar 21, 2024
59bb407
Add option to remove "Anime" tag
Mar 21, 2024
8655d41
Fix label
Mar 21, 2024
2517770
update default.env
Mar 21, 2024
ab8f086
Fix label
Mar 21, 2024
2f2e0a8
Fix label
Mar 21, 2024
f5e001d
Fix label
Mar 21, 2024
4dc0360
Fix label
Mar 21, 2024
9401348
Fix userlist season label
Mar 21, 2024
cb6f8bf
Fix season userlist label
Mar 21, 2024
ff6d56a
Fix userlist label
Mar 21, 2024
6ef72aa
Fix season userlist
Mar 21, 2024
f01dce6
Fix season userlist label
Mar 21, 2024
3d29d4f
Add Season part and anilist userlist
Arial-Z Mar 21, 2024
8ce6cc7
Fix type
Mar 22, 2024
9dad320
Fix trying to do season logic without anilist id
Mar 22, 2024
e1af836
Fix cour number in error
Mar 23, 2024
1ae4b4d
remove useless code
Mar 23, 2024
d6c9760
Fix userlist settings not working
Mar 23, 2024
7787278
Fix userlist for movies
Mar 23, 2024
cf5f5c3
Fix Anilist userlist
Mar 23, 2024
76d41e3
Fix movies userlists
Mar 23, 2024
5d08186
Fix download userlists
Mar 23, 2024
dd73e61
Fix script log
Mar 23, 2024
27b6f1f
Fix userlist
Mar 23, 2024
9c017f3
Fix userlists
Mar 23, 2024
8da3398
Allow override with only 1 season in season loop
Mar 26, 2024
c64a150
Add settings IGNORE_S1_ONLY_RATING
Mar 27, 2024
cebf2df
Fix seasons metadata
Mar 27, 2024
252f565
Fix seasons metadata
Mar 27, 2024
d5f8822
Fix seasons metadata
Mar 27, 2024
bd8d0d2
Update anilist API limitrate
Apr 3, 2024
f20b182
Fix JQ error with override and keep aring list for 12 hours
Apr 8, 2024
8f0281a
Fix Missing MAL with only S0
Apr 8, 2024
6169783
Fix mutli label.remove
Apr 9, 2024
1f496c1
Fix multi label remove
Apr 9, 2024
5855316
Fix JQ error
Apr 10, 2024
48d929e
Fix ongoing error
Apr 10, 2024
90915b3
Fix airing status
Apr 14, 2024
85f8978
Update readme
Apr 15, 2024
c87d43c
update docker compose
Apr 15, 2024
3f24f45
Update dev.yml
Arial-Z Apr 15, 2024
8d0ddf5
Update main.yml
Arial-Z Apr 15, 2024
45d5602
Update release.yml
Arial-Z Apr 15, 2024
c0e42b9
Fix anilist score
Apr 15, 2024
136d19c
Fix API
Apr 15, 2024
9776d6f
Add Anime Awards
Apr 16, 2024
cddd397
Do label last
Apr 16, 2024
ff87dfd
Fix Anime Awards
Apr 16, 2024
f50d009
Fix Anime Awards
Apr 16, 2024
4b98786
Add option to ignore non japanases VA
Apr 17, 2024
435bd47
Test ignore non japanase VA
Apr 17, 2024
93de8ab
rename
Apr 17, 2024
616b52d
Simplify seasons award
Apr 20, 2024
67c4591
Fix awards
Apr 21, 2024
abd0b5b
Fix docker
Apr 21, 2024
bde9055
Fix seasonal
Jun 10, 2024
26be049
Add gawk to docker container
Jun 10, 2024
e261dee
Fix python changes
Jun 19, 2024
5b3ac93
Fix log
Jun 19, 2024
810f2c7
update .env
Jun 19, 2024
9f94acc
Fix season missing id
Jun 19, 2024
a56fe55
Add caps userlists
Jun 20, 2024
d215763
Change score label
Jun 20, 2024
d75c658
Fix char caps
Jun 20, 2024
0c150a6
Fix override not working as expected
Jun 21, 2024
7527abd
Fix label
Jun 21, 2024
fead71e
Fix seasons missing id
Jun 21, 2024
f019ee3
Add Check anilist API status
Arial-Z Nov 18, 2024
1d41445
revert API check
Arial-Z Nov 18, 2024
1b5c1ac
Stop script if Anilist API down
Arial-Z Nov 18, 2024
03114cc
Update README.md
Arial-Z Nov 20, 2024
58f450e
Merge branch 'main' into dev
Arial-Z Nov 20, 2024
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
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ LICENSE
.github
Dockerfile
docker-compose.yml
romaji-renamer-venv
venv
.env
config/tmp
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN echo "**** install system packages ****" \
&& apt-get update \
&& apt-get upgrade -y --no-install-recommends \
&& apt-get install -y tzdata --no-install-recommends \
&& apt-get install -y gcc g++ libxml2-dev libxslt-dev libz-dev libjpeg62-turbo-dev zlib1g-dev wget curl jq \
&& apt-get install -y gcc g++ libxml2-dev libxslt-dev libz-dev libjpeg62-turbo-dev zlib1g-dev wget curl jq gawk \
&& wget -O /tini https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-"$(dpkg --print-architecture | awk -F- '{ print $NF }')" \
&& chmod +x /tini \
&& pip3 install --no-cache-dir --upgrade --requirement /requirements.txt \
Expand All @@ -20,4 +20,4 @@ RUN echo "**** install system packages ****" \
&& rm -rf /requirements.txt /tmp/* /var/tmp/* /var/lib/apt/lists/*
VOLUME /config
VOLUME /pmm
ENTRYPOINT ["/tini", "-s", "bash", "plex-romaji-renamer.sh", "--"]
ENTRYPOINT ["/tini", "-s", "bash", "romaji-renamer.sh", "--"]
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,20 @@ First you need a GNU/Linux OS to run bash script<br/>
Requirements: Plex Media Server, Plex-Meta-Manager, Python and JQ<br/>
- Install and configure Plex-Meta-Manager: https://github.com/meisnate12/Plex-Meta-Manager<br/>
- Install JQ is a json parser see: https://stedolan.github.io/jq/ (Present by default on unRAID 6.10.0 and later.)<br/>
- install python plexapi
```
pip install plexapi
```
- install python-dotenv
```
pip install python-dotenv
```

### Step 2 - Download and extract the script
Git clone the **main** branch or get lastest release : https://github.com/Arial-Z/Romaji-Renamer/releases/latest

### Step 3 - Configure the script
### Step 3 - Install python modules and configure the script
- Extract the script on a desired location.<br/>
- Navigate to its location.<br/>
- install python plexapi and python-dotenv with a virtual environment
```
cd into the script folder
python3 -m venv romaji-renamer-venv
source romaji-renamer-venv/bin/activate
pip install plexapi python-dotenv
```
- Copy default.env to config/.env<br/>
- cd into the config folder and edit .env to fill out the variables.<br/>
```env
Expand Down Expand Up @@ -171,7 +170,7 @@ DATA_CACHE_TIME=5
- Within your (PMM) config.yml add the following metadata_path, it should look like this with the default filepath:
```yml
Animes:
metadata_path:
metadata_files:
- file: config/metadata-animes.yml
```
Configuration finished.
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

version=1.24
version=1.24+
38 changes: 28 additions & 10 deletions animes-renamer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,31 @@ fi
:> "$MATCH_LOG"
printf "%s - Starting animes script\n\n" "$(date +%H:%M:%S)" | tee -a "$LOG"

# Download animes mapping json data
# Download animes mapping json data & anilist userlist
download-anime-id-mapping
get-anilist-userlist

# export animes list from plex
printf "%s - Creating animes list\n" "$(date +%H:%M:%S)" | tee -a "$LOG"
printf "%s\t - Exporting Plex animes library\n" "$(date +%H:%M:%S)" | tee -a "$LOG"
python3 "$SCRIPT_FOLDER/plex_animes_export.py"
if [ -f "$SCRIPT_FOLDER/romaji-renamer-venv/bin/python3" ]
then
"$SCRIPT_FOLDER/romaji-renamer-venv/bin/python3" "$SCRIPT_FOLDER/plex_animes_export.py"
else
python3 "$SCRIPT_FOLDER/plex_animes_export.py"
fi
printf "%s\t - Done\n" "$(date +%H:%M:%S)" | tee -a "$LOG"

# create ID/animes.tsv
create-override
printf "%s\t - Sorting Plex animes library\n" "$(date +%H:%M:%S)" | tee -a "$LOG"
while IFS=$'\t' read -r tvdb_id anilist_id title_override studio override_seasons_ignore notes
while IFS= read -r line
do
tvdb_id=$(printf "%s" "$line" | awk -F"\t" '{print $1}')
anilist_id=$(printf "%s" "$line" | awk -F"\t" '{print $2}')
title_override=$(printf "%s" "$line" | awk -F"\t" '{print $3}')
studio=$(printf "%s" "$line" | awk -F"\t" '{print $4}')
override_seasons_ignore=$(printf "%s" "$line" | awk -F"\t" '{print $5}')
if ! awk -F"\t" '{print $1}' "$SCRIPT_FOLDER/config/ID/animes.tsv" | grep -q -w "$tvdb_id"
then
if awk -F"\t" '{print $1}' "$SCRIPT_FOLDER/config/tmp/plex_animes_export.tsv" | grep -q -w "$tvdb_id"
Expand Down Expand Up @@ -89,27 +100,34 @@ do
-X POST \
-H 'content-type: application/json' \
--data '{ "query": "{ Page(page: '"$ongoingpage"', perPage: 50) { pageInfo { hasNextPage } media(type: ANIME, status_in: RELEASING, sort: POPULARITY_DESC) { id } } }" }' > "$SCRIPT_FOLDER/config/tmp/ongoing-anilist.json" -D "$SCRIPT_FOLDER/config/tmp/anilist-limit-rate.txt"
if grep -q -w '"data": null' "$SCRIPT_FOLDER/config/tmp/ongoing-anilist.json"
then
rm "$SCRIPT_FOLDER/config/tmp/ongoing-anilist.json"
printf "%s - Error AniList API down, exiting\n" "$(date +%H:%M:%S)" | tee -a "$LOG"
exit 1
fi
rate_limit=0
rate_limit=$(grep -oP '(?<=x-ratelimit-remaining: )[0-9]+' "$SCRIPT_FOLDER/config/tmp/anilist-limit-rate.txt")
((wait_time++))
if [[ -z $rate_limit ]]
if [[ $wait_time == 4 ]]
then
printf "%s - Error can't download anilist data stopping script\n" "$(date +%H:%M:%S)" | tee -a "$LOG"
exit 1
elif [[ -z $rate_limit ]]
then
printf "%s\t - Cloudflare limit rate reached watiting 60s\n" "$(date +%H:%M:%S)" | tee -a "$LOG"
sleep 61
elif [[ $rate_limit -ge 3 ]]
then
sleep 0.8
sleep 1
printf "%s\t - done\n" "$(date +%H:%M:%S)" | tee -a "$LOG"
break
elif [[ $rate_limit -lt 3 ]]
then
printf "%s\t - Anilist API limit reached watiting 30s" "$(date +%H:%M:%S)" | tee -a "$LOG"
sleep 30
printf "%s\t - done\n" "$(date +%H:%M:%S)" | tee -a "$LOG"
break
elif [[ $wait_time == 4 ]]
then
printf "%s - Error can't download anilist data stopping script\n" "$(date +%H:%M:%S)" | tee -a "$LOG"
exit 1
fi
done
jq '.data.Page.media[].id' -r "$SCRIPT_FOLDER/config/tmp/ongoing-anilist.json" >> "$SCRIPT_FOLDER/config/tmp/ongoing-tmp.tsv" # store the mal ID of the ongoing show
Expand Down Expand Up @@ -139,7 +157,7 @@ do
fi
fi
done < "$SCRIPT_FOLDER/config/tmp/ongoing.tsv"
printf "%s\t - Done\n\n" "$(date +%H:%M:%S)"
printf "%s\t - Done\n" "$(date +%H:%M:%S)"
printf "%s - Done\n\n" "$(date +%H:%M:%S)"

# write PMM metadata file from ID/animes.tsv and jikan API
Expand Down
26 changes: 19 additions & 7 deletions config/default.env
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ SORT_TITLE_ENG=No
ORIGINAL_TITLE_NATIVE=Yes
# Rename season to the anilist title of that season (Yes/No)
RENAME_SEASONS=Yes
# Anilist have some full uppercase title, this settings will remove them "86 EIGHTY-SIX" > "86 Eighty-Six" (Yes/No)
REDUCE_TITLE_CAPS=Yes
# Disable anilist tags (Yes/No)
DISABLE_TAGS=No
# Add a default "Anime" tag to everything (Yes/No)
ADD_ANIME_TAG=Yes
#Grab anilist tags higher or equal than percentage (0-100)
ANILIST_TAGS_P=70
# Download poster (Yes/No)
Expand All @@ -67,13 +73,19 @@ POSTER_SEASON_DOWNLOAD=Yes
POSTER_SOURCE=ANILIST
# 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, ...)
SEASON_YEAR=No
# Disable anilist tags
DISABLE_TAGS=No
# Ignore season rating for animmes with only 1 season (Yes/No)
IGNORE_S1_ONLY_RATING=Yes
# Add Anime Awards winner for seasons and shows
ANIME_AWARDS=Yes
# Ignore non japanese voice actor awards (Yes/No)
ANIME_AWARDS_NO_FVA=Yes
# Add tags based on userlists from anilist (Completed, wathcing) (Yes/No)
ANILIST_LISTS=No
# Anilist username
ANILIST_USERNAME=Arialz
# For Shows the level tags should be added ("show", "season" or "both")
ANILIST_LISTS_LEVEL=show
# Mal Data cache time (in days min : 1)
DATA_CACHE_TIME=5
DATA_CACHE_TIME=5
5 changes: 2 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
version: "2.1"
services:
plex-romaji-renamer:
romaji-renamer:
image: arialz/romaji-renamer:dev
container_name: romaji-renamer
environment:
Expand All @@ -11,4 +10,4 @@ services:
volumes:
- /path/to/script/config:/config:rw
- /path/to/pmm/config:/pmm:rw
restart: no
restart: no
Loading