Compare commits
9 Commits
921fb79197
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
03b96050bc
|
|||
|
b3936cd23a
|
|||
|
a0b1a11c7d
|
|||
|
dded3a9c66
|
|||
|
990e0f93c2
|
|||
|
c5a060bf29
|
|||
|
283a6482e9
|
|||
|
bc4c207d9b
|
|||
|
419833cdcd
|
3
private_dot_config/env/run_after_all.sh
vendored
Normal file
3
private_dot_config/env/run_after_all.sh
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
update_env
|
||||
@@ -17,11 +17,8 @@ export ANSIBLE_GALAXY_CACHE_DIR="$XDG_CACHE_HOME/ansible/galaxy_cache"
|
||||
#NOTE: for the tmp dir on remotes sould be configuard in ansible.cfg
|
||||
|
||||
# fix rust dirs
|
||||
export RUSTUP_HOME="$HOME/.local/rust/rustup"
|
||||
export CARGO_HOME="$HOME/.local/rust/cargo"
|
||||
|
||||
# fix discord dirs
|
||||
# export DISCORD_USER_DATA_DIR="$XDG_DATA_HOME"
|
||||
export DISCORD_USER_DATA_DIR="$XDG_DATA_HOME"
|
||||
|
||||
# fix docker dirs
|
||||
export DOCKER_CONFIG="$XDG_CONFIG_HOME/docker"
|
||||
@@ -48,8 +45,3 @@ export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc"
|
||||
|
||||
# fix java dirs
|
||||
export _JAVA_OPTIONS="-Djava.util.prefs.userRoot=$XDG_CONFIG_HOME/java"
|
||||
|
||||
|
||||
# pico SDK
|
||||
export PICO_SDK_PATH="$HOME/.local/rpi/pico-sdk"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
source "$HOME/.config/env"
|
||||
source "$HOME/.config/env/all"
|
||||
|
||||
if status is-interactive
|
||||
|
||||
@@ -9,8 +9,6 @@ if status is-interactive
|
||||
|
||||
export EDITOR=vim
|
||||
|
||||
# TODO: ssh-agent
|
||||
|
||||
# fuzzy find
|
||||
export FZF_CTRL_T_OPTS="
|
||||
--walker-skip .git,node_modules,target,.var
|
||||
@@ -24,7 +22,7 @@ if status is-interactive
|
||||
alias cdf='cd $(_cd_fzf)'
|
||||
|
||||
alias dot=chezmoi
|
||||
alias codium="/usr/bin/codium --enable-features=UseOzonePlatform,WaylandWindowDecorations --ozone-platform=wayland"
|
||||
alias codium="codium --enable-features=UseOzonePlatform,WaylandWindowDecorations --ozone-platform=wayland"
|
||||
|
||||
# prompt
|
||||
oh-my-posh init fish --config "$HOME/.config/oh-my-posh.toml" | source
|
||||
|
||||
8
private_dot_config/menu/executable_hr_rts.sh
Normal file
8
private_dot_config/menu/executable_hr_rts.sh
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
spawn="niri msg action spawn --"
|
||||
|
||||
$spawn codium --enable-features=UseOzonePlatform,WaylandWindowDecorations \
|
||||
--ozone-platform=wayland --new-window $HOME/projects/HR/rts10_reports/
|
||||
# $spawn flatpak run md.obsidian.Obsidian file://$HOME/projects/hr/rts10_reports/
|
||||
$spawn open obsidian://open?vault=$HOME/projects/HR/rts10_reports/
|
||||
1
private_dot_config/menu/hr
Normal file
1
private_dot_config/menu/hr
Normal file
@@ -0,0 +1 @@
|
||||
real time systems:exec:./hr_rts.sh
|
||||
11
private_dot_config/menu/run_proj.sh
Normal file
11
private_dot_config/menu/run_proj.sh
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
mkdir -p "$HOME/.config/menu"
|
||||
echo -n >"$HOME/.config/menu/proj"
|
||||
|
||||
for proj in $(find "$HOME/projects" -maxdepth 3 -type d -name '\.git')
|
||||
do
|
||||
name="$(echo $proj | sed -e "s|^$HOME/projects/||" -e 's|/\.git$||')"
|
||||
echo "$name:exec:alacritty --working-directory=$HOME/projects/$name" \
|
||||
>>"$HOME/.config/menu/proj"
|
||||
done
|
||||
@@ -1 +0,0 @@
|
||||
real time systems:exec:./hr/rts.sh
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
spawn="niri msg action spawn --"
|
||||
|
||||
$spawn codium $HOME/projects/hr/rts10_reports/
|
||||
$spawn flatpak run md.obsidian.Obsidian $HOME/projects/hr/rts10_reports/
|
||||
@@ -1,126 +0,0 @@
|
||||
ems31_2024-2025_groep_2_ccs:exec:kgx --working-directory=$HOME/projects/ems31_2024-2025_groep_2_ccs
|
||||
ems31_2024-2025_groep_2_wsl:exec:kgx --working-directory=$HOME/projects/ems31_2024-2025_groep_2_wsl
|
||||
escaperoom/pages:exec:kgx --working-directory=$HOME/projects/escaperoom/pages
|
||||
ffmpeg:exec:kgx --working-directory=$HOME/projects/ffmpeg
|
||||
freenen/3dprinter_profiles:exec:kgx --working-directory=$HOME/projects/freenen/3dprinter_profiles
|
||||
freenen/ansible-authelia:exec:kgx --working-directory=$HOME/projects/freenen/ansible-authelia
|
||||
freenen/ansible-codimd:exec:kgx --working-directory=$HOME/projects/freenen/ansible-codimd
|
||||
freenen/ansible-collabora:exec:kgx --working-directory=$HOME/projects/freenen/ansible-collabora
|
||||
freenen/ansible-docker:exec:kgx --working-directory=$HOME/projects/freenen/ansible-docker
|
||||
freenen/ansible-firefly-iii:exec:kgx --working-directory=$HOME/projects/freenen/ansible-firefly-iii
|
||||
freenen/ansible-git:exec:kgx --working-directory=$HOME/projects/freenen/ansible-git
|
||||
freenen/ansible-gitea:exec:kgx --working-directory=$HOME/projects/freenen/ansible-gitea
|
||||
freenen/ansible-gitea-act-runner:exec:kgx --working-directory=$HOME/projects/freenen/ansible-gitea-act-runner
|
||||
freenen/ansible-grafana:exec:kgx --working-directory=$HOME/projects/freenen/ansible-grafana
|
||||
freenen/ansible-lamp:exec:kgx --working-directory=$HOME/projects/freenen/ansible-lamp
|
||||
freenen/ansible-minecraft-server:exec:kgx --working-directory=$HOME/projects/freenen/ansible-minecraft-server
|
||||
freenen/ansible-mqtt:exec:kgx --working-directory=$HOME/projects/freenen/ansible-mqtt
|
||||
freenen/ansible-mysql:exec:kgx --working-directory=$HOME/projects/freenen/ansible-mysql
|
||||
freenen/ansible-nextcloud:exec:kgx --working-directory=$HOME/projects/freenen/ansible-nextcloud
|
||||
freenen/ansible-pi-hole:exec:kgx --working-directory=$HOME/projects/freenen/ansible-pi-hole
|
||||
freenen/ansible-prometheus:exec:kgx --working-directory=$HOME/projects/freenen/ansible-prometheus
|
||||
freenen/ansible-proxymanager:exec:kgx --working-directory=$HOME/projects/freenen/ansible-proxymanager
|
||||
freenen/ansible-rustdesk:exec:kgx --working-directory=$HOME/projects/freenen/ansible-rustdesk
|
||||
freenen/ansible-server-base:exec:kgx --working-directory=$HOME/projects/freenen/ansible-server-base
|
||||
freenen/ansible-vscode-server:exec:kgx --working-directory=$HOME/projects/freenen/ansible-vscode-server
|
||||
freenen/ansible-zigbee2mqtt:exec:kgx --working-directory=$HOME/projects/freenen/ansible-zigbee2mqtt
|
||||
freenen/astrid:exec:kgx --working-directory=$HOME/projects/freenen/astrid
|
||||
freenen/babaisyousolver:exec:kgx --working-directory=$HOME/projects/freenen/babaisyousolver
|
||||
freenen/bakje:exec:kgx --working-directory=$HOME/projects/freenen/bakje
|
||||
freenen/contacts:exec:kgx --working-directory=$HOME/projects/freenen/contacts
|
||||
freenen/dasbob:exec:kgx --working-directory=$HOME/projects/freenen/dasbob
|
||||
freenen/dasbob_qmk:exec:kgx --working-directory=$HOME/projects/freenen/dasbob_qmk
|
||||
freenen/dometimer:exec:kgx --working-directory=$HOME/projects/freenen/dometimer
|
||||
freenen/downloads:exec:kgx --working-directory=$HOME/projects/freenen/downloads
|
||||
freenen/elfos:exec:kgx --working-directory=$HOME/projects/freenen/elfos
|
||||
freenen/elven_cli:exec:kgx --working-directory=$HOME/projects/freenen/elven_cli
|
||||
freenen/embassy:exec:kgx --working-directory=$HOME/projects/freenen/embassy
|
||||
freenen/energyPulseCounter:exec:kgx --working-directory=$HOME/projects/freenen/energyPulseCounter
|
||||
freenen/hasio-addons:exec:kgx --working-directory=$HOME/projects/freenen/hasio-addons
|
||||
freenen/keycounter:exec:kgx --working-directory=$HOME/projects/freenen/keycounter
|
||||
freenen/keys:exec:kgx --working-directory=$HOME/projects/freenen/keys
|
||||
freenen/kicad-build:exec:kgx --working-directory=$HOME/projects/freenen/kicad-build
|
||||
freenen/kladjes:exec:kgx --working-directory=$HOME/projects/freenen/kladjes
|
||||
freenen/kladjes.html:exec:kgx --working-directory=$HOME/projects/freenen/kladjes.html
|
||||
freenen/klippertoolboard:exec:kgx --working-directory=$HOME/projects/freenen/klippertoolboard
|
||||
freenen/labvoeding-front:exec:kgx --working-directory=$HOME/projects/freenen/labvoeding-front
|
||||
freenen/makitapowerbank:exec:kgx --working-directory=$HOME/projects/freenen/makitapowerbank
|
||||
freenen/maps:exec:kgx --working-directory=$HOME/projects/freenen/maps
|
||||
freenen/mbc_barritoolpcb:exec:kgx --working-directory=$HOME/projects/freenen/mbc_barritoolpcb
|
||||
freenen/minecraft-clone:exec:kgx --working-directory=$HOME/projects/freenen/minecraft-clone
|
||||
freenen/Monikers:exec:kgx --working-directory=$HOME/projects/freenen/Monikers
|
||||
freenen/mp3_pcb:exec:kgx --working-directory=$HOME/projects/freenen/mp3_pcb
|
||||
freenen/mqttAutomation:exec:kgx --working-directory=$HOME/projects/freenen/mqttAutomation
|
||||
freenen/mqttclient:exec:kgx --working-directory=$HOME/projects/freenen/mqttclient
|
||||
freenen/mqttClock:exec:kgx --working-directory=$HOME/projects/freenen/mqttClock
|
||||
freenen/mr-iot:exec:kgx --working-directory=$HOME/projects/freenen/mr-iot
|
||||
freenen/mute_experiment:exec:kgx --working-directory=$HOME/projects/freenen/mute_experiment
|
||||
freenen/nixconfig:exec:kgx --working-directory=$HOME/projects/freenen/nixconfig
|
||||
freenen/noteapp:exec:kgx --working-directory=$HOME/projects/freenen/noteapp
|
||||
freenen/notes:exec:kgx --working-directory=$HOME/projects/freenen/notes
|
||||
freenen/obsidian_fr-calendar:exec:kgx --working-directory=$HOME/projects/freenen/obsidian_fr-calendar
|
||||
freenen/oscilloscoop:exec:kgx --working-directory=$HOME/projects/freenen/oscilloscoop
|
||||
freenen/pages:exec:kgx --working-directory=$HOME/projects/freenen/pages
|
||||
freenen/penningbot:exec:kgx --working-directory=$HOME/projects/freenen/penningbot
|
||||
freenen/portfolioWebsite:exec:kgx --working-directory=$HOME/projects/freenen/portfolioWebsite
|
||||
freenen/pringels_config:exec:kgx --working-directory=$HOME/projects/freenen/pringels_config
|
||||
freenen/qmk_firmware:exec:kgx --working-directory=$HOME/projects/freenen/qmk_firmware
|
||||
freenen/QR_knowledgebase:exec:kgx --working-directory=$HOME/projects/freenen/QR_knowledgebase
|
||||
freenen/rcrf-wifi:exec:kgx --working-directory=$HOME/projects/freenen/rcrf-wifi
|
||||
freenen/relayclient:exec:kgx --working-directory=$HOME/projects/freenen/relayclient
|
||||
freenen/rotoryencoder:exec:kgx --working-directory=$HOME/projects/freenen/rotoryencoder
|
||||
freenen/rp2040_c:exec:kgx --working-directory=$HOME/projects/freenen/rp2040_c
|
||||
freenen/rp2040_projects:exec:kgx --working-directory=$HOME/projects/freenen/rp2040_projects
|
||||
freenen/rp2040-project-template:exec:kgx --working-directory=$HOME/projects/freenen/rp2040-project-template
|
||||
freenen/rustlings:exec:kgx --working-directory=$HOME/projects/freenen/rustlings
|
||||
freenen/rzh-server:exec:kgx --working-directory=$HOME/projects/freenen/rzh-server
|
||||
freenen/scrum-board:exec:kgx --working-directory=$HOME/projects/freenen/scrum-board
|
||||
freenen/servermanager:exec:kgx --working-directory=$HOME/projects/freenen/servermanager
|
||||
freenen/soldeerstation:exec:kgx --working-directory=$HOME/projects/freenen/soldeerstation
|
||||
freenen/sshkeys:exec:kgx --working-directory=$HOME/projects/freenen/sshkeys
|
||||
freenen/stofzuiger:exec:kgx --working-directory=$HOME/projects/freenen/stofzuiger
|
||||
freenen/taklift:exec:kgx --working-directory=$HOME/projects/freenen/taklift
|
||||
freenen/tasky:exec:kgx --working-directory=$HOME/projects/freenen/tasky
|
||||
freenen/tempmeter:exec:kgx --working-directory=$HOME/projects/freenen/tempmeter
|
||||
freenen/tmc_control:exec:kgx --working-directory=$HOME/projects/freenen/tmc_control
|
||||
freenen/viool:exec:kgx --working-directory=$HOME/projects/freenen/viool
|
||||
freenen/voltarush:exec:kgx --working-directory=$HOME/projects/freenen/voltarush
|
||||
freenen/webtemplate:exec:kgx --working-directory=$HOME/projects/freenen/webtemplate
|
||||
freenen/webtemplate_differant:exec:kgx --working-directory=$HOME/projects/freenen/webtemplate_differant
|
||||
gridfinity-rebuilt-openscad:exec:kgx --working-directory=$HOME/projects/gridfinity-rebuilt-openscad
|
||||
hedgedoc:exec:kgx --working-directory=$HOME/projects/hedgedoc
|
||||
hr/ane10.2_pcb1:exec:kgx --working-directory=$HOME/projects/hr/ane10.2_pcb1
|
||||
hr/ane10.3_pcb1:exec:kgx --working-directory=$HOME/projects/hr/ane10.3_pcb1
|
||||
hr/ane10.3_pcb2:exec:kgx --working-directory=$HOME/projects/hr/ane10.3_pcb2
|
||||
hr/ane10_pcb1:exec:kgx --working-directory=$HOME/projects/hr/ane10_pcb1
|
||||
hr/ane21_cm4:exec:kgx --working-directory=$HOME/projects/hr/ane21_cm4
|
||||
hr/csc10_labs:exec:kgx --working-directory=$HOME/projects/hr/csc10_labs
|
||||
hr/dis10:exec:kgx --working-directory=$HOME/projects/hr/dis10
|
||||
hr/eep71_code:exec:kgx --working-directory=$HOME/projects/hr/eep71_code
|
||||
hr/ems20_handshake:exec:kgx --working-directory=$HOME/projects/hr/ems20_handshake
|
||||
hr/ems31:exec:kgx --working-directory=$HOME/projects/hr/ems31
|
||||
hr/ems31_ccs:exec:kgx --working-directory=$HOME/projects/hr/ems31_ccs
|
||||
hr/ems31_eindopdracht2:exec:kgx --working-directory=$HOME/projects/hr/ems31_eindopdracht2
|
||||
hr/ems31_submodules:exec:kgx --working-directory=$HOME/projects/hr/ems31_submodules
|
||||
hr/ems31_wsl:exec:kgx --working-directory=$HOME/projects/hr/ems31_wsl
|
||||
hr/eps10:exec:kgx --working-directory=$HOME/projects/hr/eps10
|
||||
hr/hwp01_labs:exec:kgx --working-directory=$HOME/projects/hr/hwp01_labs
|
||||
hr/pee20_motioncontroller:exec:kgx --working-directory=$HOME/projects/hr/pee20_motioncontroller
|
||||
hr/pee30_belasting:exec:kgx --working-directory=$HOME/projects/hr/pee30_belasting
|
||||
hr/PEE51_formula_documents:exec:kgx --working-directory=$HOME/projects/hr/PEE51_formula_documents
|
||||
hr/pee51_gan_motor_driver:exec:kgx --working-directory=$HOME/projects/hr/pee51_gan_motor_driver
|
||||
hr/pee51_pcb:exec:kgx --working-directory=$HOME/projects/hr/pee51_pcb
|
||||
hr/pee71_documents:exec:kgx --working-directory=$HOME/projects/hr/pee71_documents
|
||||
hr/pee71_eeprom_test:exec:kgx --working-directory=$HOME/projects/hr/pee71_eeprom_test
|
||||
hr/rts10_assignment_project_files:exec:kgx --working-directory=$HOME/projects/hr/rts10_assignment_project_files
|
||||
hr/rts10_labs:exec:kgx --working-directory=$HOME/projects/hr/rts10_labs
|
||||
hr/rts10_rust:exec:kgx --working-directory=$HOME/projects/hr/rts10_rust
|
||||
hr/rts10_verslagen:exec:kgx --working-directory=$HOME/projects/hr/rts10_verslagen
|
||||
hr/spc_stabilisatie_firmware:exec:kgx --working-directory=$HOME/projects/hr/spc_stabilisatie_firmware
|
||||
hr/stg30_notes:exec:kgx --working-directory=$HOME/projects/hr/stg30_notes
|
||||
Kompas:exec:kgx --working-directory=$HOME/projects/Kompas
|
||||
pico-examples:exec:kgx --working-directory=$HOME/projects/pico-examples
|
||||
volta/wan-party-website:exec:kgx --working-directory=$HOME/projects/volta/wan-party-website
|
||||
volta/webgenerator:exec:kgx --working-directory=$HOME/projects/volta/webgenerator
|
||||
volta/website:exec:kgx --working-directory=$HOME/projects/volta/website
|
||||
volta/website-wp-thema:exec:kgx --working-directory=$HOME/projects/volta/website-wp-thema
|
||||
7
private_dot_config/mpd/mpd.conf
Normal file
7
private_dot_config/mpd/mpd.conf
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
database {
|
||||
plugin "simple"
|
||||
path "$HOME/.local/share/mpd/db"
|
||||
}
|
||||
|
||||
playlist_directory "$HOME/Music/Playlists"
|
||||
@@ -268,7 +268,7 @@ layout {
|
||||
// See the binds section below for more spawn examples.
|
||||
|
||||
// This line starts waybar, a commonly used bar for Wayland compositors.
|
||||
spawn-at-startup "waybar"
|
||||
//spawn-at-startup "waybar"
|
||||
|
||||
// To run a shell command (with variables, pipes, etc.), use spawn-sh-at-startup:
|
||||
// spawn-sh-at-startup "qs -c ~/source/qs/MyAwesomeShell"
|
||||
@@ -283,7 +283,7 @@ hotkey-overlay {
|
||||
// Additionally, clients will be informed that they are tiled, removing some client-side rounded corners.
|
||||
// This option will also fix border/focus ring drawing behind some semitransparent windows.
|
||||
// After enabling or disabling this, you need to restart the apps for this to take effect.
|
||||
// prefer-no-csd
|
||||
prefer-no-csd
|
||||
|
||||
// You can change the path where screenshots are saved.
|
||||
// A ~ at the front will be expanded to the home directory.
|
||||
|
||||
205
private_dot_config/waybar/config.jsonc
Normal file
205
private_dot_config/waybar/config.jsonc
Normal file
@@ -0,0 +1,205 @@
|
||||
// -*- mode: jsonc -*-
|
||||
{
|
||||
// "layer": "top", // Waybar at top layer
|
||||
// "position": "bottom", // Waybar position (top|bottom|left|right)
|
||||
"height": 30, // Waybar height (to be removed for auto height)
|
||||
// "width": 1280, // Waybar width
|
||||
"spacing": 4, // Gaps between modules (4px)
|
||||
// Choose the order of the modules
|
||||
"modules-left": [
|
||||
"niri/workspaces"
|
||||
// "sway/mode",
|
||||
// "sway/scratchpad",
|
||||
// "custom/media"
|
||||
],
|
||||
"modules-center": [
|
||||
"niri/window"
|
||||
],
|
||||
"modules-right": [
|
||||
// "mpd",
|
||||
// "idle_inhibitor",
|
||||
// "pulseaudio",
|
||||
// "power-profiles-daemon",
|
||||
// "cpu",
|
||||
// "memory",
|
||||
// "temperature",
|
||||
// "backlight",
|
||||
// "keyboard-state",
|
||||
// "niri/language",
|
||||
// "battery",
|
||||
"clock",
|
||||
"tray",
|
||||
"custom/power"
|
||||
],
|
||||
// Modules configuration
|
||||
// "sway/workspaces": {
|
||||
// "disable-scroll": true,
|
||||
// "all-outputs": true,
|
||||
// "warp-on-scroll": false,
|
||||
// "format": "{name}: {icon}",
|
||||
// "format-icons": {
|
||||
// "1": "",
|
||||
// "2": "",
|
||||
// "3": "",
|
||||
// "4": "",
|
||||
// "5": "",
|
||||
// "urgent": "",
|
||||
// "focused": "",
|
||||
// "default": ""
|
||||
// }
|
||||
// },
|
||||
"keyboard-state": {
|
||||
"numlock": true,
|
||||
"capslock": true,
|
||||
"format": "{name} {icon}",
|
||||
"format-icons": {
|
||||
"locked": "",
|
||||
"unlocked": ""
|
||||
}
|
||||
},
|
||||
"sway/mode": {
|
||||
"format": "<span style=\"italic\">{}</span>"
|
||||
},
|
||||
"sway/scratchpad": {
|
||||
"format": "{icon} {count}",
|
||||
"show-empty": false,
|
||||
"format-icons": ["", ""],
|
||||
"tooltip": true,
|
||||
"tooltip-format": "{app}: {title}"
|
||||
},
|
||||
"mpd": {
|
||||
"format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) ⸨{songPosition}|{queueLength}⸩ {volume}% ",
|
||||
"format-disconnected": "Disconnected ",
|
||||
"format-stopped": "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped ",
|
||||
"unknown-tag": "N/A",
|
||||
"interval": 5,
|
||||
"consume-icons": {
|
||||
"on": " "
|
||||
},
|
||||
"random-icons": {
|
||||
"off": "<span color=\"#f53c3c\"></span> ",
|
||||
"on": " "
|
||||
},
|
||||
"repeat-icons": {
|
||||
"on": " "
|
||||
},
|
||||
"single-icons": {
|
||||
"on": "1 "
|
||||
},
|
||||
"state-icons": {
|
||||
"paused": "",
|
||||
"playing": ""
|
||||
},
|
||||
"tooltip-format": "MPD (connected)",
|
||||
"tooltip-format-disconnected": "MPD (disconnected)"
|
||||
},
|
||||
"idle_inhibitor": {
|
||||
"format": "{icon}",
|
||||
"format-icons": {
|
||||
"activated": "",
|
||||
"deactivated": ""
|
||||
}
|
||||
},
|
||||
"tray": {
|
||||
// "icon-size": 21,
|
||||
"spacing": 10,
|
||||
// "icons": {
|
||||
// "blueman": "bluetooth",
|
||||
// "TelegramDesktop": "$HOME/.local/share/icons/hicolor/16x16/apps/telegram.png"
|
||||
// }
|
||||
},
|
||||
"clock": {
|
||||
// "timezone": "America/New_York",
|
||||
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
|
||||
"format-alt": "{:%Y-%m-%d}"
|
||||
},
|
||||
"cpu": {
|
||||
"format": "{usage}% ",
|
||||
"tooltip": false
|
||||
},
|
||||
"memory": {
|
||||
"format": "{}% "
|
||||
},
|
||||
"temperature": {
|
||||
// "thermal-zone": 2,
|
||||
// "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input",
|
||||
"critical-threshold": 80,
|
||||
// "format-critical": "{temperatureC}°C {icon}",
|
||||
"format": "{temperatureC}°C {icon}",
|
||||
"format-icons": ["", "", ""]
|
||||
},
|
||||
"backlight": {
|
||||
// "device": "acpi_video1",
|
||||
"format": "{percent}% {icon}",
|
||||
"format-icons": ["", "", "", "", "", "", "", "", ""]
|
||||
},
|
||||
"battery": {
|
||||
"states": {
|
||||
// "good": 95,
|
||||
"warning": 30,
|
||||
"critical": 15
|
||||
},
|
||||
"format": "{capacity}% {icon}",
|
||||
"format-full": "{capacity}% {icon}",
|
||||
"format-charging": "{capacity}% ",
|
||||
"format-plugged": "{capacity}% ",
|
||||
"format-alt": "{time} {icon}",
|
||||
// "format-good": "", // An empty format will hide the module
|
||||
// "format-full": "",
|
||||
"format-icons": ["", "", "", "", ""]
|
||||
},
|
||||
"power-profiles-daemon": {
|
||||
"format": "{icon}",
|
||||
"tooltip-format": "Power profile: {profile}\nDriver: {driver}",
|
||||
"tooltip": true,
|
||||
"format-icons": {
|
||||
"default": "",
|
||||
"performance": "",
|
||||
"balanced": "",
|
||||
"power-saver": ""
|
||||
}
|
||||
},
|
||||
"pulseaudio": {
|
||||
// "scroll-step": 1, // %, can be a float
|
||||
"format": "{volume}% {icon} {format_source}",
|
||||
"format-bluetooth": "{volume}% {icon} {format_source}",
|
||||
"format-bluetooth-muted": " {icon} {format_source}",
|
||||
"format-muted": " {format_source}",
|
||||
"format-source": "{volume}% ",
|
||||
"format-source-muted": "",
|
||||
"format-icons": {
|
||||
"headphone": "",
|
||||
"hands-free": "",
|
||||
"headset": "",
|
||||
"phone": "",
|
||||
"portable": "",
|
||||
"car": "",
|
||||
"default": ["", "", ""]
|
||||
},
|
||||
"on-click": "pavucontrol"
|
||||
},
|
||||
"custom/media": {
|
||||
"format": "{icon} {text}",
|
||||
"return-type": "json",
|
||||
"max-length": 40,
|
||||
"format-icons": {
|
||||
"spotify": "",
|
||||
"default": "🎜"
|
||||
},
|
||||
"escape": true,
|
||||
"exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null" // Script in resources folder
|
||||
// "exec": "$HOME/.config/waybar/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name
|
||||
},
|
||||
"custom/power": {
|
||||
"format" : "⏻ ",
|
||||
"tooltip": false,
|
||||
"menu": "on-click",
|
||||
"menu-file": "$HOME/.config/waybar/power_menu.xml", // Menu file in resources folder
|
||||
"menu-actions": {
|
||||
"shutdown": "shutdown",
|
||||
"reboot": "reboot",
|
||||
"logout": "niri msg action quit", // niri not found
|
||||
"hibernate": "systemctl hibernate"
|
||||
}
|
||||
}
|
||||
}
|
||||
28
private_dot_config/waybar/power_menu.xml
Normal file
28
private_dot_config/waybar/power_menu.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkMenu" id="menu">
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="logout">
|
||||
<property name="label">logout</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="hibernate">
|
||||
<property name="label">Hibernate</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="shutdown">
|
||||
<property name="label">Shutdown</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparatorMenuItem" id="delimiter1"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="reboot">
|
||||
<property name="label">Reboot</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
326
private_dot_config/waybar/style.css
Normal file
326
private_dot_config/waybar/style.css
Normal file
@@ -0,0 +1,326 @@
|
||||
* {
|
||||
/* `otf-font-awesome` is required to be installed for icons */
|
||||
font-family: FontAwesome, Roboto, Helvetica, Arial, sans-serif;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
window#waybar {
|
||||
background-color: rgba(43, 48, 59, 0.5);
|
||||
color: #ffffff;
|
||||
transition-property: background-color;
|
||||
transition-duration: .5s;
|
||||
}
|
||||
|
||||
window#waybar.hidden {
|
||||
opacity: 0.2;
|
||||
}
|
||||
|
||||
/*
|
||||
window#waybar.empty {
|
||||
background-color: transparent;
|
||||
}
|
||||
window#waybar.solo {
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
*/
|
||||
|
||||
window#waybar.termite {
|
||||
background-color: #3F3F3F;
|
||||
}
|
||||
|
||||
window#waybar.chromium {
|
||||
background-color: #000000;
|
||||
border: none;
|
||||
}
|
||||
|
||||
button {
|
||||
/* Use box-shadow instead of border so the text isn't offset */
|
||||
box-shadow: inset 0 -3px transparent;
|
||||
/* Avoid rounded borders under each button name */
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
|
||||
button:hover {
|
||||
background: inherit;
|
||||
box-shadow: inset 0 -3px #ffffff;
|
||||
}
|
||||
|
||||
/* you can set a style on hover for any module like this */
|
||||
#pulseaudio:hover {
|
||||
background-color: #a37800;
|
||||
}
|
||||
|
||||
#workspaces button {
|
||||
padding: 0 5px;
|
||||
background-color: transparent;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
#workspaces button:hover {
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
#workspaces button.focused, #workspaces button.active {
|
||||
background-color: #64727D;
|
||||
box-shadow: inset 0 -3px #ffffff;
|
||||
}
|
||||
|
||||
#workspaces button.urgent {
|
||||
background-color: #eb4d4b;
|
||||
}
|
||||
|
||||
#mode {
|
||||
background-color: #64727D;
|
||||
box-shadow: inset 0 -3px #ffffff;
|
||||
}
|
||||
|
||||
#clock,
|
||||
#battery,
|
||||
#cpu,
|
||||
#memory,
|
||||
#disk,
|
||||
#temperature,
|
||||
#backlight,
|
||||
#network,
|
||||
#pulseaudio,
|
||||
#wireplumber,
|
||||
#custom-media,
|
||||
#tray,
|
||||
#mode,
|
||||
#idle_inhibitor,
|
||||
#scratchpad,
|
||||
#power-profiles-daemon,
|
||||
#mpd {
|
||||
padding: 0 10px;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
#window,
|
||||
#workspaces {
|
||||
margin: 0 4px;
|
||||
}
|
||||
|
||||
/* If workspaces is the leftmost module, omit left margin */
|
||||
.modules-left > widget:first-child > #workspaces {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
/* If workspaces is the rightmost module, omit right margin */
|
||||
.modules-right > widget:last-child > #workspaces {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
#clock {
|
||||
background-color: #64727D;
|
||||
}
|
||||
|
||||
#battery {
|
||||
background-color: #ffffff;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
#battery.charging, #battery.plugged {
|
||||
color: #ffffff;
|
||||
background-color: #26A65B;
|
||||
}
|
||||
|
||||
@keyframes blink {
|
||||
to {
|
||||
background-color: #ffffff;
|
||||
color: #000000;
|
||||
}
|
||||
}
|
||||
|
||||
/* Using steps() instead of linear as a timing function to limit cpu usage */
|
||||
#battery.critical:not(.charging) {
|
||||
background-color: #f53c3c;
|
||||
color: #ffffff;
|
||||
animation-name: blink;
|
||||
animation-duration: 0.5s;
|
||||
animation-timing-function: steps(12);
|
||||
animation-iteration-count: infinite;
|
||||
animation-direction: alternate;
|
||||
}
|
||||
|
||||
#power-profiles-daemon {
|
||||
padding-right: 15px;
|
||||
}
|
||||
|
||||
#power-profiles-daemon.performance {
|
||||
background-color: #f53c3c;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
#power-profiles-daemon.balanced {
|
||||
background-color: #2980b9;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
#power-profiles-daemon.power-saver {
|
||||
background-color: #2ecc71;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
label:focus {
|
||||
background-color: #000000;
|
||||
}
|
||||
|
||||
#cpu {
|
||||
background-color: #2ecc71;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
#memory {
|
||||
background-color: #9b59b6;
|
||||
}
|
||||
|
||||
#disk {
|
||||
background-color: #964B00;
|
||||
}
|
||||
|
||||
#backlight {
|
||||
background-color: #90b1b1;
|
||||
}
|
||||
|
||||
#network {
|
||||
background-color: #2980b9;
|
||||
}
|
||||
|
||||
#network.disconnected {
|
||||
background-color: #f53c3c;
|
||||
}
|
||||
|
||||
#pulseaudio {
|
||||
background-color: #f1c40f;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
#pulseaudio.muted {
|
||||
background-color: #90b1b1;
|
||||
color: #2a5c45;
|
||||
}
|
||||
|
||||
#wireplumber {
|
||||
background-color: #fff0f5;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
#wireplumber.muted {
|
||||
background-color: #f53c3c;
|
||||
}
|
||||
|
||||
#custom-media {
|
||||
background-color: #66cc99;
|
||||
color: #2a5c45;
|
||||
min-width: 100px;
|
||||
}
|
||||
|
||||
#custom-media.custom-spotify {
|
||||
background-color: #66cc99;
|
||||
}
|
||||
|
||||
#custom-media.custom-vlc {
|
||||
background-color: #ffa000;
|
||||
}
|
||||
|
||||
#temperature {
|
||||
background-color: #f0932b;
|
||||
}
|
||||
|
||||
#temperature.critical {
|
||||
background-color: #eb4d4b;
|
||||
}
|
||||
|
||||
#tray {
|
||||
background-color: #2980b9;
|
||||
}
|
||||
|
||||
#tray > .passive {
|
||||
-gtk-icon-effect: dim;
|
||||
}
|
||||
|
||||
#tray > .needs-attention {
|
||||
-gtk-icon-effect: highlight;
|
||||
background-color: #eb4d4b;
|
||||
}
|
||||
|
||||
#idle_inhibitor {
|
||||
background-color: #2d3436;
|
||||
}
|
||||
|
||||
#idle_inhibitor.activated {
|
||||
background-color: #ecf0f1;
|
||||
color: #2d3436;
|
||||
}
|
||||
|
||||
#mpd {
|
||||
background-color: #66cc99;
|
||||
color: #2a5c45;
|
||||
}
|
||||
|
||||
#mpd.disconnected {
|
||||
background-color: #f53c3c;
|
||||
}
|
||||
|
||||
#mpd.stopped {
|
||||
background-color: #90b1b1;
|
||||
}
|
||||
|
||||
#mpd.paused {
|
||||
background-color: #51a37a;
|
||||
}
|
||||
|
||||
#language {
|
||||
background: #00b093;
|
||||
color: #740864;
|
||||
padding: 0 5px;
|
||||
margin: 0 5px;
|
||||
min-width: 16px;
|
||||
}
|
||||
|
||||
#keyboard-state {
|
||||
background: #97e1ad;
|
||||
color: #000000;
|
||||
padding: 0 0px;
|
||||
margin: 0 5px;
|
||||
min-width: 16px;
|
||||
}
|
||||
|
||||
#keyboard-state > label {
|
||||
padding: 0 5px;
|
||||
}
|
||||
|
||||
#keyboard-state > label.locked {
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
#scratchpad {
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
#scratchpad.empty {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
#privacy {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#privacy-item {
|
||||
padding: 0 5px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
#privacy-item.screenshare {
|
||||
background-color: #cf5700;
|
||||
}
|
||||
|
||||
#privacy-item.audio-in {
|
||||
background-color: #1ca000;
|
||||
}
|
||||
|
||||
#privacy-item.audio-out {
|
||||
background-color: #0069d4;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function install() {
|
||||
name=$1
|
||||
|
||||
@@ -1,44 +1,78 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
token="$1"
|
||||
page=1
|
||||
project_dir="$HOME/projects"
|
||||
|
||||
base_url="https://gitea.finnvanreenen.nl/api/v1"
|
||||
git_url="git@gitea.finnvanreenen.nl"
|
||||
function process_repo() {
|
||||
local json="$1"
|
||||
local remote_name="$2"
|
||||
|
||||
while [[ $page -lt 50 ]]
|
||||
do
|
||||
# echo
|
||||
echo "## get repo list page $page"
|
||||
repos="$(curl -X 'GET' "$base_url/user/repos?page=$page&token=$token" -H 'accept: application/json')"
|
||||
login="$(echo "$repos" | sed -e 's/^.*"login":"\([^"]*\)".*$/\1/')"
|
||||
local checkout="$project_dir"
|
||||
|
||||
if [[ "$repos" != "[]" ]]
|
||||
then
|
||||
for repo in $(echo "$repos" | sed -e 's/^\[{//' -e 's/}]$//' -e 's/},{/\n/g' -e 's/%/%p/g' -e 's/ /%20/g')
|
||||
do
|
||||
repo_json="$(echo "$repo" | sed -e 's/%20/ /g' -e 's/%p/%/g')"
|
||||
full_name="$(echo "$repo_json" | sed -e 's/^.*"full_name":"\([^"]*\)".*$/\1/')"
|
||||
clone_url="$(echo "$repo_json" | sed -e 's/^.*"clone_url":"\([^"]*\)".*$/\1/')"
|
||||
echo
|
||||
echo "### ${full_name,,}"
|
||||
|
||||
if [ -d "$project_dir/${full_name,,}" ]
|
||||
then
|
||||
cd "$project_dir/${full_name,,}"
|
||||
# git fetch
|
||||
else
|
||||
url="$(echo "$clone_url" | sed "s|://|://$login:$token@|")"
|
||||
git clone "$url" "$project_dir/${full_name,,}"
|
||||
git -C "$project_dir/${full_name,,}" remote set-url origin "$git_url:${full_name,,}.git"
|
||||
fi
|
||||
|
||||
done
|
||||
else
|
||||
echo "No more repositories found."
|
||||
page=999
|
||||
if [[ "$(echo "$json" | jq -r '.name')" == 'dotfiles' ]]; then
|
||||
return # do not clone dotfiles
|
||||
fi
|
||||
|
||||
page="$(( $page + 1 ))"
|
||||
done
|
||||
local full_name="$(echo "$json" | jq -r '.full_name')"
|
||||
local clone_url="$(echo "$json" | jq -r '.clone_url')"
|
||||
local ssh_url="$(echo "$json" | jq -r '.ssh_url')"
|
||||
|
||||
echo "$full_name"
|
||||
|
||||
if [[ "$(echo "$json" | jq -r '.archived')" == 'true' ]]; then
|
||||
echo " archived"
|
||||
checkout="$checkout/archive"
|
||||
elif [[ "$(echo "$json" | jq -r '.template')" == 'true' ]]; then
|
||||
echo " template"
|
||||
checkout="$checkout/templates"
|
||||
fi
|
||||
|
||||
if [ -d "$checkout/$full_name" ]
|
||||
then
|
||||
echo " already exists"
|
||||
if [[ "$(git -C "$checkout/$full_name" remote | grep "^$remote_name\$")" == "" ]]
|
||||
then
|
||||
git -C "$checkout/$full_name" remote add "$remote_name" "$ssh_url"
|
||||
else
|
||||
git -C "$checkout/$full_name" remote set-url "$remote_name" "$ssh_url"
|
||||
fi
|
||||
else
|
||||
echo " clone to $checkout/$full_name"
|
||||
url="$(echo "$clone_url" | sed "s|://|://$token@|")"
|
||||
git clone "$url" "$checkout/$full_name"
|
||||
git -C "$checkout/$full_name" remote set-url origin "$ssh_url"
|
||||
git -C "$checkout/$full_name" remote add "$remote_name" "$ssh_url"
|
||||
fi
|
||||
}
|
||||
|
||||
function fetch_repos() {
|
||||
local base_url="$1"
|
||||
local remote_name="$2"
|
||||
local token="$3"
|
||||
|
||||
local page=1
|
||||
|
||||
while [[ $page -lt 50 ]]
|
||||
do
|
||||
# echo
|
||||
echo "get repo list page $page"
|
||||
repos="$(curl -X 'GET' "$base_url/user/repos?page=$page&token=$token" \
|
||||
-H 'accept: application/json')"
|
||||
|
||||
if [[ "$repos" != "[]" ]]
|
||||
then
|
||||
for repo in $(echo "$repos" | jq -c '.[]' | sed -e 's/ /%20;/g')
|
||||
do
|
||||
repo="$( echo "$repo" | sed -e 's/%20;/ /g' )"
|
||||
process_repo "$repo"
|
||||
done
|
||||
else
|
||||
echo "No more repositories found."
|
||||
page=999
|
||||
fi
|
||||
|
||||
page="$(( $page + 1 ))"
|
||||
done
|
||||
}
|
||||
|
||||
fetch_repos https://gitea.finnvanreenen.nl/api/v1 tea "$(pass show gitea.finnvanreenen.nl/autoclone)"
|
||||
fetch_repos https://git.gay/api/v1 gay "$(pass show git.gay/autoclone)"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
font="$(fc-list | fzf)"
|
||||
|
||||
|
||||
104
private_dot_local/bin/executable_elf_packages
Normal file
104
private_dot_local/bin/executable_elf_packages
Normal file
@@ -0,0 +1,104 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SCRIPTS_DIR="$HOME/.local/share/elfos"
|
||||
|
||||
function print_help() {
|
||||
echo "usage: elf_packages <ACTION>"
|
||||
echo
|
||||
echo "ACTION:"
|
||||
echo " list list available scripts"
|
||||
echo " install <script> execute install script"
|
||||
echo " uninstall <script> execute remove script"
|
||||
echo " help display this help"
|
||||
}
|
||||
|
||||
function check_if_script_exists() {
|
||||
script="$1"
|
||||
|
||||
if [[ ! -f "$SCRIPTS_DIR/$script.sh" ]]
|
||||
then
|
||||
echo "ERROR: $script does not exists"
|
||||
print_help
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
function install_pacman_deps() {
|
||||
deps="$1"
|
||||
|
||||
pacman -Sy --noconfirm $deps
|
||||
}
|
||||
|
||||
function update() {
|
||||
script="$1"
|
||||
|
||||
check_if_script_exists "$script" || return 1
|
||||
|
||||
. "$SCRIPTS_DIR/$script.sh"
|
||||
|
||||
if package_check_installed
|
||||
then
|
||||
package_update
|
||||
else
|
||||
echo "package not installed"
|
||||
fi
|
||||
}
|
||||
|
||||
function uninstall() {
|
||||
script="$1"
|
||||
|
||||
check_if_script_exists "$script" || return 1
|
||||
|
||||
. "$SCRIPTS_DIR/$script.sh"
|
||||
|
||||
if package_check_installed
|
||||
then
|
||||
package_remove
|
||||
else
|
||||
echo "package not installed"
|
||||
fi
|
||||
}
|
||||
|
||||
function update() {
|
||||
script="$1"
|
||||
|
||||
check_if_script_exists "$script" && return 1
|
||||
|
||||
. "$SCRIPTS_DIR/$script"
|
||||
package_update
|
||||
}
|
||||
|
||||
case $1 in
|
||||
list)
|
||||
find "$SCRIPTS_DIR" -maxdepth 1 -name '*.sh' \
|
||||
-exec basename "{}" ';' \
|
||||
| sed -e 's/\.sh$//'
|
||||
;;
|
||||
install)
|
||||
shift
|
||||
install $*
|
||||
;;
|
||||
uninstall)
|
||||
shift
|
||||
uninstall $*
|
||||
;;
|
||||
update)
|
||||
shift
|
||||
update $*
|
||||
;;
|
||||
help)
|
||||
print_help
|
||||
;;
|
||||
"--help")
|
||||
print_help
|
||||
;;
|
||||
"-h")
|
||||
print_help
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: invalid action $1"
|
||||
print_help
|
||||
;;
|
||||
esac
|
||||
5
private_dot_local/bin/executable_flatrun
Normal file
5
private_dot_local/bin/executable_flatrun
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
app="$(flatpak list --app --columns=name,application | sed -e 's/\t/ (/' -e 's/$/)/' | fzf)"
|
||||
|
||||
flatpak run "$(echo "$app" | sed -e 's/^.*(\(.*\))$/\1/')"
|
||||
@@ -1,4 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cat "$1"/* | sed -e 's|//.*$||' -e 's|^[ \t]*||' | grep -v '^[ \t]*$' | awk '/\/\*/ {s=1} /\*\// && s==1 {s=0} !s' | grep -v '^.$' | grep -v '^..$' | grep -v '^...$' | wc -l
|
||||
cat "$1"/* \
|
||||
| sed -e 's|//.*$||' -e 's|^[ \t]*||' \
|
||||
| grep -v '^[ \t]*$' \
|
||||
| awk '/\/\*/ {s=1} /\*\// && s==1 {s=0} !s' \
|
||||
| grep -v '^.$' \
|
||||
| grep -v '^..$' \
|
||||
| grep -v '^...$' \
|
||||
| wc -l
|
||||
|
||||
|
||||
@@ -7,28 +7,22 @@ function run_menu() {
|
||||
menu="main"
|
||||
fi
|
||||
|
||||
items="$(cat "$XDG_CONFIG_HOME/menu_main/$menu")"
|
||||
|
||||
echo "$XDG_CONFIG_HOME/menu_main/$menu"
|
||||
echo "$items"
|
||||
|
||||
items="$(cat "$XDG_CONFIG_HOME/menu/$menu")"
|
||||
item="$(echo "$items" | sed -e 's|:.*$||' | walker --dmenu)"
|
||||
|
||||
action="$(echo "$items" | grep "^$item" | sed 's|^[^:]*:||' )"
|
||||
|
||||
exec_item "$action"
|
||||
}
|
||||
|
||||
function exec_item() {
|
||||
if [[ "$(echo "$action" | sed -e 's|:.*$||')" == "menu" ]]
|
||||
then
|
||||
menu_main "$(echo "$action" | sed -e 's|^[^:]*:||')"
|
||||
run_menu "$(echo "$action" | sed -e 's|^[^:]*:||')"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [[ "$(echo "$action" | sed -e 's|:.*$||')" == "exec" ]]
|
||||
then
|
||||
cd $XDG_CONFIG_HOME/menu_main
|
||||
cd "$XDG_CONFIG_HOME/menu"
|
||||
$(echo "$action" | sed -e 's|^[^:]*:||')
|
||||
fi
|
||||
|
||||
|
||||
19
private_dot_local/bin/executable_music_convert
Normal file
19
private_dot_local/bin/executable_music_convert
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
target="$1"
|
||||
shift
|
||||
|
||||
set -e
|
||||
|
||||
while [[ ! -z "$1" ]]
|
||||
do
|
||||
path="$1"
|
||||
shift
|
||||
|
||||
out="$(dirname "$path")/$(basename "$path" | sed -e 's/\.[^\.]*$//').$target"
|
||||
if [[ -z "$(echo "$out" | grep "\.$target\$")" ]]
|
||||
then
|
||||
out="$path.$target"
|
||||
fi
|
||||
ffmpeg -i "$path" "$out"
|
||||
done
|
||||
201
private_dot_local/bin/executable_music_gen_playlists
Normal file
201
private_dot_local/bin/executable_music_gen_playlists
Normal file
@@ -0,0 +1,201 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
. "$HOME/.local/share/music/common.sh"
|
||||
|
||||
function generate_pls() {
|
||||
local name="$1"
|
||||
local songs="$2"
|
||||
|
||||
echo "$songs" >"$MUSIC_DIR/Playlists/$name.json"
|
||||
|
||||
local pls="$MUSIC_DIR/Playlists/$name.pls"
|
||||
|
||||
echo "[playlist]" >"$pls"
|
||||
local song_count="$(echo "$songs" | jq -c '. | length' || error_here)"
|
||||
echo -e "Version=2\nNumberOfEntries=$song_count\n" >>"$pls"
|
||||
|
||||
local count=1
|
||||
for bliep in $(echo "$songs" | jq -c 'map(.) | .[]' | sed -e 's/ /%20;/g')
|
||||
do
|
||||
bliep="$(echo "$bliep" | sed -e 's/%20;/ /g')"
|
||||
|
||||
echo "file$count=../$(echo "$bliep" | jq -rc '.path.mpd' || error_here)" >>"$pls"
|
||||
count=$(( $count + 1 ))
|
||||
done
|
||||
}
|
||||
|
||||
function generate_mucke_pls() {
|
||||
local name="$1"
|
||||
local id="$2"
|
||||
local songs="$3"
|
||||
|
||||
paths="[]"
|
||||
local count=1
|
||||
for song in $(echo "$songs" | jq -c '.[]' | sed -e 's/ /%20;/g')
|
||||
do
|
||||
song="$(echo "$song" | sed -e 's/%20;/ /g')"
|
||||
|
||||
path="/storage/emulated/0/Music/$(echo $song | jq -rc '.path.mpd' || error_here)"
|
||||
paths="$(echo "$paths [\"$path\"]" | jq -c -s add || error_here)"
|
||||
done
|
||||
|
||||
echo "{\
|
||||
\"id\": $id,\
|
||||
\"name\": \"$name\",\
|
||||
\"iconString\": \"alarm_rounded\",\
|
||||
\"gradientString\": \"purplelake\",\
|
||||
\"timeCreated\": $(date +%s000),\
|
||||
\"timeChanged\": $(date +%s000),\
|
||||
\"timeLastPlayed\": $(date +%s000),\
|
||||
\"shuffleMode\": null,\
|
||||
\"SONGS\": $paths\
|
||||
}"
|
||||
}
|
||||
|
||||
. ~/.local/python-venv/bin/activate
|
||||
|
||||
files="$(find $MUSIC_DIR -type f -iname '*.mp3' -o -iname '*.flac' | sed -e 's/ /%20;/g')"
|
||||
|
||||
list_artist="{}"
|
||||
list_album="{}"
|
||||
|
||||
list_songs=""
|
||||
|
||||
pls_all="[]"
|
||||
pls_he="[]"
|
||||
pls_mhe="[]"
|
||||
pls_me="[]"
|
||||
pls_lme="[]"
|
||||
pls_le="[]"
|
||||
pls_lofi="[]"
|
||||
pls_le_lofi="[]"
|
||||
pls_lofi="[]"
|
||||
pls_dnp="[]"
|
||||
pls_unkown="[]"
|
||||
|
||||
for file in $files
|
||||
do
|
||||
path="$(echo $file | sed -e 's/%20;/ /g')"
|
||||
song="$(music_get_song_info_from_file "$path")"
|
||||
song="$(music_process_genre "$song")"
|
||||
|
||||
# echo "$song"
|
||||
|
||||
case "$(echo "$song" | jq -rc '.playlist' || error_here)" in
|
||||
'he')
|
||||
pls_all="$(echo "$pls_all [$song]" | jq -c -s add || error_here)"
|
||||
pls_he="$(echo "$pls_he [$song]" | jq -c -s add || error_here)"
|
||||
pls_mhe="$(echo "$pls_mhe [$song]" | jq -c -s add || error_here)"
|
||||
;;
|
||||
'me')
|
||||
pls_all="$(echo "$pls_all [$song]" | jq -c -s add || error_here)"
|
||||
pls_mhe="$(echo "$pls_mhe [$song]" | jq -c -s add || error_here)"
|
||||
pls_me="$(echo "$pls_me [$song]" | jq -c -s add || error_here)"
|
||||
pls_lme="$(echo "$pls_lme [$song]" | jq -c -s add || error_here)"
|
||||
;;
|
||||
'le')
|
||||
pls_all="$(echo "$pls_all [$song]" | jq -c -s add || error_here)"
|
||||
pls_me="$(echo "$pls_me [$song]" | jq -c -s add || error_here)"
|
||||
pls_lme="$(echo "$pls_lme [$song]" | jq -c -s add || error_here)"
|
||||
pls_le="$(echo "$pls_le [$song]" | jq -c -s add || error_here)"
|
||||
pls_le_lofi="$(echo "$pls_le_lofi [$song]" | jq -c -s add || error_here)"
|
||||
;;
|
||||
'lofi')
|
||||
pls_lofi="$(echo "$pls_lofi [$song]" | jq -c -s add || error_here)"
|
||||
pls_le_lofi="$(echo "$pls_le_lofi [$song]" | jq -c -s add || error_here)"
|
||||
;;
|
||||
'dnp')
|
||||
pls_dnp="$(echo "$pls_dnp [$song]" | jq -c -s add || error_here)"
|
||||
;;
|
||||
*)
|
||||
pls_all="$(echo "$pls_all [$song]" | jq -c -s add || error_here)"
|
||||
pls_unkown="$(echo "$pls_unkown [$song]" | jq -c -s add || error_here)"
|
||||
;;
|
||||
esac
|
||||
|
||||
echo -n "$(echo "$list_songs" | jq -c '. | length') "
|
||||
|
||||
artist_name=$(echo "$song" | jq -c '.artist' || error_here)
|
||||
if [[ "$(echo "$list_artist" | jq ". | has($artist_name)" || error_here)" == "false" ]]
|
||||
then
|
||||
artist_count=$(echo "$list_artist" | jq -c '. | length' || error_here)
|
||||
list_artist="$(echo "$list_artist {$artist_name:{\"artist\":$artist_name,\"index\":$artist_count}}" | jq -c -s add || error_here)"
|
||||
fi
|
||||
|
||||
album_name=$(echo "$song" | jq -c '.album' || error_here)
|
||||
if [[ "$(echo "$list_album" | jq ". | has($album_name)" || error_here)" == "false" ]]
|
||||
then
|
||||
album_count=$(echo "$list_album" | jq -c '. | length' || error_here)
|
||||
list_album="$(echo "$list_album {$album_name:{\"album\":$album_name,\"artist\":$artist_name,\"index\":$album_count}}" | jq -c -s add || error_here)"
|
||||
fi
|
||||
|
||||
list_songs="$list_songs {\
|
||||
\"/storage/emulated/0/Music/$(echo "$song" | jq -rc '.path.mpd' || error_here)\": {\
|
||||
\"title\": $(echo "$song" | jq -c '.title' || error_here),\
|
||||
\"album\": $(echo "$song" | jq -c '.album' || error_here),\
|
||||
\"artist\": $(echo "$song" | jq -c '.artist' || error_here),\
|
||||
\"albumId\": $(echo "$list_album" | jq -c ".$(echo "$song" | jq -c '.album' || error_here).index" || error_there),\
|
||||
\"blockLevel\": $(echo "$song" | jq -c '.blockLevel' || error_here),\
|
||||
\"next\": false,\
|
||||
\"previous\": false,\
|
||||
\"likeCount\": $(echo "$song" | jq -c '.likeLevel' || error_here),\
|
||||
\"playCount\": 0,\
|
||||
\"timeAdded\": $(date +%s)000\
|
||||
}\
|
||||
}"
|
||||
list_songs="$(echo "$list_songs" | jq -c -s add || error_here)"
|
||||
done
|
||||
|
||||
echo
|
||||
|
||||
generate_pls "all" "$pls_all"
|
||||
generate_pls "he" "$pls_he"
|
||||
generate_pls "mhe" "$pls_mhe"
|
||||
generate_pls "me" "$pls_me"
|
||||
generate_pls "lme" "$pls_lme"
|
||||
generate_pls "le" "$pls_le"
|
||||
generate_pls "lofi" "$pls_lofi"
|
||||
generate_pls "le_lofi" "$pls_le_lofi"
|
||||
generate_pls "lofi" "$pls_lofi"
|
||||
generate_pls "unkown" "$pls_unkown"
|
||||
generate_pls "dnp" "$pls_dnp"
|
||||
|
||||
pls_all="$(generate_mucke_pls "all" 1 "$pls_all")"
|
||||
pls_he="$(generate_mucke_pls "he" 6 "$pls_he")"
|
||||
pls_mhe="$(generate_mucke_pls "mhe" 5 "$pls_mhe")"
|
||||
pls_me="$(generate_mucke_pls "me" 4 "$pls_me")"
|
||||
pls_lme="$(generate_mucke_pls "lme" 3 "$pls_lme")"
|
||||
pls_le="$(generate_mucke_pls "le" 2 "$pls_le")"
|
||||
pls_le_lofi="$(generate_mucke_pls "le_lofi" 7 "$pls_le_lofi")"
|
||||
pls_lofi="$(generate_mucke_pls "lofi" 8 "$pls_lofi")"
|
||||
pls_unkown="$(generate_mucke_pls "unkown" 9 "$pls_unkown")"
|
||||
pls_dnp="$(generate_mucke_pls "dnp" 10 "$pls_dnp")"
|
||||
|
||||
all_pls="[$pls_all,$pls_le,$pls_lme,$pls_me,$pls_mhe,$pls_he,$pls_le_lofi,$pls_lofi,$pls_unkown,$pls_dnp]"
|
||||
|
||||
echo "{\"epoch\":$(date +%s000),\"playlists\":$all_pls}" \
|
||||
>"$HOME/.local/share/music/mucke.json.jinja2.data"
|
||||
|
||||
# echo $list_album
|
||||
list_album="$(echo "$list_album" | jq -c '. | with_entries(.key = (.value.index | tostring)) | map_values(del(.index))' || error_here)"
|
||||
list_artist="$(echo "$list_artist" | jq -c '. | with_entries(.key = (.value.index | tostring)) | map_values(del(.index))' || error_here)"
|
||||
|
||||
echo "{\
|
||||
\"APP_VERSION\": \"1.5.1\",\
|
||||
\"BUILD_NUMBER\": \"123\",\
|
||||
\"DB_VERSION\": 18,\
|
||||
\"SETTING_ALLOWED_EXTENSIONS\": \"mp3,flac,wav,ogg,opus\",\
|
||||
\"BLOCKED_FILES\": [],\
|
||||
\"LIBRARY_FOLDERS\": [\
|
||||
\"/storage/emulated/0/Music\"\
|
||||
],\
|
||||
\"SONGS\": $list_songs,\
|
||||
\"ALBUMS\": $list_album,\
|
||||
\"ARTISTS\": $list_artist,\
|
||||
\"SMARTLISTS\": [],\
|
||||
\"PLAYLISTS\": $all_pls\
|
||||
}" >"$MUSIC_DIR/Playlists/mucke.json"
|
||||
|
||||
# cat "$MUSIC_DIR/Playlists/mucke.json" | jq >"$MUSIC_DIR/Playlists/mucke.json" || error_here
|
||||
171
private_dot_local/bin/executable_music_import_mucke
Normal file
171
private_dot_local/bin/executable_music_import_mucke
Normal file
@@ -0,0 +1,171 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
DATA="$(cat "$1")"
|
||||
|
||||
. "$HOME/.local/share/music/common.sh"
|
||||
|
||||
function get_songs_from_playlists() {
|
||||
local data="$1"
|
||||
local song_paths=""
|
||||
|
||||
for playlist in $(echo "$data" | jq -c '.PLAYLISTS[]' | sed -e 's/ /%20;/g')
|
||||
do
|
||||
playlist="$(echo "$playlist" | sed -e 's/%20;/ /g')"
|
||||
|
||||
for song_path in $(echo "$playlist" | jq -rc '.SONGS[]' | sed -e 's/ /%20;/g')
|
||||
do
|
||||
local song_path="$(echo "$song_path" | sed -e 's/%20;/ /g' )"
|
||||
if [[ -f "$song_path" ]]
|
||||
then
|
||||
song_paths="$(echo -e "$song_paths\n$song_path")"
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "$song_paths" | sort | uniq
|
||||
}
|
||||
|
||||
function search_artist_index() {
|
||||
local name="$(echo "$1" | sed -e 's/^"//' -e 's/"$//')"
|
||||
|
||||
for artist in $(echo "$DATA" | jq -c '.ARTISTS' | sed -e 's/^{//' -e 's/}$//' -e 's/},"/}\n"/g' -e 's/ /%20;/g')
|
||||
do
|
||||
artist="$( echo "$artist" | sed -e 's/%20;/ /g' )"
|
||||
|
||||
local artist_name="$(echo "$artist" | sed -e 's/^.*"\([^"]*\)"}$/\1/')"
|
||||
if [[ "$name" == "$artist_name" ]]
|
||||
then
|
||||
echo "$artist" | sed -e 's/^"\([0-9]*\)".*$/\1/'
|
||||
return
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function search_album_index() {
|
||||
local name="$1"
|
||||
local artist="$2"
|
||||
|
||||
for album in $(echo "$DATA" | jq -c '.ALBUMS' | sed -e 's/^{//' -e 's/}$//' -e 's/},"/}\n"/g' -e 's/ /%20;/g')
|
||||
do
|
||||
album="$( echo "{$album}" | sed -e 's/%20;/ /g' )"
|
||||
|
||||
local album_name="$(echo "$album" | jq -c '.[].title' || error_here)"
|
||||
if [[ "$name" == "$album_name" ]]
|
||||
then
|
||||
local index="$(echo "$album" | jq -c 'keys[0]' | tr -dc '0-9')"
|
||||
echo "$(echo "$album" | jq -c '.[]' || error_here) {\"index\":$index}" | jq -c -s add || error_here
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
echo "{\"title\":$name,\"artist\":$artist,\"index\":-1}"
|
||||
}
|
||||
|
||||
function apply_changes() {
|
||||
local song="$1"
|
||||
|
||||
local genre="$(echo "$song" | jq -r '.genre')"
|
||||
local pls="$(echo "$song" | jq -r '.playlist')"
|
||||
pls="${pls^^}" # make uppercase
|
||||
local like="$(echo "$song" | jq -r '.likeLevel')"
|
||||
genre="$genre $pls L$like"
|
||||
local block="$(echo "$song" | jq -r '.blockLevel')"
|
||||
if [[ "$block" != "0" ]]
|
||||
then
|
||||
genre="$genre B$block"
|
||||
fi
|
||||
genre="$(echo "$genre" | sed -e 's/^ *//' -e 's/ *$//' -e 's/ / /g')"
|
||||
|
||||
echo "genre: '$genre'"
|
||||
|
||||
echo -n 'continue [y/N]: '
|
||||
answer=""
|
||||
read answer
|
||||
if [[ "$answer" = "y" ]]
|
||||
then
|
||||
local format="$(echo "$song" | jq -r '.path.file' | sed 's/^.*\.\([^.]*\)$/\1/')"
|
||||
case "$format" in
|
||||
flac)
|
||||
metaflac --remove-tag="GENRE" "$(echo "$song" | jq -r '.path.file')"
|
||||
metaflac --set-tag="GENRE=$genre" "$(echo "$song" | jq -r '.path.file')"
|
||||
;;
|
||||
mp3)
|
||||
id3v2 --genre "$genre" "$(echo "$song" | jq -r '.path.file')"
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: unsuported format $format"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
echo "change aborted"
|
||||
fi
|
||||
}
|
||||
|
||||
song_db_old=""
|
||||
song_db_new=""
|
||||
|
||||
song_paths="$(echo "$DATA" | jq -c '.SONGS | keys | @csv' | sed -e 's/^"\\\"//' -e 's/\\\""$//')"
|
||||
for mucke_path in $(echo "$song_paths" | sed -e 's/\\\",\\\"/\n/g' -e 's/ /%20;/g' | grep -v 'Movies/Dadi')
|
||||
do
|
||||
mucke_path="$(echo "$mucke_path" | sed -e 's/%20;/ /g')"
|
||||
song_path="$MUSIC_DIR/$(echo "$mucke_path" | sed -e 's|^/storage/emulated/0/Music/||')"
|
||||
|
||||
|
||||
song_info="$(music_get_song_info_from_file "$song_path" || echo)"
|
||||
if [[ "$(echo "$song_info" | head -c1)" != "{" ]]
|
||||
then
|
||||
echo "$song_info"
|
||||
exit 1
|
||||
fi
|
||||
song_info="$(music_process_genre "$song_info")"
|
||||
|
||||
artist_name="$(echo "$song_info" | jq -c '.artist' || error_here)"
|
||||
artistId="-1"
|
||||
artist=""
|
||||
if [[ "$artist_name" == "\"\"" || "$artist_name" == "" ]]
|
||||
then
|
||||
artist="{\"artist\":\"\",\"index\":-1}"
|
||||
else
|
||||
artistId="$(search_artist_index "$artist_name")"
|
||||
artist="{\"artist\":$artist_name,\"index\":$artistId}"
|
||||
fi
|
||||
|
||||
album="$(echo "$song_info" | jq -c '.album' || error_here)"
|
||||
album_artist="$artist_name"
|
||||
if [[ "$album" == "\"\"" || "$album" == "" ]]
|
||||
then
|
||||
album="{\"title\":\"\",\"artist\":$artist_name,\"index\":-1}"
|
||||
else
|
||||
album="$(search_album_index "$album" "$artist_name")"
|
||||
album_artist="$(echo "$album" | jq -c '.artist' || error_here)"
|
||||
fi
|
||||
|
||||
song_info="$(echo "$song_info {\"artist\":$artist,\"album\":$album}" | jq -c -s add || error_here)"
|
||||
song_db_old="$song_db_old,$(echo "$song_info" | jq '.path.mpd' || error_here):$song_info"
|
||||
|
||||
mucke_song="$(echo "$DATA" | jq -c ".SONGS.\"$mucke_path\"" || error_here)"
|
||||
mucke_song="$(echo "$mucke_song" | jq -c ". | {\"title\":.title,\"album\":{\"title\":.album,\"artist\":$album_artist,\"index\":.albumId},\"artist\":{\"artist\":.artist,\"index\":$artistId},\"blockLevel\":.blockLevel,\"likeLevel\":.likeCount}" || error_here)"
|
||||
|
||||
new_info="$(echo "$song_info $mucke_song" | jq -c -s add || error_here)"
|
||||
song_db_new="$song_db_new,$(echo "$new_info" | jq '.path.mpd' || error_here):$new_info"
|
||||
|
||||
tmp_old="$(mktemp)"
|
||||
echo "$song_info" | jq >"$tmp_old" || error_here
|
||||
tmp_new="$(mktemp)"
|
||||
echo "$new_info" | jq >"$tmp_new" || error_here
|
||||
|
||||
diff "$tmp_old" "$tmp_new" &>/dev/null || {
|
||||
echo "$song_path"
|
||||
diff "$tmp_old" "$tmp_new" || echo
|
||||
|
||||
apply_changes "$new_info"
|
||||
}
|
||||
rm "$tmp_old" "$tmp_new"
|
||||
done
|
||||
|
||||
echo "{$(echo "$song_db_old" | tail -c+2)}" | jq >"$HOME/.local/share/music/songs.json" \
|
||||
|| echo "{$(echo "$song_db_old" | tail -c+2)}" >"$HOME/.local/share/music/songs.json"
|
||||
echo "{$(echo "$song_db_new" | tail -c+2)}" | jq >"$HOME/.local/share/music/songs_new.json" \
|
||||
|| echo "{$(echo "$song_db_new" | tail -c+2)}" >"$HOME/.local/share/music/songs_new.json"
|
||||
78
private_dot_local/bin/executable_proj_fetch_all
Executable file
78
private_dot_local/bin/executable_proj_fetch_all
Executable file
@@ -0,0 +1,78 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function update_remote() {
|
||||
local repo="$1"
|
||||
|
||||
for remote in $(git -C "$repo" remote 2>/dev/null)
|
||||
do
|
||||
local new_url="$(git -C "$repo" remote get-url "$remote" | sed -e 's|^https://FReenen:[0-9a-f]*@gitea.finnvanreenen.nl/|git@gitea.finnvanreenen.nl:|')"
|
||||
git -C "$repo" remote set-url "$remote" "$new_url"
|
||||
done
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
for repo in $(find $HOME/projects/ -type d -name '.git' | sed -e 's/ /%20;/g')
|
||||
do
|
||||
repo="$( echo "$repo" | sed -e 's/%20;/ /g' -e 's|/\.git$||' )"
|
||||
git -C "$repo" fetch --all 1>/dev/null \
|
||||
|| update_remote "$repo" \
|
||||
|| { echo "failt to fetch $repo" ; echo ; }
|
||||
|
||||
changes=""
|
||||
|
||||
staged=""
|
||||
unsgated=""
|
||||
git diff --cached --exit-code &>/dev/null || staged="staged"
|
||||
git diff --exit-code &>/dev/null || unsgated="unsgated"
|
||||
|
||||
if [[ ! -z "$staged" && ! -z "$unstaged" ]]
|
||||
then
|
||||
changes="staged and unstaged changes"
|
||||
elif [[ ! -z "$unstaged" ]]
|
||||
then
|
||||
changes="unstaged changes"
|
||||
elif [[ ! -z "$staged" ]]
|
||||
then
|
||||
changes="staged changes"
|
||||
fi
|
||||
|
||||
remote=""
|
||||
|
||||
b=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
|
||||
if [ "$b" != "" ]
|
||||
then
|
||||
behind=$(git rev-list HEAD...@{u} --ignore-submodules --count 2>/dev/null)
|
||||
ahead=$(git rev-list @{u}...HEAD --ignore-submodules --count 2>/dev/null)
|
||||
if [[ "$behind" > 0 && "$ahead" > 0 ]]
|
||||
then
|
||||
remote="merge with remote"
|
||||
elif [[ "$behind" > 0 ]]
|
||||
then
|
||||
remote="push to remote"
|
||||
elif [[ "$ahead" > 0 ]]
|
||||
then
|
||||
remote="pull from remote"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ! -z "$changes" || ! -z "$remote" ]]
|
||||
then
|
||||
echo "# $repo"
|
||||
echo
|
||||
|
||||
if [[ ! -z "$changes" && ! -z "$remote" ]]
|
||||
then
|
||||
echo "has $changes and has to $remote"
|
||||
elif [[ ! -z "$changes" ]]
|
||||
then
|
||||
echo "has $changes"
|
||||
elif [[ ! -z "$remote" ]]
|
||||
then
|
||||
echo "has to $remote"
|
||||
fi
|
||||
|
||||
echo
|
||||
fi
|
||||
|
||||
done
|
||||
@@ -1,81 +1,68 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
PLAYLIST="$1"
|
||||
COUNT="$2"
|
||||
|
||||
set -e
|
||||
|
||||
SONGS="$(find $HOME/Music -type f)"
|
||||
SONG_COUNT="$(echo "$SONGS" | wc -l)"
|
||||
. "$HOME/.local/share/music/common.sh"
|
||||
|
||||
PLAYLIST_DIR="$MUSIC_DIR/Playlists"
|
||||
|
||||
function rand_num() {
|
||||
cat /dev/urandom | tr -dc '0-9' | head -c 10 | sed -e 's/^0*//'
|
||||
}
|
||||
|
||||
function pick_song() {
|
||||
num=$(( 1 + $RANDOM % $SONG_COUNT ))
|
||||
echo "$SONGS" | sed "${num}q;d"
|
||||
}
|
||||
playlist="$1"
|
||||
|
||||
function get_flags() {
|
||||
path="$1"
|
||||
meuadata="flac"
|
||||
genre="$(ffmpeg -i "${path}" 2>&1 | grep GENRE | sed -e 's/^.*: //')"
|
||||
if [[ "$(echo "${path}" | sed -e 's/^.*\.\([^\.]*\)$/\1/')" == "mp3" ]]
|
||||
playlist_path="$PLAYLIST_DIR/$playlist.pls"
|
||||
if [[ ! -f "$playlist_path" ]]
|
||||
then
|
||||
metadata="mp3"
|
||||
genre="$(id3v2 -l "${path}" | grep '^TCON' | sed -e 's/^.*: //')"
|
||||
echo "ERROR: playlist $playlist not found" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo $genre
|
||||
}
|
||||
|
||||
function in_playlist() {
|
||||
flags="$1"
|
||||
playlist="$2"
|
||||
songs="$(cat "$playlist_path" | grep '^file' | sed -e 's|^[^=]*=\.\./||')"
|
||||
|
||||
playlists="
|
||||
ALL:(HE|ME|LE)
|
||||
HE:HE
|
||||
MHE:(ME|HE)
|
||||
ME:ME
|
||||
LME:(LE|ME)
|
||||
LO:LO
|
||||
LOFI:LOFI
|
||||
LE_LOFI:(LE|LOFI)
|
||||
"
|
||||
query="$(echo "$playlists" | grep --ignore-case " ${playlist}:" | sed 's/^.*://')"
|
||||
|
||||
if [[ "$(echo "$flags" | grep -E --no-ignore-case "$query")" != "" ]]
|
||||
then
|
||||
echo true
|
||||
else
|
||||
echo false
|
||||
fi
|
||||
}
|
||||
|
||||
function get_like_level() {
|
||||
flags="$1"
|
||||
|
||||
level="$(echo "$flags" | sed -e 's/^.*L\([0-3]\).*$/\1/')"
|
||||
if [[ "$level" == "$(echo "$level" | tr -dc '0-3')" ]]
|
||||
then
|
||||
echo $level
|
||||
fi
|
||||
num=$(( 1 + $(rand_num) % $(echo "$songs" | wc -l) ))
|
||||
song="$(echo "$songs" | sed "${num}q;d")"
|
||||
echo "$MUSIC_DIR/$song"
|
||||
}
|
||||
|
||||
function shuffle() {
|
||||
playlist="$1"
|
||||
|
||||
song="$(pick_song)"
|
||||
flags="$(get_flags "$song")"
|
||||
in_list=$(in_playlist "$flags" "$playlist")
|
||||
like=$(get_like_level "$flags")
|
||||
like_min=$(( 1 + $RANDOM % 3 ))
|
||||
song="$(pick_song "$playlist")"
|
||||
song="$(music_get_song_info_from_file "$song")"
|
||||
song="$(music_process_genre "$song")"
|
||||
like=$(echo "$song" | jq '.likeLevel')
|
||||
mpd_path="$(echo "$song" | jq -rc '.path.mpd')"
|
||||
like_min=$(( -1 + $(rand_num) % 3 ))
|
||||
|
||||
if [[ "$in_list" == "false" || "$like" -lt "$like_min" ]]
|
||||
if [[ $like > $like_min ]]
|
||||
then
|
||||
shuffle "$playlist"
|
||||
echo "$like $mpd_path"
|
||||
mpc add "$mpd_path"
|
||||
else
|
||||
mpd_song="$(echo "$song" | sed -e 's|.*/Music/||')"
|
||||
echo "$mpd_song"
|
||||
mpc add "$mpd_song"
|
||||
shuffle "$playlist"
|
||||
fi
|
||||
}
|
||||
|
||||
echo "$(shuffle $PLAYLIST)"
|
||||
if [[ -z "$PLAYLIST" ]]
|
||||
then
|
||||
PLAYLIST=all
|
||||
fi
|
||||
|
||||
if [[ -z "$COUNT" ]]
|
||||
then
|
||||
echo "add one song to que from $PLAYLIST"
|
||||
echo "$(shuffle $PLAYLIST)"
|
||||
else
|
||||
echo "add $COUNT songs to que from $PLAYLIST"
|
||||
for i in $(seq 1 $COUNT)
|
||||
do
|
||||
echo "$(shuffle $PLAYLIST)"
|
||||
# echo $i
|
||||
done
|
||||
fi
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
rclone sync pdrive: "/mnt/backup/proton/" --verbose --progress \
|
||||
--filter-from "$HOME/.config/rclone/bisync_backup.filter" $*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
rclone bisync "$HOME/Documents" pdrive:Documents --verbose --progress \
|
||||
--filter-from "$HOME/.config/rclone/bisync_documents.filter" $*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
rclone bisync "$HOME" pdrive: --verbose --progress \
|
||||
--filter-from "$HOME/.config/rclone/bisync_home.filter" $*
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
rclone bisync "$HOME/Music" pdrive:Music --verbose --progress $*
|
||||
|
||||
4
private_dot_local/bin/executable_update_env
Normal file
4
private_dot_local/bin/executable_update_env
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cat "$(find "$HOME/.config/env" -name '*.env' -type f)" \
|
||||
>"$HOME/.config/env/all"
|
||||
195
private_dot_local/share/elfos/common/block_in_file.sh
Normal file
195
private_dot_local/share/elfos/common/block_in_file.sh
Normal file
@@ -0,0 +1,195 @@
|
||||
|
||||
function __block_in_file__help() {
|
||||
local func="$1"
|
||||
if [[ "$func" = "update" ]]
|
||||
then
|
||||
echo "block_in_file [<OPTIONS>] <FILE> <ID> <BLOCK>"
|
||||
else
|
||||
echo "block_in_file_remove [<OPTIONS>] <FILE> <ID>"
|
||||
fi
|
||||
echo "$func [<OPTIONS>] <FILE> <ID> <BLOCK>"
|
||||
echo
|
||||
echo "OPTIONS:"
|
||||
if [[ "$func" = "update" ]]
|
||||
then
|
||||
echo " --before <MATCH> insert block before matched line"
|
||||
echo " --after <MATCH> insert block after matched line"
|
||||
fi
|
||||
echo " --id-start-pre <str> set id-start-pre to str"
|
||||
echo " --id-start-post <str> set id-start-post to str"
|
||||
echo " --id-end-pre <str> set id-end-pre to str"
|
||||
echo " --id-end-post <str> set id-end-post to str"
|
||||
echo
|
||||
echo "ID:"
|
||||
echo " an identifier string to regonise the block."
|
||||
if [[ "$func" = "update" ]]
|
||||
then
|
||||
echo
|
||||
echo "MATCH:"
|
||||
echo " line search/match string in grep format"
|
||||
fi
|
||||
echo
|
||||
echo "block fomat:"
|
||||
echo " <id-start-pre><id><id-start-post>"
|
||||
echo " <block>"
|
||||
echo " <id-end-pre><id><id-end-post>"
|
||||
}
|
||||
|
||||
function block_in_file() {
|
||||
__block_in_file__inner "update" $*
|
||||
}
|
||||
|
||||
function block_in_file_remove() {
|
||||
__block_in_file__inner "remove" $*
|
||||
}
|
||||
|
||||
function __block_in_file__inner() {
|
||||
local FN="$1"
|
||||
local BEFORE="EOF"
|
||||
local AFTER="SOF"
|
||||
local ID_START_PRE="#START manged by elf_packages: "
|
||||
local ID_START_POST=""
|
||||
local ID_END_PRE="#END "
|
||||
local ID_END_POST=""
|
||||
while [[ $1 == \-* ]]
|
||||
do
|
||||
case "$1" in
|
||||
"--before")
|
||||
if [[ "$FN" = "update" ]]
|
||||
then
|
||||
shift
|
||||
BEFORE="$1"
|
||||
shift
|
||||
else
|
||||
echo "ERROR: invalid options $1"
|
||||
__block_in_file__help "$FN"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
"--after")
|
||||
if [[ "$FN" = "update" ]]
|
||||
then
|
||||
shift
|
||||
AFTER="$1"
|
||||
shift
|
||||
else
|
||||
echo "ERROR: invalid options $1"
|
||||
__block_in_file__help "$FN"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
"--id-start-pre")
|
||||
shift
|
||||
ID_START_PRE="$1"
|
||||
shift
|
||||
;;
|
||||
"--id-start-post")
|
||||
shift
|
||||
ID_START_POST="$1"
|
||||
shift
|
||||
;;
|
||||
"--id-end-pre")
|
||||
shift
|
||||
ID_END_PRE="$1"
|
||||
shift
|
||||
;;
|
||||
"--id-end-post")
|
||||
shift
|
||||
ID_END_POST="$1"
|
||||
shift
|
||||
;;
|
||||
"--")
|
||||
shift
|
||||
break
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: invalid options $1"
|
||||
__block_in_file__help "$FN"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
local FILE="$1"
|
||||
local ID="$2"
|
||||
local BLOCK="$3"
|
||||
|
||||
if [[ ! -f "$FILE" ]]
|
||||
then
|
||||
echo "ERROR: file not found: $FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local id_start_line="${ID_START_PRE}${ID}${ID_START_POST}"
|
||||
local id_end_line="${ID_END_PRE}${ID}${ID_END_POST}"
|
||||
|
||||
if [[ "$func" = "update" ]]
|
||||
then
|
||||
block_in_file "$FILE" "$id_start_line" "$id_end_line" "$BEFORE" "$AFTER" "$BLOCK"
|
||||
else
|
||||
block_in_file_remove "$FILE" "$id_start_line" "$id_end_line" "$BLOCK"
|
||||
fi
|
||||
}
|
||||
|
||||
function __block_in_file__inner_update() {
|
||||
local file="$1"
|
||||
local id_start_line="$2"
|
||||
local id_end_line="$3"
|
||||
local before="$4"
|
||||
local after="$5"
|
||||
local block="$6"
|
||||
|
||||
if [[ -z "$(grep "^$id_start_line\$" "$file")" ]]
|
||||
then
|
||||
# no existing block. add a new one
|
||||
if [ "$before" == "EOF" ]
|
||||
then
|
||||
before="$(($(cat "$file" | wc --lines) + 1))"
|
||||
else
|
||||
before="$(grep --line-number -e "$before" "$file" | head --lines=1 | awk -F: '{{print $1}}')"
|
||||
fi
|
||||
if [ "$after" == "SOF" ]
|
||||
then
|
||||
after="0"
|
||||
else
|
||||
after="$(grep --line-number -e "$after" "$file" | head --lines=1 | awk -F: '{{print $1}}')"
|
||||
fi
|
||||
|
||||
if [[ $after > $before ]]; then
|
||||
echo "ERROR: after is bigger than before, no place to put the block"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tmp_file=$(mktemp)
|
||||
head --lines=$AFTER "$file" >"$tmp_file"
|
||||
echo "$id_start_line" >>"$tmp_file"
|
||||
echo "$block" >>"$tmp_file"
|
||||
echo "$id_end_line" >>"$tmp_file"
|
||||
tail --lines=+$(($AFTER + 1)) "$file" >>"$tmp_file"
|
||||
mv "$tmp_file" "$file"
|
||||
else
|
||||
# update existing block
|
||||
local start="$(grep --line-number -e "^$id_start_line\$" "$file" | head --lines=1 | awk -F: '{{print $1}}')"
|
||||
local end="$(grep --line-number -e "^$id_end_line\$" "$file" | head --lines=1 | awk -F: '{{print $1}}')"
|
||||
|
||||
local tmp_file=$(mktemp)
|
||||
head --lines=$start "$file" >"$tmp_file"
|
||||
echo "$block" >>"$tmp_file"
|
||||
tail --lines=+$end "$file" >>"$tmp_file"
|
||||
mv "$tmp_file" "$file"
|
||||
fi
|
||||
}
|
||||
|
||||
function __block_in_file__inner_remove() {
|
||||
local file="$1"
|
||||
local id_start_line="$2"
|
||||
local id_end_line="$3"
|
||||
local block="$4"
|
||||
|
||||
local start="$(grep --line-number -e "^$id_start_line\$" "$file" | head --lines=1 | awk -F: '{{print $1}}')"
|
||||
local end="$(grep --line-number -e "^$id_end_line\$" "$file" | head --lines=1 | awk -F: '{{print $1}}')"
|
||||
|
||||
local tmp_file=$(mktemp)
|
||||
head --lines=$(($start - 1)) "$file" >"$tmp_file"
|
||||
tail --lines=+$(($start + 1)) "$file" >>"$tmp_file"
|
||||
mv "$tmp_file" "$file"
|
||||
}
|
||||
38
private_dot_local/share/elfos/esp-idf.sh
Normal file
38
private_dot_local/share/elfos/esp-idf.sh
Normal file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
export PACKAGE_DEPS_PACMAN="flex bison gperf ninja ccache libffi dfu-util libusb"
|
||||
|
||||
function package_install() {
|
||||
mkdir -p "$XDG_DATA_HOME/espressif"
|
||||
git clone --recursive --depth=1 https://github.com/espressif/esp-idf.git \
|
||||
"$XDG_DATA_HOME/espressif/esp-idf"
|
||||
git clone --recursive --depth=1 https://github.com/espressif/idf-extra-components.git \
|
||||
"$XDG_DATA_HOME/espressif/idf-extra-components"
|
||||
git clone --recursive --depth=1 https://github.com/espressif/esp-protocols.git \
|
||||
"$XDG_DATA_HOME/espressif/esp-protocols"
|
||||
git clone --recursive --depth=1 https://github.com/espressif/esp-zigbee-sdk.git \
|
||||
"$XDG_DATA_HOME/espressif/esp-zigbee-sdk"
|
||||
|
||||
echo 'export IDF_TOOLS_PATH="$XDG_DATA_HOME/espressif"' \
|
||||
>"$XDG_CONFIG_HOME/env/esp-idf.env"
|
||||
update_env
|
||||
. "$SESSION_ENV_FILE"
|
||||
|
||||
"$XDG_DATA_HOME/espressif/esp-idf/install.sh" all
|
||||
}
|
||||
|
||||
function package_update() {
|
||||
git -C "$XDG_DATA_HOME/espressif/esp-idf" pull
|
||||
git -C "$XDG_DATA_HOME/espressif/idf-extra-components" pull
|
||||
git -C "$XDG_DATA_HOME/espressif/esp-protocols" pull
|
||||
git -C "$XDG_DATA_HOME/espressif/esp-zigbee-sdk" pull
|
||||
}
|
||||
|
||||
function package_remove() {
|
||||
rm -rf "$XDG_DATA_HOME/espressif"
|
||||
rm "$XDG_CONFIG_HOME/env/esp-idf.env"
|
||||
}
|
||||
|
||||
function package_check_installed() {
|
||||
[[ -d "$XDG_DATA_HOME/espressif" ]]
|
||||
}
|
||||
17
private_dot_local/share/elfos/oh-my-posh.sh
Normal file
17
private_dot_local/share/elfos/oh-my-posh.sh
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function package_install() {
|
||||
curl -s https://ohmyposh.dev/install.sh | bash -s
|
||||
}
|
||||
|
||||
function package_update() {
|
||||
#TODO
|
||||
}
|
||||
|
||||
function package_remove() {
|
||||
#TODO
|
||||
}
|
||||
|
||||
function package_check_installed() {
|
||||
#TODO
|
||||
}
|
||||
19
private_dot_local/share/elfos/py-glob.sh
Normal file
19
private_dot_local/share/elfos/py-glob.sh
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function package_install() {
|
||||
mkdir -p $HOME/.local/py-glob
|
||||
python3 -m venv $HOME/.local/py-glob
|
||||
}
|
||||
|
||||
function package_update() {
|
||||
#TODO
|
||||
echo
|
||||
}
|
||||
|
||||
function package_remove() {
|
||||
rm -rf "$HOME/.local/py-glob"
|
||||
}
|
||||
|
||||
function package_check_installed() {
|
||||
[[ -d "$HOME/.local/py-glob" ]]
|
||||
}
|
||||
27
private_dot_local/share/elfos/rustup.sh
Normal file
27
private_dot_local/share/elfos/rustup.sh
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function package_install() {
|
||||
echo 'export RUSTUP_HOME="$XDG_DATA_HOME/rustup"' >"$XDG_CONFIG_HOME/env/rustup.env"
|
||||
echo 'export CARGO_HOME="$XDG_DATA_HOME/cargo"' >>"$XDG_CONFIG_HOME/env/rustup.env"
|
||||
|
||||
. "$SESSION_ENV_FILE"
|
||||
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs >/tmp/rustup.sh
|
||||
sh /tmp/rustup.sh -y
|
||||
rm /tmp/rustup.sh
|
||||
}
|
||||
|
||||
function package_update() {
|
||||
#TODO
|
||||
}
|
||||
|
||||
function package_remove() {
|
||||
#TODO
|
||||
|
||||
rm "$XDG_CONFIG_HOME/env/rustup.env"
|
||||
}
|
||||
|
||||
function package_check_installed() {
|
||||
#TODO
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[Context]
|
||||
devices=usb
|
||||
filesystems=xdg-documents/Arduino;/run/media/
|
||||
persistent=.arduino15;.arduinoIDE
|
||||
devices=!all;usb
|
||||
filesystems=/run/media/;xdg-documents/Arduino
|
||||
persistent=.arduinoIDE;.arduino15
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
[Context]
|
||||
filesystems=/home/freenen/.local/share/vdhcoapp:ro;~/projects:ro;~/.local/tiCloudAgent;~/.local/share/vdhcoapp;
|
||||
sockets=gpg-agent
|
||||
filesystems=~/.local/share/vdhcoapp:ro;~/projects:ro;~/.local/tiCloudAgent;~/.local/share/browserpass;~/.password-store/;~/.gnupg
|
||||
|
||||
82
private_dot_local/share/music/common.sh
Normal file
82
private_dot_local/share/music/common.sh
Normal file
@@ -0,0 +1,82 @@
|
||||
|
||||
export MUSIC_DIR="$HOME/Music"
|
||||
|
||||
function music_get_song_info_from_file() {
|
||||
local path="$1"
|
||||
|
||||
local mpd_path="$path"
|
||||
if [[ ! -f "$path" && -f "$MUSIC_DIR/$path" ]]
|
||||
then
|
||||
path="$MUSIC_DIR/$path"
|
||||
else
|
||||
mpd_path="$(echo "$path" | tail -c+$(( $(echo "$MUSIC_DIR" | wc -c) + 1 )))"
|
||||
fi
|
||||
if [[ ! -f "$path" ]]
|
||||
then
|
||||
echo "ERROR: music_get_song_info_from_file: file not found: $path" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$(echo "${path}" | sed -e 's/^.*\.\([^\.]*\)$/\1/')" == "mp3" ]]
|
||||
then
|
||||
local metadata="mp3"
|
||||
local data="$(id3v2 -l "${path}")"
|
||||
local genre="$(echo "$data" | grep '^TCON' | sed -e 's/^.*: //' -e 's/ ([0-9]*)$//')"
|
||||
local artist="$(echo "$data" | grep '^TPE2' | sed -e 's/^.*: //')"
|
||||
local album="$(echo "$data" | grep '^TALB' | sed -e 's/^.*: //')"
|
||||
local title="$(echo "$data" | grep '^TIT2' | sed -e 's/^.*: //')"
|
||||
else
|
||||
local metadata="flac"
|
||||
local data="$(ffmpeg -i "${path}" 2>&1)"
|
||||
local genre="$(echo "$data" | grep GENRE | sed -e 's/^.*: //')"
|
||||
local artist="$(echo "$data" | grep ARTIST | sed -e 's/^.*: //')"
|
||||
local album="$(echo "$data" | grep ALBUM | sed -e 's/^.*: //')"
|
||||
local title="$(echo "$data" | grep TITLE | sed -e 's/^.*: //')"
|
||||
fi
|
||||
|
||||
echo "{\"path\":{\"file\":\"$path\",\"mpd\":\"$mpd_path\"},\"title\":\"$title\",\"album\":\"$album\",\"artist\":\"$artist\",\"genre\":\"$genre\"}"
|
||||
}
|
||||
|
||||
function music_process_genre() {
|
||||
local song="$1"
|
||||
|
||||
local genre="$(echo "$song" | jq -c '.genre' || error_here)"
|
||||
|
||||
local likeLevel="2"
|
||||
local blockLevel="0"
|
||||
if [[ "$(echo "$genre" | grep --no-ignore-case 'L[0-3]')" != "" ]]
|
||||
then
|
||||
likeLevel="$(echo "$genre" | grep --no-ignore-case -o 'L[0-3]' | grep -o '[0-3]')"
|
||||
genre="$(echo $genre | sed -e 's/L[0-3]//' -e 's/ / /g' -e 's/^" */"/' -e 's/ *"$/"/')"
|
||||
fi
|
||||
if [[ "$(echo "$genre" | grep --no-ignore-case 'B[0-3]')" != "" ]]
|
||||
then
|
||||
blockLevel="$(echo "$genre" | grep --no-ignore-case -o 'B[0-3]' | grep -o '[0-3]')"
|
||||
genre="$(echo $genre | sed -e 's/B[0-3]//' -e 's/ / /g' -e 's/^" */"/' -e 's/ *"$/"/')"
|
||||
fi
|
||||
|
||||
local playlist="all"
|
||||
if [[ "${genre,,}" == "lofi" ]]
|
||||
then
|
||||
playlist="lofi"
|
||||
elif [[ "$(echo ${genre} | grep --no-ignore-case LE)" != "" ]]
|
||||
then
|
||||
playlist="le"
|
||||
genre="$(echo $genre | sed -e 's/LE//' -e 's/ / /g' -e 's/^" */"/' -e 's/ *"$/"/')"
|
||||
elif [[ "$(echo ${genre} | grep --no-ignore-case ME)" != "" ]]
|
||||
then
|
||||
playlist="me"
|
||||
genre="$(echo $genre | sed -e 's/ME//' -e 's/ / /g' -e 's/^" */"/' -e 's/ *"$/"/')"
|
||||
elif [[ "$(echo ${genre} | grep --no-ignore-case HE)" != "" ]]
|
||||
then
|
||||
playlist="he"
|
||||
genre="$(echo $genre | sed -e 's/HE//' -e 's/ / /g' -e 's/^" */"/' -e 's/ *"$/"/')"
|
||||
elif [[ "$(echo ${genre} | grep --no-ignore-case DNP)" == "" ]]
|
||||
then
|
||||
playlist="dnp"
|
||||
genre="$(echo $genre | sed -e 's/DNP//' -e 's/ / /g' -e 's/^" */"/' -e 's/ *"$/"/')"
|
||||
fi
|
||||
|
||||
echo "$song {\"genre\":$genre,\"blockLevel\":$blockLevel,\"likeLevel\":$likeLevel,\"playlist\":\"$playlist\"}" \
|
||||
| jq -c -s add || error_here
|
||||
}
|
||||
Reference in New Issue
Block a user