If the seek bar of your rhythmbox is not working with some mp3 files, it might be an issue with Variable Bit Rate of them. The tool, ‘vbrfix’ written by William Pye solves the issue, but the problem is that it doesn’t have an option to search for files recursively. Here is a small python script that gets the paths of multiple mp3 files recursively and give them as arguments to vbrfix tool. Make sure you install vbrfix (from the software repo) before running the script.
Please see comments for a better, 1 line substitute to do the same. Thanks to Rajeesh ettan and Syam ettan 🙂
#!/usr/bin/env python # -*- coding: utf-8 -*- # # vbrfixdir.py # # Copyright 2011 Ershad K <ershad92@gmail.com>Â Â Â # # Usage: python vbrfixdir.py # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. import sys import os quote = '"' folder = sys.argv[1] find_command = "find " + folder find_command += " > mp3files_list" os.system(find_command) os.system("sed 1d mp3files_list > mp3files_list1"); f = open("mp3files_list1", 'r') for line in f: line = line[:len(line)-1] command = "vbrfix -always " command += quote + line + quote command += " " + quote + line + quote print command os.system(command) os.system("rm mp3files_list mp3files_list1")
Improvements to code and suggestions are always welcome, Happy Hacking 🙂
Couldn’t resist, but…
find $1 -name *.[Mm][Pp]3 -exec vbrfix -always {} \;
😉
Awesome! vbrfix accepts two more arguments, in and out filenames. Both are same here, etta, how could we fix that too?
find $1 -name *.[Mm][Pp]3 -exec vbrfix -always {} {} \;
might work, I guess. In find command, “{}” is used in place of the found file.
Yes, it works!! One line substitute is really awesome.
If you’re going to use the find command, then it already has a provision to execute another arbitrary program for each file it finds.
For example:
find -iname “*.mp3” -exec ls -l {} \;
The above command will execute “ls -l” for each mp3 file it finds (and the search is recursive by default). Just go through the man page of find and checkout the -exec option. {} will be replaced by the filename.
I hope this will serve the purpose here.
This is new information to me. It’s really wonderful to solve this problem by a single command with arguments! How could we specify more arguments to the application that gets executed on finding mp3 file?
Just specify all arguments after the name of the command. In the example I posted, ‘-l’ was an argument to ‘ls’.
Ok. etta 🙂 Thanks a lot.