Here's a solution I found to a problem some people posted about in these threads, however, I can't seem to reply to those posts so I'm creating this new thread. First, you need to install python-nautilus and python-mutagen. You might have to add the python-nautilus library path to the PYTHONPATH variable. Then create a directory called python-extensions in ~/.nautilus. Put the script below in that directory in a file called bsc.py or you can download the attachment. Remember that python uses tabs for defining scope, so if you copy and paste the script below then you'll have to replace the spaces with tabs. Finally, restart nautilus. That should do it.
P.S. I took the code from this post and modified it.
Code:
import os
import urllib
import nautilus
from mutagen.easyid3 import EasyID3
from mutagen.mp3 import MPEGInfo
class ColumnExtension(nautilus.ColumnProvider, nautilus.InfoProvider):
def __init__(self):
pass
def get_columns(self):
return (nautilus.Column("NautilusPython::title_column",
"title",
"Title",
"Song title"),
nautilus.Column("NautilusPython::album_column",
"album",
"Album",
"Album"),
nautilus.Column("NautilusPython::artist_column",
"artist",
"Artist",
"Artist"),
nautilus.Column("NautilusPython::bitrate_column",
"bitrate",
"Bitrate",
"Bitrate"),)
def update_file_info(self, file):
if file.get_uri_scheme() != 'file':
return
if file.is_mime_type('audio/mpeg'):
filename = urllib.unquote(file.get_uri()[7:])
audio = EasyID3(filename)
if (os.path.isfile (filename)):
mpfile = open (filename)
mpinfo = MPEGInfo (mpfile)
br = str(mpinfo.bitrate/1000) + " Kbps"
else:
br = ""
file.add_string_attribute('title', audio["title"][0])
file.add_string_attribute('album', audio["album"][0])
file.add_string_attribute('artist', audio["artist"][0])
file.add_string_attribute('bitrate', br)
self.get_columns()
Bookmarks