284 lines
8.4 KiB
Bash
Executable file
284 lines
8.4 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
declare -A country;
|
|
country+=([af]="Afghanistan");
|
|
country+=([al]="Albania");
|
|
country+=([dz]="Algeria");
|
|
country+=([as]="American Samoa");
|
|
country+=([ad]="Andorra");
|
|
country+=([ao]="Angola");
|
|
country+=([ai]="Anguilla");
|
|
country+=([aq]="Antarctica");
|
|
country+=([ag]="Antigua and Barbuda");
|
|
country+=([ar]="Argentina");
|
|
country+=([am]="Armenia");
|
|
country+=([aw]="Aruba");
|
|
country+=([au]="Australia");
|
|
country+=([at]="Austria");
|
|
country+=([az]="Azerbaijan");
|
|
country+=([bs]="Bahamas");
|
|
country+=([bh]="Bahrain");
|
|
country+=([bd]="Bangladesh");
|
|
country+=([bb]="Barbados");
|
|
country+=([by]="Belarus");
|
|
country+=([be]="Belgium");
|
|
country+=([bz]="Belize");
|
|
country+=([bj]="Benin");
|
|
country+=([bm]="Bermuda");
|
|
country+=([bt]="Bhutan");
|
|
country+=([bo]="Bolivia");
|
|
country+=([bq]="Bonaire");
|
|
country+=([ba]="Bosnia and Herzegovina");
|
|
country+=([bw]="Botswana");
|
|
country+=([bv]="Bouvet Island");
|
|
country+=([br]="Brazil");
|
|
country+=([io]="British Indian Ocean Territory");
|
|
country+=([bn]="Brunei Darussalam");
|
|
country+=([bg]="Bulgaria");
|
|
country+=([bf]="Burkina Faso");
|
|
country+=([bi]="Burundi");
|
|
country+=([kh]="Cambodia");
|
|
country+=([cm]="Cameroon");
|
|
country+=([ca]="Canada");
|
|
country+=([cv]="Cape Verde");
|
|
country+=([ky]="Cayman Islands");
|
|
country+=([cf]="Central African Republic");
|
|
country+=([td]="Chad");
|
|
country+=([cl]="Chile");
|
|
country+=([cn]="China");
|
|
country+=([cx]="Christmas Island");
|
|
country+=([cc]="Cocos (Keeling) Islands");
|
|
country+=([co]="Colombia");
|
|
country+=([km]="Comoros");
|
|
country+=([cg]="Congo");
|
|
country+=([cd]="Democratic Republic of the Congo");
|
|
country+=([ck]="Cook Islands");
|
|
country+=([cr]="Costa Rica");
|
|
country+=([hr]="Croatia");
|
|
country+=([cu]="Cuba");
|
|
country+=([cw]="Curacao");
|
|
country+=([cy]="Cyprus");
|
|
country+=([cz]="Czech Republic");
|
|
country+=([ci]="Cote d'Ivoire");
|
|
country+=([dk]="Denmark");
|
|
country+=([dj]="Djibouti");
|
|
country+=([dm]="Dominica");
|
|
country+=([do]="Dominican Republic");
|
|
country+=([ec]="Ecuador");
|
|
country+=([eg]="Egypt");
|
|
country+=([sv]="El Salvador");
|
|
country+=([gq]="Equatorial Guinea");
|
|
country+=([er]="Eritrea");
|
|
country+=([ee]="Estonia");
|
|
country+=([et]="Ethiopia");
|
|
country+=([fk]="Falkland Islands (Malvinas)");
|
|
country+=([fo]="Faroe Islands");
|
|
country+=([fj]="Fiji");
|
|
country+=([fi]="Finland");
|
|
country+=([fr]="France");
|
|
country+=([gf]="French Guiana");
|
|
country+=([pf]="French Polynesia");
|
|
country+=([tf]="French Southern Territories");
|
|
country+=([ga]="Gabon");
|
|
country+=([gm]="Gambia");
|
|
country+=([ge]="Georgia");
|
|
country+=([de]="Germany");
|
|
country+=([gh]="Ghana");
|
|
country+=([gi]="Gibraltar");
|
|
country+=([gr]="Greece");
|
|
country+=([gl]="Greenland");
|
|
country+=([gd]="Grenada");
|
|
country+=([gp]="Guadeloupe");
|
|
country+=([gu]="Guam");
|
|
country+=([gt]="Guatemala");
|
|
country+=([gg]="Guernsey");
|
|
country+=([gn]="Guinea");
|
|
country+=([gw]="Guinea-Bissau");
|
|
country+=([gy]="Guyana");
|
|
country+=([ht]="Haiti");
|
|
country+=([hm]="Heard Island and McDonald Islands");
|
|
country+=([va]="Holy See (Vatican City State)");
|
|
country+=([hn]="Honduras");
|
|
country+=([hk]="Hong Kong");
|
|
country+=([hu]="Hungary");
|
|
country+=([is]="Iceland");
|
|
country+=([in]="India");
|
|
country+=([id]="Indonesia");
|
|
country+=([ir]="Iran, Islamic Republic of");
|
|
country+=([iq]="Iraq");
|
|
country+=([ie]="Ireland");
|
|
country+=([im]="Isle of Man");
|
|
country+=([il]="Israel");
|
|
country+=([it]="Italy");
|
|
country+=([jm]="Jamaica");
|
|
country+=([jp]="Japan");
|
|
country+=([je]="Jersey");
|
|
country+=([jo]="Jordan");
|
|
country+=([kz]="Kazakhstan");
|
|
country+=([ke]="Kenya");
|
|
country+=([ki]="Kiribati");
|
|
country+=([kp]="Korea, Democratic People's Republic of");
|
|
country+=([kr]="Korea, Republic of");
|
|
country+=([kw]="Kuwait");
|
|
country+=([kg]="Kyrgyzstan");
|
|
country+=([la]="Lao People's Democratic Republic");
|
|
country+=([lv]="Latvia");
|
|
country+=([lb]="Lebanon");
|
|
country+=([ls]="Lesotho");
|
|
country+=([lr]="Liberia");
|
|
country+=([ly]="Libya");
|
|
country+=([li]="Liechtenstein");
|
|
country+=([lt]="Lithuania");
|
|
country+=([lu]="Luxembourg");
|
|
country+=([mo]="Macao");
|
|
country+=([mk]="Macedonia, the Former Yugoslav Republic of");
|
|
country+=([mg]="Madagascar");
|
|
country+=([mw]="Malawi");
|
|
country+=([my]="Malaysia");
|
|
country+=([mv]="Maldives");
|
|
country+=([ml]="Mali");
|
|
country+=([mt]="Malta");
|
|
country+=([mh]="Marshall Islands");
|
|
country+=([mq]="Martinique");
|
|
country+=([mr]="Mauritania");
|
|
country+=([mu]="Mauritius");
|
|
country+=([yt]="Mayotte");
|
|
country+=([mx]="Mexico");
|
|
country+=([fm]="Micronesia, Federated States of");
|
|
country+=([md]="Moldova, Republic of");
|
|
country+=([mc]="Monaco");
|
|
country+=([mn]="Mongolia");
|
|
country+=([me]="Montenegro");
|
|
country+=([ms]="Montserrat");
|
|
country+=([ma]="Morocco");
|
|
country+=([mz]="Mozambique");
|
|
country+=([mm]="Myanmar");
|
|
country+=([na]="Namibia");
|
|
country+=([nr]="Nauru");
|
|
country+=([np]="Nepal");
|
|
country+=([nl]="Netherlands");
|
|
country+=([nc]="New Caledonia");
|
|
country+=([nz]="New Zealand");
|
|
country+=([ni]="Nicaragua");
|
|
country+=([ne]="Niger");
|
|
country+=([ng]="Nigeria");
|
|
country+=([nu]="Niue");
|
|
country+=([nf]="Norfolk Island");
|
|
country+=([mp]="Northern Mariana Islands");
|
|
country+=([no]="Norway");
|
|
country+=([om]="Oman");
|
|
country+=([pk]="Pakistan");
|
|
country+=([pw]="Palau");
|
|
country+=([ps]="Palestine, State of");
|
|
country+=([pa]="Panama");
|
|
country+=([pg]="Papua New Guinea");
|
|
country+=([py]="Paraguay");
|
|
country+=([pe]="Peru");
|
|
country+=([ph]="Philippines");
|
|
country+=([pn]="Pitcairn");
|
|
country+=([pl]="Poland");
|
|
country+=([pt]="Portugal");
|
|
country+=([pr]="Puerto Rico");
|
|
country+=([qa]="Qatar");
|
|
country+=([ro]="Romania");
|
|
country+=([ru]="Russian Federation");
|
|
country+=([rw]="Rwanda");
|
|
country+=([re]="Reunion");
|
|
country+=([bl]="Saint Barthelemy");
|
|
country+=([sh]="Saint Helena");
|
|
country+=([kn]="Saint Kitts and Nevis");
|
|
country+=([lc]="Saint Lucia");
|
|
country+=([mf]="Saint Martin (French part)");
|
|
country+=([pm]="Saint Pierre and Miquelon");
|
|
country+=([vc]="Saint Vincent and the Grenadines");
|
|
country+=([ws]="Samoa");
|
|
country+=([sm]="San Marino");
|
|
country+=([st]="Sao Tome and Principe");
|
|
country+=([sa]="Saudi Arabia");
|
|
country+=([rs]="Serbia");
|
|
country+=([sc]="Seychelles");
|
|
country+=([sl]="Sierra Leone");
|
|
country+=([sg]="Singapore");
|
|
country+=([sx]="Sint Maarten (Dutch part)");
|
|
country+=([sk]="Slovakia");
|
|
country+=([si]="Slovenia");
|
|
country+=([sb]="Solomon Islands");
|
|
country+=([so]="Somalia");
|
|
country+=([za]="South Africa");
|
|
country+=([gs]="South Georgia and the South Sandwich Islands");
|
|
country+=([ss]="South Sudan");
|
|
country+=([es]="Spain");
|
|
country+=([lk]="Sri Lanka");
|
|
country+=([sd]="Sudan");
|
|
country+=([sr]="Suriname");
|
|
country+=([sj]="Svalbard and Jan Mayen");
|
|
country+=([sz]="Swaziland");
|
|
country+=([se]="Sweden");
|
|
country+=([ch]="Switzerland");
|
|
country+=([sy]="Syrian Arab Republic");
|
|
country+=([tw]="Taiwan");
|
|
country+=([tj]="Tajikistan");
|
|
country+=([tz]="United Republic of Tanzania");
|
|
country+=([th]="Thailand");
|
|
country+=([tl]="Timor-Leste");
|
|
country+=([tg]="Togo");
|
|
country+=([tk]="Tokelau");
|
|
country+=([to]="Tonga");
|
|
country+=([tt]="Trinidad and Tobago");
|
|
country+=([tn]="Tunisia");
|
|
country+=([tr]="Turkey");
|
|
country+=([tm]="Turkmenistan");
|
|
country+=([tc]="Turks and Caicos Islands");
|
|
country+=([tv]="Tuvalu");
|
|
country+=([ug]="Uganda");
|
|
country+=([ua]="Ukraine");
|
|
country+=([ae]="United Arab Emirates");
|
|
country+=([gb]="United Kingdom");
|
|
country+=([uk]="United Kingdom");
|
|
country+=([us]="United States");
|
|
country+=([um]="United States Minor Outlying Islands");
|
|
country+=([uy]="Uruguay");
|
|
country+=([uz]="Uzbekistan");
|
|
country+=([vu]="Vanuatu");
|
|
country+=([ve]="Venezuela");
|
|
country+=([vn]="Viet Nam");
|
|
country+=([vg]="British Virgin Islands");
|
|
country+=([vi]="US Virgin Islands");
|
|
country+=([wf]="Wallis and Futuna");
|
|
country+=([eh]="Western Sahara");
|
|
country+=([ye]="Yemen");
|
|
country+=([zm]="Zambia");
|
|
country+=([zw]="Zimbabwe");
|
|
|
|
declare -A language;
|
|
language+=([en]="English");
|
|
language+=([de]="Deutsch");
|
|
language+=([fr]="Français");
|
|
language+=([fi]="Suomi");
|
|
language+=([no]="Norsk");
|
|
language+=([se]="Svenska");
|
|
language+=([it]="Italiano");
|
|
language+=([es]="Español");
|
|
language+=([jp]="Nihongo");
|
|
language+=([la]="Latin");
|
|
language+=([goyu]="Taiwanese Mandarin");
|
|
language+=([ru]="Russian");
|
|
|
|
if cmus-remote -Q &>/dev/null ; then
|
|
COMMENT=$( cmus-remote -Q | grep "tag comment " | cut -d " " -f 3- )
|
|
LANGUAGE=$( echo $COMMENT | sed 's/.*lang:\([^,]\{2,4\}\).*/\1/')
|
|
if [ "$LANGUAGE" = "$COMMENT" ]; then
|
|
LANGUAGE="";
|
|
fi
|
|
COUNTRY=$( echo $COMMENT | sed 's/.*country:\([^.]\{2\}\).*/\1/')
|
|
if [ ! -z "$LANGUAGE" ] && [ ! -z "$COUNTRY" ]; then
|
|
echo "${language[$LANGUAGE]}, ${country[$COUNTRY]}"
|
|
elif [ ! -z "$LANGUAGE" ]; then
|
|
echo "${language[$LANGUAGE]}"
|
|
elif [ ! -z "$COUNTRY" ]; then
|
|
echo "${country[$COUNTRY]}"
|
|
else
|
|
echo "--"
|
|
fi
|
|
fi
|
|
|