From bd9cd09a25d6d177ea23872b2ed0784789397585 Mon Sep 17 00:00:00 2001 From: Udon <143291288+UdonCodes@users.noreply.github.com> Date: Fri, 19 Apr 2024 14:44:40 +0000 Subject: [PATCH] feat: updated README and added stale checker script (#58) --- README.md | 14 ++++---- assets/DateCheck.sh | 86 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+), 7 deletions(-) create mode 100644 assets/DateCheck.sh diff --git a/README.md b/README.md index f011389..042a343 100644 --- a/README.md +++ b/README.md @@ -27,8 +27,8 @@ - [jellyfin-ani-sync](https://github.com/vosmiic/jellyfin-ani-sync) - Automatically tracks anime watching progress on [Anilist](https://anilist.co/). - [jellyfin-plugin-media-analyzer](https://github.com/endrl/jellyfin-plugin-media-analyzer) - Fingerprint audio to automatically detect intro and outro segments in Jellyfin. - [jellyfin-ani-sync](https://github.com/vosmiic/jellyfin-ani-sync) - Synchronize anime watch status between Jellyfin and anime tracking sites. -- [Jellyfin Ignore ` 🔸 `](https://github.com/fdett/jellyfin-ignore/) - Ignore filename patterns on library scans. -- [Jellyfin-Newsletter-Plugin ` 🔸 `](https://github.com/Cloud9Developer/Jellyfin-Newsletter-Plugin) - Newsletters for recently added media. +- [Jellyfin Ignore ` 🔸 ` `📅`](https://github.com/fdett/jellyfin-ignore/) - Ignore filename patterns on library scans. +- [Jellyfin-Newsletter-Plugin ` 🔸 ` `📅`](https://github.com/Cloud9Developer/Jellyfin-Newsletter-Plugin) - Newsletters for recently added media. - [jellyfin-plugin-enigma2 `📅`](https://github.com/knackebrot/jellyfin-plugin-enigma2) - Supports Vu+ & Enigma2 live TV streamers. - [jellyfin-plugin-ldapauth](https://github.com/jellyfin/jellyfin-plugin-ldapauth) - Allows the use of ldap as an auth provider. - [jellyfin-plugin-skin-manager ` 📅 `](https://github.com/danieladov/jellyfin-plugin-skin-manager) - Helps you to download and install skins. @@ -39,7 +39,7 @@ #### 🏷️ Metadata Providers -- [jellyfin-youtube-metadata-plugin](https://github.com/ankenyr/jellyfin-youtube-metadata-plugin) - YouTube Metadata Plugin. +- [jellyfin-youtube-metadata-plugin `📅`](https://github.com/ankenyr/jellyfin-youtube-metadata-plugin) - YouTube Metadata Plugin. ## 🖌️ Themes @@ -52,7 +52,7 @@ ## 👾 Other -- [autoscan](https://github.com/Cloudbox/autoscan) - Replaces the default Plex and Emby behaviour for picking up changes on the file system. +- [autoscan `📅`](https://github.com/Cloudbox/autoscan) - Replaces the default Plex and Emby behaviour for picking up changes on the file system. - [Fixarr ` 🔸 `](https://github.com/sachinsenal0x64/FIXARR) - Media Renamer and Backup tool. (Backup still WIP) - [jellyfin-cover-art-generator](https://github.com/Tetrax-10/jellyfin-cover-art-generator) - CLI tool to generate Jellyfin styled library coverart from a backdrop. - [jellyfin-mods](https://github.com/BobHasNoSoul/jellyfin-mods) - A collection of things you can do to personalize Jellyfin. @@ -81,16 +81,16 @@ This section includes software, guides and tools that are not *specifically* designed to work with Jellyfin, but can be useful for tasks related to media management or to enhance Jellyfin's functionality. - [calibre2jellyfin](https://github.com/shawn61cp/calibre2jellyfin) - Python script to construct a Jellyfin ebook library from a Calibre library. -- [ErsatzTV ` 🔸 `](https://github.com/jasongdove/ErsatzTV) - Stream custom live channels using your own media. +- [ErsatzTV ` 🔸 `](https://github.com/ErsatzTV/ErsatzTV) - Stream custom live channels using your own media. - [locatarr](https://github.com/Locatarr/Locatarr) - A list of tools used to automate the downloading and organization of media files. - [radarr](https://github.com/Radarr/Radarr) - Automates downloading & management of movies [`🟣 TRaSH Guide`](https://trash-guides.info/Radarr/). - [sonarr](https://github.com/Sonarr/Sonarr) - Automates downloading & management of TV series [`🟣 TRaSH Guide`](https://trash-guides.info/Sonarr/). - [tdarr ` 📛 `](https://github.com/HaveAGitGat/Tdarr) - Distributed transcode automation + Library analytics + Video health checking. - [recyclarr](https://github.com/recyclarr/recyclarr) - Automatically sync TRaSH guides to Sonarr and Radarr instances. -- [MediaTracker](https://github.com/bonukai/MediaTracker) - Media tracker and user rating platform with [Jellyfin integration](https://github.com/bonukai/jellyfin-plugin-mediatracker). +- [MediaTracker `📅`](https://github.com/bonukai/MediaTracker) - Media tracker and user rating platform with [Jellyfin integration](https://github.com/bonukai/jellyfin-plugin-mediatracker). - [Movary ` 🔸 `](https://github.com/leepeuker/movary) - Media tracker and user rating platform. - [Multi Scrobbler ` 🔸 `](https://github.com/foxxmd/multi-scrobbler) - Scrobbles music from many sources to many clients. -- [rffmpeg](https://github.com/joshuaboniface/rffmpeg) - A remote FFmpeg wrapper, commonly used for transcoding media on more capable machines. +- [rffmpeg `📅`](https://github.com/joshuaboniface/rffmpeg) - A remote FFmpeg wrapper, commonly used for transcoding media on more capable machines. - [Threadfin](https://github.com/Threadfin/Threadfin) - M3U proxy for Jellyfin (Based on xTeVe). - [TRaSH Guides](https://trash-guides.info/) - Easy-to-understand guides for Sonarr, Radarr, and Bazarr, along with related tools. - [watchstate](https://github.com/ArabCoders/watchstate) - Sync play state between different media servers. diff --git a/assets/DateCheck.sh b/assets/DateCheck.sh new file mode 100644 index 0000000..a5e931e --- /dev/null +++ b/assets/DateCheck.sh @@ -0,0 +1,86 @@ +#!/bin/bash + +# Check if a GitHub API token is provided +if [ "$#" -ne 2 ] || [ "$1" != "-api" ]; then + echo -e "${RED}Usage:>${NOCOLOR} $0 -api " + exit 1 +fi + +API_TOKEN=$2 +API_HEADER="Authorization: token $API_TOKEN" +README_PATH="../README.md" +SIX_MONTHS=$(date -d "6 months ago" +%s) +PROPOSED_CHANGES=() + +# Color codes for console output +GREEN='\033[0;32m' +RED='\033[0;31m' +YELLOW='\033[1;33m' +NOCOLOR='\033[0m' + +# Check if README.md exists +if [ ! -f "$README_PATH" ]; then + echo -e "${RED}README.md not found in path:${NOCOLOR} $README_PATH" + exit 1 +fi + +# Parse README.md and collect information +while IFS= read -r line; do + original_text=$(echo "$line" | sed -E 's/^- \[([^]]+)\].*/\1/') + text=$(echo "$original_text" | sed -E 's/ `[^`]+`//g') # Remove existing indicators + url=$(echo "$line" | sed -E 's/.*\]\(([^)]+)\).*/\1/') + + if [[ $url == https://github.com* ]]; then + repo_path=$(echo $url | cut -d/ -f4-5) + response=$(curl -s -H "$API_HEADER" "https://api.github.com/repos/$repo_path") + + # Fetch additional details for forked repositories + is_fork=$(echo $response | grep '"fork": true') + if [ ! -z "$is_fork" ]; then + parent_repo=$(echo $response | grep '"parent":' | grep -o '"full_name": "[^"]*"' | cut -d '"' -f 4) + if [ ! -z "$parent_repo" ]; then + parent_response=$(curl -s -H "$API_HEADER" "https://api.github.com/repos/$parent_repo") + response=$parent_response + fi + fi + + # Get the latest commit date + commits_url=$(echo $response | grep '"commits_url":' | sed -E 's/.*"commits_url": "([^"]+)".*/\1/') + commits_url="${commits_url/\{\/sha\}/}" + latest_commit=$(curl -s -H "$API_HEADER" "${commits_url}?per_page=1") + last_commit_date=$(echo $latest_commit | grep '"date":' | head -1 | sed -E 's/.*"date": "([^"]+)".*/\1/' | cut -c 1-10) + last_commit_sec=$(date -d "$last_commit_date" +%s) + + # Compare with six months ago + if [[ $last_commit_sec -lt $SIX_MONTHS && ! $original_text == *📅* ]]; then + PROPOSED_CHANGES+=("$original_text - Date: $last_commit_date - URL: $url") + fi + fi +done < <(grep '^-\ \[' "$README_PATH") + +# Display proposed changes separately +echo -e "${YELLOW}Proposed Changes:${NOCOLOR}" +if [ ${#PROPOSED_CHANGES[@]} -eq 0 ]; then + echo -e "${GREEN}No changes required.${NOCOLOR}" +else + for change in "${PROPOSED_CHANGES[@]}"; do + echo "$change" + done + + # Ask for user confirmation + echo -e "${YELLOW}Would you like to apply these changes?${NOCOLOR} (y/n)" + read -r user_input + + if [[ $user_input == "y" ]]; then + # Apply the changes + for change in "${PROPOSED_CHANGES[@]}"; do + text=$(echo "$change" | sed -E 's/ - Date:.*//') # Extract text without date and URL + if ! grep -q "\[$text \`📅\`\]" "$README_PATH"; then + sed -i "s|-\ \[$text\]|- \[$text \`📅\`]|" "$README_PATH" + fi + done + echo -e "${GREEN}README.md has been updated.${NOCOLOR}" + else + echo -e "${RED}Changes were declined.${NOCOLOR}" + fi +fi