From 72d1261e48a40f5d448d7496d2af2ac659444b28 Mon Sep 17 00:00:00 2001 From: mio-dokuhaki Date: Sat, 5 Apr 2025 19:10:21 +0900 Subject: bug fix for Weather.py --- config/hypr/UserScripts/Weather.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'config/hypr/UserScripts') diff --git a/config/hypr/UserScripts/Weather.py b/config/hypr/UserScripts/Weather.py index b9efe4e4..c962ecd3 100755 --- a/config/hypr/UserScripts/Weather.py +++ b/config/hypr/UserScripts/Weather.py @@ -22,30 +22,32 @@ weather_icons = { "default": "", } + # Get current location based on IP address def get_location(): response = requests.get("https://ipinfo.io") data = response.json() loc = data["loc"].split(",") return float(loc[0]), float(loc[1]) - + + # Get latitude and longitude latitude, longitude = get_location() # Open-Meteo API endpoint url = f"https://weather.com/en-PH/weather/today/l/{latitude},{longitude}" -# manual location_id +# manual location_id # NOTE: if you want to add manually, make sure you disable def get_location above # to get your own location_id, go to https://weather.com & search your location. # once you choose your location, you can see the location_id in the URL(64 chars long hex string) # like this: https://weather.com/en-PH/weather/today/l/bca47d1099e762a012b9a139c36f30a0b1e647f69c0c4ac28b537e7ae9c1c200 -#location_id = "bca47d1099e762a012b9a139c36f30a0b1e647f69c0c4ac28b537e7ae9c1c200" # TODO +# location_id = "bca47d1099e762a012b9a139c36f30a0b1e647f69c0c4ac28b537e7ae9c1c200" # TODO # NOTE to change to deg F, change the URL to your preffered location after weather.com # Default is English-Philippines with Busan, South Korea as location_id # get html page -#url = "https://weather.com/en-PH/weather/today/l/" + location_id +# url = "https://weather.com/en-PH/weather/today/l/" + location_id html_data = PyQuery(url=url) @@ -86,7 +88,7 @@ temp_max = ( temp_min_max = f" {temp_min}\t\t {temp_max}" # wind speed -wind_speed = html_data("span[data-testid='Wind']").text().split("\n")[1] +wind_speed = html_data("span[data-testid='Wind']").text().split("\n")[0] wind_text = f" {wind_speed}" # humidity -- cgit v1.2.3 From 4a32690728aaa342374f82a81f1c9c410b90f158 Mon Sep 17 00:00:00 2001 From: Daniel Walker Date: Thu, 1 May 2025 06:19:15 -0700 Subject: Update Weather.py fix wind speed display --- config/hypr/UserScripts/Weather.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'config/hypr/UserScripts') diff --git a/config/hypr/UserScripts/Weather.py b/config/hypr/UserScripts/Weather.py index c962ecd3..efa96813 100755 --- a/config/hypr/UserScripts/Weather.py +++ b/config/hypr/UserScripts/Weather.py @@ -88,7 +88,7 @@ temp_max = ( temp_min_max = f" {temp_min}\t\t {temp_max}" # wind speed -wind_speed = html_data("span[data-testid='Wind']").text().split("\n")[0] +wind_speed = str(html_data("span[data-testid='Wind'] > span").text()) wind_text = f" {wind_speed}" # humidity -- cgit v1.2.3 From 0f784309527acc4a22c81eb2d44d4d16f3676c39 Mon Sep 17 00:00:00 2001 From: Choudhry <23042676+ItsChoudhry@users.noreply.github.com> Date: Mon, 5 May 2025 02:10:05 +0100 Subject: Replace tilda with $HOME because it's expands correctly this way --- config/hypr/UserScripts/Weather.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'config/hypr/UserScripts') diff --git a/config/hypr/UserScripts/Weather.sh b/config/hypr/UserScripts/Weather.sh index f5bf9fa9..0294e042 100755 --- a/config/hypr/UserScripts/Weather.sh +++ b/config/hypr/UserScripts/Weather.sh @@ -4,7 +4,7 @@ # Remember to add city city= -cachedir="~/.cache/rbn" +cachedir="$HOME/.cache/rbn" cachefile=${0##*/}-$1 if [ ! -d $cachedir ]; then @@ -84,4 +84,4 @@ echo -e "{\"text\":\""$temperature $condition"\", \"alt\":\""${weather[0]}"\", \ cached_weather=" $temperature \n$condition ${weather[1]}" -echo -e $cached_weather > "~/.cache/.weather_cache" \ No newline at end of file +echo -e $cached_weather > "$HOME/.cache/.weather_cache" -- cgit v1.2.3 From 62c1b8dd31e2273f927e6e1582497b5e16af1273 Mon Sep 17 00:00:00 2001 From: Marko Pekkola Date: Fri, 9 May 2025 16:01:15 +0300 Subject: feat: Add continuous playback to RofiBeats during choosing next music desc: - Remove stop_music from start of script - call stop_music after user selections are done - Add "Stop RofiBeats" user choice to allow stopping player (kill mpv) Previously, this could be done by opening RofiBeats. Note: stopping player and music are different. Music can be stopped using global keybinds. These changes keep playing (previous) music until next one is chosen. --- config/hypr/UserScripts/RofiBeats.sh | 65 +++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 23 deletions(-) (limited to 'config/hypr/UserScripts') diff --git a/config/hypr/UserScripts/RofiBeats.sh b/config/hypr/UserScripts/RofiBeats.sh index 781e9f64..1cddce09 100755 --- a/config/hypr/UserScripts/RofiBeats.sh +++ b/config/hypr/UserScripts/RofiBeats.sh @@ -58,7 +58,10 @@ play_local_music() { # Find the corresponding file path based on user's choice and set that to play the song then continue on the list for (( i=0; i<"${#filenames[@]}"; ++i )); do if [ "${filenames[$i]}" = "$choice" ]; then - + + if music_playing; then + stop_music + fi notification "$choice" mpv --playlist-start="$i" --loop-playlist --vid=no "${local_music[@]}" @@ -69,6 +72,9 @@ play_local_music() { # Main function for shuffling local music shuffle_local_music() { + if music_playing; then + stop_music + fi notification "Shuffle Play local music" # Play music in $mDIR on shuffle @@ -87,12 +93,20 @@ play_online_music() { link="${online_music[$choice]}" + if music_playing; then + stop_music + fi notification "$choice" # Play the selected online music using mpv mpv --shuffle --vid=no "$link" } +# Function to check if music is already playing +music_playing() { + pgrep -x "mpv" > /dev/null +} + # Function to stop music and kill mpv processes stop_music() { mpv_pids=$(pgrep -x mpv) @@ -110,25 +124,30 @@ stop_music() { fi } -# Check if music is already playing -if pgrep -x "mpv" > /dev/null; then - stop_music -else - user_choice=$(printf "Play from Online Stations\nPlay from Music directory\nShuffle Play from Music directory" | rofi -dmenu -config $rofi_theme_1) - - echo "User choice: $user_choice" - - case "$user_choice" in - "Play from Music directory") - play_local_music - ;; - "Play from Online Stations") - play_online_music - ;; - "Shuffle Play from Music directory") - shuffle_local_music - ;; - *) - ;; - esac -fi \ No newline at end of file +user_choice=$(printf "%s\n" \ + "Play from Online Stations" \ + "Play from Music directory" \ + "Shuffle Play from Music directory" \ + "Stop RofiBeats" \ + | rofi -dmenu -config $rofi_theme_1) + +echo "User choice: $user_choice" + +case "$user_choice" in + "Play from Online Stations") + play_online_music + ;; + "Play from Music directory") + play_local_music + ;; + "Shuffle Play from Music directory") + shuffle_local_music + ;; + "Stop RofiBeats") + if music_playing; then + stop_music + fi + ;; + *) + ;; +esac -- cgit v1.2.3