Showing posts with label arch linux. Show all posts
Showing posts with label arch linux. Show all posts

Monday, September 2, 2013

Editing ID3 tags from command line using Python.

You can build a Python module from scratch just to edit ID3 tags, but there is no need to reinvent the wheel since there are many modules ready for this job.I have been using http://id3-py.sourceforge.net which is very straightforward , anyway, here is a little How-to
* Download the module and extract it to any directory you like
* Navigate to the directory where you extracted the module to
cd /ID3/id3-py-1.2
*Install the module
sudo python setup.py install
* If there is no errors , you are ready to go.
download this python script created by the same author ,
http://id3-py.sourceforge.net/ID3/id3-tagger.py
make it executable
chmod  a+x id3-tagger.py
 , you can copy the file to the home directory for an easier access
we are almost done,
here is an example on how to use the file
find ./ -d 1 -name '*.mp3' -exec ~/id3-tagger.py -A 'soundcloud' {} \;

this command will search for any mp3 file in the directory [not recursively] , then will modify the Album tag to soundcloud , you can modify/add different tags to the command as you wish.

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 =) .


Wednesday, May 8, 2013

How to add "show desktop" button to Tint2 panel ?

As openbox user , who uses tint2 and likes it very much , i tend to miss my show desktop button I enjoyed in other panels (xfce4,etc) ...
here is brief how-to guide to add "show desktop" button to Tint2 panel..
1-you need to have tint2-svn version of tint2 which includes applications launcher
2- make sure you have wmctrl app installed ..
3- cd to /usr/bin

cd usr/bin
 and create show_desktop.sh script with the following code
 #!/bin/sh  
 if wmctrl -m | grep "mode: ON"; then  
 exec wmctrl -k off  
 else  
 exec wmctrl -k on  
 fi  
save the file and change its permission to a+x

chmod a+x show_desktop.sh

now we need to create .desktop entry for our script 

cd usr/share/applications

sudo mousepad show_desktop.desktop s

add the following

[Desktop Entry]

Version=1.0

Exec=/usr/bin/show_desktop.sh

Icon=/usr/share/applications/Desktop-32.png

Terminal=false

Type=Application

Icon line is optional , but if you want to use customized icon ,
move the icon to /usr/share/applications ,
 identify the icon
identify Desktop-32.png
 and modify the line accordingly
modify your tint2rc configuration file and add the following
#------------------------------------------
#LAUNCHER
#------------------------------------------
launcher_icon_theme = areao43
launcher_padding = 4 4
launcher_background_id = 1
launcher_icon_size = 40 
launcher_item_app = /usr/share/applications/showdesktop.desktop

here is screenshot of my desktop =)
 

 sources used in this how-to with some personal modifications

 https://wiki.archlinux.org/index.php/Tint2#Application_Launchers_in_tint2-svn_.28AUR.29
http://crunchbang.org/forums/viewtopic.php?id=6455
 http://code.google.com/p/tint2/wiki/FAQ#Adding_a_%27show_desktop%27_button

Thursday, April 25, 2013

Chinese characters not displayed properly in firefox ?

I use Arch -Linux linux distribution, I don't speak chinese , but I surf some chinese trackers from time to time , the problem is the characters are not displayed properly as you can see in this screenshot
so, how can we fix it?
just install this package .. which is basically a sans-serif font with all chinese glyphs 
sudo pacman -S wqy-microhei

that's it.

Thursday, April 11, 2013

How make usb-headset as default sound card in Arch Linux

last week I installed ArchBang as replacement to ubuntu ,the installation process went smoothly since all partitions were already set-up, I like it so far , it's more challenging and the learning-curve for me has been great, it requires much more tweaking but in the end , you are in control of every bit of your system. I had few problems though, one of them was cofiguring ALSA sound drivers to take USB-Headset as default card for sound playback, it's possible to choose the audio driver in Smplayer and VLC but not all apps offer this feature and best solution is to edit system-wide setting to take the usb-headset as default.
this is the source I used (if you are into reading  +1000 word guide =) ).
here what i did:
I created a sh script  to generate .asoundrc file with usb-headset as default device
 nano asoundrc.sh  
 paste the following code
 % cat /usr/bin/asoundrc  
 #!/bin/bash  
 # asoundrc v0.1.0 20090101 markc@renta.net GPLv3  
 # asoundrc v0.2.0 20090320 quatro_por_quatro@yahoo.es GPLv3  
 #  
 # A simple script to create a particular default audio device regardless  
 # of what cards are loaded or in what order. It could be used anytime or  
 # placed in a ~/.bashrc script for a persistent setup every login.  
 #  
 # Usage: asoundrc [DEFAULT_CARD] > ~/.asoundrc  
 # use the first parameter as the card name, or else  
 # look for the sound card, discarding those that are only microphones  
 # when there are multiple cards, use the first one  
 if default_card="${1:-$(cat "$(for f in $(ls -1 /proc/asound/card[0-9]*/{midi,codec}* 2>/dev/null); do echo "${f%/*}"; done \  
 | sed -e '\|^[\[:blank:]\]$|d' -e 'q')/id" 2>/dev/null)}"; then  
   echo "Using sound card: ${default_card}" >&2   
   cat /proc/asound/card[0-9]*/id | \  
   gawk --assign default_card="${default_card}" \  
 '{print "pcm."$1" { type hw; card "$1"; }\nctl."$1" { type hw; card "$1"; }" }  
 END {print "pcm.!default pcm."default_card"\nctl.!default ctl."default_card}'  
 else  
   echo "Warning: No sound cards found." >&2  
 fi 
 
 chmod a+x asounrc.sh  
execute the script

here is the output in my case


Using sound card: Intel
pcm.Intel { type hw; card Intel; }
ctl.Intel { type hw; card Intel; }
pcm.CinemaTM { type hw; card CinemaTM; }
ctl.CinemaTM { type hw; card CinemaTM; }
pcm.Headset { type hw; card Headset; }
ctl.Headset { type hw; card Headset; }
pcm.!default pcm.Intel
ctl.!default ctl.Intel
as you can tell, the default card  is Intel (last two lines) , all we need to replace intel with Headset ,copy the text
now create .asoundrc file in your home folder , paste the code , log out then log-in , to see the changes

 #create .asoundrc file in your home folder  
 sudo nano ~/.asoundrc  
 #paste the code and save your work  
 pcm.Intel { type hw; card Intel; }  
 ctl.Intel { type hw; card Intel; }  
 pcm.CinemaTM { type hw; card CinemaTM; }  
 ctl.CinemaTM { type hw; card CinemaTM; }  
 pcm.Headset { type hw; card Headset; }  
 ctl.Headset { type hw; card Headset; }  
 pcm.!default pcm.Headset  
 ctl.!default ctl.Headset  

there are may be other ways to do the same thing but this one sounds simple and did the job for me.