Wednesday, August 28, 2013

Bash Script To Extract Subtitles From MKV file.

well ,some times I prefer to do things using the command line ,especially when logging into my server remotely ,so I created a little bash script to help me extract subtitles from mkv files using mkvextract ( you have to install  mkvtoolnix-cli) , still , the file extension need to be added though.

 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
26
27
 nano sub-extractor.sh   
 ###paste the following  
filename="$1"
if [[ $filename ]]
then 
 m=$(mkvinfo $filename|grep 'No EBML head found');
 if [[ $m ]];
  then echo "This is not a valid mkv file";
  else  
    echo "proceeding...";
    mm=$(mkvinfo $filename|grep -i -A 2 -B 2 subtitle);
    if [[ $mm ]];
     then
      echo "subtitles found, proceeding...";
      mmm=$(echo $mm|grep -o 'mkvextract: [0-9]*'|grep -o '[0-9]*')
      arry1=$(echo $mmm|tr " " "\n ");
      for m in $arry1
       do mkvextract tracks $filename $mmm:${filename:0:-4}"_"$mmm; 
      done
    else 
     echo "no subs";
 fi;
 
   fi;
else
 echo "no file name given";
fi;

Monday, August 12, 2013

How to assign a key shourtcut for 3rd level special characters [archlinux]

I use Arabic and English on daily basis,for switching layouts I use qxkb app which is really effecient and easy to use . some times i need to type special characters ( گ چ ڤ ) etc, and to my suprise this option was already there in qxkb , here is a little illustrative
explanation


if there is a poroblem with the graphical user interface , you can copy and paste this command in your terminal
setxkbmap -option -option grp:lalt_lshift_toggle,lv3:caps_switch
,press and hold caps and type the special character, that is =) .