-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathalbum.lua
More file actions
executable file
·25 lines (24 loc) · 882 Bytes
/
album.lua
File metadata and controls
executable file
·25 lines (24 loc) · 882 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/lua
album_name=arg[2] or "album"
player="mpv --no-video"
-- FIXME: add user Music path
--music="$HOME/$MUSIC"
music="~/Música"
--print help
if arg[1]=="-h" then
print("album - m3u automaker and visualizer")
print("USAGE:\n album [OPTION] NAME")
print("\n-c\tcreate a playlist NAME.m3u with all files inside curr. dir")
print("-m\tmove all playlists inside dir to Music dir in HOME")
print("\nIf no first option is given, it shows all m3u files in MUSIC.")
print("\nElse, it plays NAME album with PLAYER.")
elseif arg[1]=="-m" then
os.execute("mv *.m3u "..music)
--FIXME:add non-Unix support (what?)
elseif arg[1]=="-c" then
os.execute([[find "$PWD" | grep "mp3\|wav\|m4a\|ogg\|opus\|flac" >]]..album_name .. ".m3u")
elseif arg[1]=="show" or arg[1]==nil then
os.execute("ls "..music.." | grep m3u")
else
os.execute(player.." "..music.."/"..arg[1]..".m3u")
end