aboutsummaryrefslogtreecommitdiff
path: root/autocomplete-rescan.bash
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2024-02-19 13:47:56 -0500
committerB. Stack <bgstack15@gmail.com>2024-02-19 13:47:56 -0500
commit158983b29ad4a2027845c24070791dc2c66dc249 (patch)
tree4f94109de0e6dbc5fdbf70d0b1f41789c0877578 /autocomplete-rescan.bash
parentadd watched_episodes_for_show() (diff)
downloadjellystack-158983b29ad4a2027845c24070791dc2c66dc249.tar.gz
jellystack-158983b29ad4a2027845c24070791dc2c66dc249.tar.bz2
jellystack-158983b29ad4a2027845c24070791dc2c66dc249.zip
add show-manager and its autocomplete
Diffstat (limited to 'autocomplete-rescan.bash')
-rw-r--r--autocomplete-rescan.bash74
1 files changed, 0 insertions, 74 deletions
diff --git a/autocomplete-rescan.bash b/autocomplete-rescan.bash
deleted file mode 100644
index 06af729..0000000
--- a/autocomplete-rescan.bash
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/bin/bash
-# File: autocomplete-rescan.bash
-# Location: /mnt/public/Support/Programs/jellyfin/scripts/
-# Author: bgstack15, pawamoy
-# Startdate: 2024-01-28-1 21:40
-# SPDX-License-Identifier: CC-BY-SA-4.0
-# Title: Bash autocompletion for rescan-library
-# Project: jellystack
-# Purpose: Make it easy to choose a jellyfin library to rescan
-# History:
-# Usage:
-# dot-source it and then alias the script:
-# . /mnt/public/Support/Programs/jellyfin/autocmplete-rescan.bash
-# alias rescan-library=/mnt/public/Support/Programs/jellyfin/rescan-library.sh
-# Reference:
-# 1. https://stackoverflow.com/questions/44453510/how-to-autocomplete-a-bash-commandline-with-file-paths-from-a-specific-directory/47799826#47799826
-# 2. https://stackoverflow.com/questions/1146098/properly-handling-spaces-and-quotes-in-bash-completion
-# Improve:
-# Dependencies:
-# password stored in ~/.jellyfin.password
-# jellystack.py frontend and jellystack_lib.py
-
-_complete_specific_path() {
- # ripped from https://stackoverflow.com/questions/44453510/how-to-autocomplete-a-bash-commandline-with-file-paths-from-a-specific-directory/47799826#47799826 and modified for jellystack
- # alt which did not work: https://stackoverflow.com/questions/1146098/properly-handling-spaces-and-quotes-in-bash-completion
- /mnt/public/Support/Programs/jellyfin/scripts/jellystack.py --autocomplete 1>/dev/null # populates ~/.cache/jellystack
- # declare variables
- local _item _COMPREPLY _old_pwd
- thisdir=~/.cache/jellystack
-
- # if we already are in the completed directory, skip this part
- _old_pwd="${PWD}"
- # magic here: go the specific directory!
- pushd "${thisdir}" &>/dev/null || return
-
- # init completion and run _filedir inside specific directory
- _init_completion -s || return
- _filedir
-
- # iterate on original replies
- for _item in "${COMPREPLY[@]}"; do
- # this check seems complicated, but it handles the case
- # where you have files/dirs of the same name
- # in the current directory and in the completed one:
- # we want only one "/" appended
- #if [ -d "${_item}" ] && [[ "${_item}" != */ ]] && [ ! -d "${_old_pwd}/${_item}" ]; then
- # # append a slash if directory
- # _COMPREPLY+=("${_item}/")
- #else
- _COMPREPLY+=("${_item}")
- #fi
- done
-
- # popd as early as possible
- popd &>/dev/null
-
- # if only one reply and it is a directory, don't append a space
- # (don't know why we must check for length == 2 though)
- if [ ${#_COMPREPLY[@]} -eq 2 ]; then
- if [[ "${_COMPREPLY}" == */ ]]; then
- compopt -o nospace
- fi
- fi
-
- # set the values in the right COMPREPLY variable
- COMPREPLY=( "${_COMPREPLY[@]}" )
-
- # clean up
- unset _COMPREPLY
- unset _item
-}
-
-complete -F _complete_specific_path rescan-library
-alias rescan-library="/mnt/public/Support/Programs/jellyfin/scripts/rescan-library.sh"
bgstack15