Page 1 of 15 12311 ... LastLast
Results 1 to 10 of 147

Thread: Adding mp3 info columns (e.g. bitrate, etc.) to nautilus list view

  1. #1
    Join Date
    Aug 2008
    Beans
    2

    Adding mp3 info columns (e.g. bitrate, etc.) to nautilus list view

    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()
    Attached Files Attached Files
    Last edited by geb666; August 3rd, 2008 at 08:15 PM. Reason: adding solved and thread links

  2. #2
    Join Date
    May 2007
    Location
    The New Forest
    Beans
    Hidden!
    Distro
    Xubuntu

    Re: Adding mp3 info columns (e.g. bitrate, etc.) to nautilus list view

    It could be that the original thread is in the archive - perhaps you could link to it so others can see.

    Could you also mark the thread as solved - it appeared that the thread was an unanswered support request, thanks.

  3. #3
    Join Date
    Jan 2009
    Beans
    2

    Re: [SOLVED] Adding mp3 info columns (e.g. bitrate, etc.) to nautilus list view

    Geb - worked like a charm. This was driving me crazy. Thanks so much for posting it. The only thing I noticed is it doesn't seem to work on network shared folders.
    Last edited by darrell_123; January 21st, 2009 at 04:26 AM.

  4. #4
    Join Date
    Sep 2008
    Location
    Kingston, Canada
    Beans
    39
    Distro
    Kubuntu 9.10 Karmic Koala

    Smile Re: [SOLVED] Adding mp3 info columns (e.g. bitrate, etc.) to nautilus list view

    I love this solution! Thanks guys! It was, however, missing one critical feature for me. It was missing a way to show the ID3 date tag. I've updated the script a bit, and here is my revision:

    It would be great if this script were also updated with support for displaying JPEG EXIF shooting data. I, unfortunately, am not a Python wizard.

    UPDATE: I have tried my best and updated this script with EXIF shooting information! It seems to work okay!

    UPDATE #2: It now works better! Sometimes mp3 info was there but not getting filled in, also mp3 length support is now added.

    UPDATE #3: Thanks to SabreWolfy for finding another unhandled exception!

    UPDATE #4: Thanks to gueba for discovering this script wasn't properly closing file handles until it terminates

    UPDATE #5: Thanks to Pitxyoki for discovering this script wasn't properly closing file handles if there's an exception

    UPDATE #6 (9/17/2009): Thanks to enbeto for finding a way to read video information!

    UPDATE #7 (9/23/2009): This is now in a Debian package for easy installation. I have kept the bsc-v2.py source attached in case anyone wants to review it. This is my first attempt at a Debian package, so please be nice in criticisms!

    UPDATE #8 (9/27/2009): Updated nautilus-columns to support ID3 tags in FLAC, thanks l-x-l! I can't upload the .deb to this site any more.

    UPDATE #9 (10/5/2009): MKV support added. Version bump to 0.01.

    UPDATE #10 (10/6/2009): postinit script automatically restarts Nautilus so options can be seen without logging in and logging out. Thanks thegutterpoet!

    UPDATE #10 (10/26/2009): album/date added for FLAC/video. Thanks eldon.t!

    UPDATE #10 (3/3/2010): wav file support, added sample rate file support thru mutagen and kaa (thanks for the idea N'ko) I cannot upload the .deb to Ubuntu Forums any longer, but hopefully this will get hosted at https://launchpad.net/~team1 ASAP.

    UPDATE #11 (4/17/2010): Track number fix, thanks l-x-l

    UPDATE #12 (1/23/2011): PDF support and more error handling when importing the libraries, thanks draxus! Included .deb in a zip file for easy installation.
    Attached Files Attached Files
    Last edited by jmdsdf; January 24th, 2011 at 04:10 AM. Reason: Updated script (thanks SabreWolfy/gueba/Pitxyoki/ebento/l-x-l!/eldon.t/draxus)

  5. #5
    Join Date
    Feb 2009
    Beans
    2

    Question Re: [SOLVED] Adding mp3 info columns (e.g. bitrate, etc.) to nautilus list view

    Can someone help me please?

    ID3 tag organization columns are necessary.
    I have followed this tutorial and used both provided files, the original and the edited one, neither work for me. I created the directory under /.nautilus, places the file there, and restarted nautilus. nothing happens.
    One thing I do not understand is the lin in the instructions stating to change a path in capital letters?

    please help the noob!

  6. #6
    Join Date
    Dec 2007
    Location
    Idaho
    Beans
    4,976
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: [SOLVED] Adding mp3 info columns (e.g. bitrate, etc.) to nautilus list view

    Quote Originally Posted by mrucci View Post
    Can someone help me please?

    ID3 tag organization columns are necessary.
    I have followed this tutorial and used both provided files, the original and the edited one, neither work for me. I created the directory under /.nautilus, places the file there, and restarted nautilus. nothing happens.
    One thing I do not understand is the lin in the instructions stating to change a path in capital letters?

    please help the noob!
    One important detail, did you put it under /.nautilus or ~/.nautilus, they are two very different places on your file system.
    "You can't expect to hold supreme executive power just because some watery tart lobbed a sword at you"

    "Don't let your mind wander -- it's too little to be let out alone."

  7. #7
    Join Date
    Sep 2008
    Location
    Kingston, Canada
    Beans
    39
    Distro
    Kubuntu 9.10 Karmic Koala

    Re: Adding mp3 info columns (e.g. bitrate, etc.) to nautilus list view

    mrucci, ensure all the dependencies are present, ensure that the script goes into ~/.nautilus/python-extensions/ or /usr/lib/nautilus/extensions-2.0/python/. Make sure you restart Nautilus (I just run "killall nautilus" from the terminal, or run dialog, i.e. Alt-F2). Then open Nautilus, and under Edit | Preferences | List Columns, you should see the extra columns. I hope this helps!

    Btw, I updated the script with some more field I hope these will help everyone with managing photos with meta data. One shortcoming I have noticed is that Nautilus, unlike Windows Explorer, does not remember which folders should have which column headers. Oh well. A small annoyance, but not a critical one.

  8. #8
    Join Date
    Feb 2009
    Beans
    2

    Re: [SOLVED] Adding mp3 info columns (e.g. bitrate, etc.) to nautilus list view

    Aahh! Thank you so much! It works now! one thing I passed was that there are instructions in the py file. need to read more.

    But yes, I think my directory orientation was off.

    Thanks for the help everyone, working great now!

  9. #9
    Join Date
    Dec 2007
    Beans
    16

    Re: [SOLVED] Adding mp3 info columns (e.g. bitrate, etc.) to nautilus list view

    Thanks for this great post! It's just what I need. Is there a way to view the mp3 track length/duration in a column?

  10. #10
    Join Date
    Apr 2008
    Beans
    275
    Distro
    Ubuntu 10.04 Lucid Lynx

    Question Re: [SOLVED] Adding mp3 info columns (e.g. bitrate, etc.) to nautilus list view

    <Experienced difficulties installing and using the script, but resolved them (my errors). Previous post here deleted.>
    Last edited by SabreWolfy; February 5th, 2009 at 10:50 PM.

Page 1 of 15 12311 ... LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •