Adds album duration and open-youtube scripts

master
Jonathan Hodgson 6 years ago
parent 08ce9a077d
commit 96c9b70762
  1. 15
      bin/albumDuration
  2. 12
      bin/open-youtube

@ -0,0 +1,15 @@
#!/usr/bin/env bash
shopt -s nullglob
let playlist_duration_ms=0
for song_file in *.{mp3,ogg,m4a,flac,wav}; do
playlist_duration_ms=$(expr $playlist_duration_ms + $(mediainfo --Inform="Audio;%Duration%" "$song_file"))
done
shopt -u nullglob
let playlist_duration_secs=$(expr $playlist_duration_ms / 1000)
let playlist_duration_mins=$(expr $playlist_duration_ms / 60000)
let playlist_duration_remaining_secs=$(expr $playlist_duration_secs - $(expr $playlist_duration_mins \* 60))
let playlist_duration_hours=$(expr $playlist_duration_mins / 60)
let playlist_duration_remaining_mins=$(expr $playlist_duration_mins - $(expr $playlist_duration_hours \* 60))
echo $playlist_duration_hours hours, $playlist_duration_remaining_mins minutes, $playlist_duration_remaining_secs seconds

@ -0,0 +1,12 @@
#!/bin/bash
url="$1"
if [ -z "$url" ]; then
url=$(rofi -dmenu -p 'URL')
fi
code=$(youtube-dl "$url" -F | sed -n '/format code/,$ p' | tail -n +2 | rofi -dmenu | awk '{print $1}')
mpv "$url" --ytdl-format="$code"
Loading…
Cancel
Save