Name : Make name_series auto-determine season number.

This commit is contained in:
Dmitry Voronin 2023-12-30 22:17:44 +03:00
parent 57b1bf98f9
commit 984b7d3f42

View file

@ -135,17 +135,17 @@ function name_hash_check() {
# Rename files for Jellyfin series, i.e. `Episode S01E01.mkv` # Rename files for Jellyfin series, i.e. `Episode S01E01.mkv`
# All files by default. # All files by default.
# Usage: name_series <SEASON> [FILES] # Usage: name_series [FILES]
function name_series() { function name_series() {
local IFS=$'\n' local IFS=$'\n'
local season=${1} local season="$(realpath .)"; season="${season##*\ }"
local episode=0 local episode=0
local targets=(${@:2}) local targets=(${@})
[[ "${targets}" = "" ]] && targets=($(_ls_file)) [[ "${targets}" = "" ]] && targets=($(_ls_file))
# Error when no season number specified. # Error when no season number specified.
if [[ "${season}" = "" ]]; then if [[ "${season}" = "" ]]; then
echo "usage: name_series <SEASON> [FILES]" _error "Could not determine season number."
return 2 return 2
fi fi
@ -178,7 +178,7 @@ function name_manga() {
# Error when no season number specified. # Error when no season number specified.
if [[ "${season}" = "" ]]; then if [[ "${season}" = "" ]]; then
echo "usage: name_manga <SEASON> [FILES]" help name_manga
return 2 return 2
fi fi