|
| 1 | +{ pkgs, ... }: |
| 2 | + |
| 3 | +let |
| 4 | + # List of trusted media sources (add new sites here!) |
| 5 | + mediaSources = { |
| 6 | + archive = "https://archive.org/details/"; |
| 7 | + youtube = "https://www.youtube.com/results?search_query="; |
| 8 | + topflix = "https://topflix.fm/search/"; |
| 9 | + documentary = "https://documentaryheaven.com/?s="; |
| 10 | + vidsrc = "https://vidsrc.me/embed/"; |
| 11 | + assistir = "https://assistir.biz/?s="; |
| 12 | + upnovelas = "https://upnovelas.com/?s="; |
| 13 | + pobleflix = "https://pobleflix.fast/"; |
| 14 | + vizer = "https://vizer.lol/pesquisar/"; |
| 15 | + plutotv = "https://pluto.tv/on-demand/"; |
| 16 | + }; |
| 17 | + |
| 18 | + # Generate formatted string for the shell helper |
| 19 | + sourceList = builtins.concatStringsSep "\n" ( |
| 20 | + map (name: "${name} - ${builtins.getAttr name mediaSources}") (builtins.attrNames mediaSources) |
| 21 | + ); |
| 22 | +in |
| 23 | +{ |
| 24 | + programs.bash.initExtra = '' |
| 25 | + # Media Source Manager Helper |
| 26 | + # Usage: |
| 27 | + # mm list - List saved sources |
| 28 | + # mm go - Interactive search using fzf to pick a source |
| 29 | + mm() { |
| 30 | + case "$1" in |
| 31 | + "list") |
| 32 | + echo -e "\033[1;34m--- Saved Media Sources ---\033[0m" |
| 33 | + echo "${sourceList}" | column -t -s "-" |
| 34 | + ;; |
| 35 | + "go") |
| 36 | + local source=$(echo "${sourceList}" | fzf --prompt="Select Source: " | awk '{print $NF}') |
| 37 | + if [ -n "$source" ]; then |
| 38 | + echo -e "\033[1;32mURL available:\033[0m $source" |
| 39 | + # Copying to clipboard if needed (platform dependent) |
| 40 | + # echo -n "$source" | xclip -selection clipboard 2>/dev/null |
| 41 | + fi |
| 42 | + ;; |
| 43 | + *) |
| 44 | + echo "Usage: mm [list|go]" |
| 45 | + echo "To download found media: b [URL]" |
| 46 | + ;; |
| 47 | + esac |
| 48 | + } |
| 49 | + ''; |
| 50 | +} |
0 commit comments