A few things, mostly technical notes...

Sunday, December 22, 2013

mythtv - Auto-delete duplicate recordings with myth-remove-duplicates.sh


Question:

I have a large archive of recordings on a well-used mythbox and I know I have accumulated a lot of duplicates. I need to free some space, but going through and manually getting rid of the duplicates would be a monumental task.

Is there any mechanism or script available to track down these duplicates, and preferably delete all but the newest recording? I've searched the web and poked at my interface with no luck.

Answer:

You're welcome to use the script I wrote; I've been running it regularly to remove the duplicates.

$ wget http://evuraan.info/evuraan/stuff/myth-remove-duplicates.sh.txt -O myth-remove-duplicates.sh
$ chmod +x myth-remove-duplicates.sh 

Edit to replace RECORDINGDIR, user_name and pass_word with what's applicable to your setup and run myth-remove-duplicates.sh.

Running it :

$ ./myth-remove-duplicates.sh
1091_20131221090100.mpg is duplicate
removed `/var/lib/mythtv/recordings/1091_20131221090100.mpg'
1091_20131221070100.mpg is duplicate
removed `/var/lib/mythtv/recordings/1091_20131221070100.mpg'

Here's the script, myth-remove-duplicates.sh:

#!/bin/bash 
# Authored by Evuraan_AT_gmail_DOT_com
# ABSOLUTELY NO WARRANTY, to the extent permitted by
# applicable law.
# YMMV.
# Use at your own risk.

user_name="mythtv"
pass_word="yourpassword" 
RECORDINGDIR="/var/lib/mythtv/recordings"
list="/tmp/recordings.txt-$RANDOM-$RANDOM"
SQLSCRIPT="/tmp/recordings.sql-txt-$RANDOM-$RANDOM"

gen_lists(){
mysql -u "$user_name" -p"$pass_word" -e "select starttime,basename,title,description from recorded order by starttime" mythconverg | tac > $list
}

verify_duplicate(){
# if verbatim repeats..
sum_a=$(egrep "${a:0:16}" $list | awk -F".mpg\t" 'NR>1 {print $NF}' |md5sum) 
[ ! -z "$sum_a" ] && egrep "${a:0:16}" $list | awk -F".mpg\t" 'END {print $NF}' | md5sum |egrep -q  ${sum_a//-}
}

remove_duplicates(){
[ -s "${RECORDINGDIR}/${a}" ] && ( rm -v "${RECORDINGDIR}/${a}" ; 
	echo "DELETE FROM mythconverg.recorded WHERE basename = '$a';" > $SQLSCRIPT
	)
[ -s $SQLSCRIPT ] && mysql -u "$user_name" -p"$pass_word"   mythconverg < $SQLSCRIPT
}




gen_lists
awk {'print $3'} $list  |grep mpg$ | while read a ; do 
	[[ $(egrep -c ${a:0:16} $list ) -ge 2 ]]  && verify_duplicate && sed -i /"${a:0:16}"/d $list && echo $a is duplicate && remove_duplicates
done

rm $SQLSCRIPT $list 1>/dev/null 2>&1 || : 

Tuesday, July 30, 2013

mplayer - Cannot find codec for audio format 0x6134706D

mplayer is awesome!

 
I've been happily living with mplayer leveraging vdpau on my Ubuntu Lucid 10.04 LTS. Until today that is, when I tried to play videos from my SLR, and there was no audio. Upon close look, mplayer was complaining thusly:

FAAD: Failed to initialize the decoder!
ADecoder init failed :(
[aac @ 0x4442a60]Audio object type 0 is not supported.
Could not open codec.
ADecoder init failed :(
Cannot find codec for audio format 0x6134706D.
I did STFW, and tried a couple of things, none of those worked for me. That's when I decided to give mplayer2 a try. mplayer2 is a fork of mplayer, I had read elsewhere that it contains a number of features not available in the original MPlayer.

Since I use vdpau, the mplayer2 website indicated that it'd be a better bet for me:

Much better support for VDPAU functionality

  • Removed limitations that prevented switching frames more than once per monitor refresh. With MPlayer2 you can play high-FPS content or use fast forward on a 60 Hz monitor without breaking playback.
  • Added support for the frame timing functionality of VDPAU.
  • Improved performance by better buffer handling and smarter subtitle texture uploads (both VDPAU hardware decoding and displaying software decoded video with VDPAU perform better).
  • Added logic to reduce frame timing jitter in some situations.
  • Handle frames added by deinterlacing properly.
  • Several bugfixes.
  • Various minor improvements (studio level output support, set default deinterlace mode, ...)

Installing mplayer2 on  Ubuntu 10.04 LTS 

Here's how I found to install mplayer2 on ubuntu 10.04 LTS:

$ sudo add-apt-repository ppa:ripps818/coreavc
$  sudo apt-get update 
$  sudo apt-get install mplayer2 
 
For reference, here's my ~/.mplayer2/config file. (See archlinux wiki on more about these entries..)

$ cat ~/.mplayer2/config  
# Write your default config options here!
vo=vdpau,
vc=ffh264vdpau,ffmpeg12vdpau,ffodivxvdpau,ffwmv3vdpau,ffvc1vdpau,
 

mplayer2 and 0x6134706D

mplayer2 seem to be able to play all those files mplayer was complaining about. I think I like the vdpau quality better with mplayer2, or it could just be a phsycological placebo effect!

Either way, I love mplayer, and mplayer2!


 

Saturday, April 06, 2013

Comparing Calling Rates : Skype vs Fring Vs Rebtel

Comparing Calling Rates : Skype vs Fring Vs Rebtel

Rebtel wins hands down. (Best quality too!) (i use their android app) 



9.2c/min, 3.4c/min and 1.69c/min @Rebtel Wins!


http://evuraan.info/screenshots/images/skype_vs_fring_vs_rebtel.jpg

Saturday, March 09, 2013

install xbmc frodo on ubuntu 10.04 (Lucid)

xbmc does not seem to provide PPAs for Ubuntu Lucid at the moment. Like many others, I am not upgrading from Lucid LTS for another 2 years until its LTS span runs out, if I can help it.

Here's how to install xbmc 12.0 (aka Frodo) on Ubuntu Lucid:



sudo add-apt-repository ppa:nathan-renniewaldock/xbmc-nightly 
sudo apt-get update 
sudo apt-get install xbmc 
sudo apt-get install libtag1-dev 


Enjoy!

(reference)


Followers


Creative Commons License
This work is licensed under a Creative Commons License.