You are not logged in.

#1 2016-04-02 16:02:52

kudykennedy
Member
Registered: 2015-04-11
Posts: 21

A custom audio player bash script based on mpv for learning languages

Here is my directory structure... using Arabic for example.

https://s15.postimg.org/59lfkgre3/2016- … _scrot.png

Folder AR_ARABIC is having ~40 folders for each themes (the left window), inside each having audios-ar and audios-en for audio of respective language (middle window), and inside them are hundred of audio files (right window).

Given 22.mp3 from _ar and _en are about the same meaning (translation), how to make a bash script that ask for what theme, then translate or not, then from en to ar or vice versa, then whether it should shuffle. Then it goes on and play.

It also should be capable of handle multiple themes (maybe all).And also be able to expand into handle two, three languages at once in the future (not just arabic and english)

I am familiar with general programming, but a newbie in bash, I do not know where to start, and if I do it right. Here is my attempt:

#!/bin/bash
COURSE=1
FROM=en
TO=ar
FROMLIST=$COURSE/audios-$FROM/*
TOLIST=$COURSE/audios-$TO/*
a1=($FROMLIST)
a2=($TOLIST)
echo ${a1[2]}

And I am stuck, trying to make it play.
Any help and tips are appreciated.

Last edited by jasonwryan (2016-04-02 18:48:03)

Offline

#2 2016-04-02 18:55:45

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: A custom audio player bash script based on mpv for learning languages

Please read the Forum Etiquette and only post thumbnails http://wiki.archlinux.org/index.php/For … s_and_code [jwr]

For user input, you want `read -p` (this will read the answer into the variable $theme):

read -p "What theme do you want to use " theme

etc...

Then pass all the entered variables to your music player...

To learn more about Bash, start with the Bash Guide http://mywiki.wooledge.org/BashGuide
The rest of the Wooledge wiki is similarly excellent.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB