15

As it has been decided, Ubuntu Precise 12.04 will feature Rhythmbox as the default music player. I am aware, that it does not mean that I will not be able to use Banshee, nevertheless I would like to switch to it.

I have been a Rhythmbox fan for a long time, but after the switch to Banshee in Natty I decided to give it a try and completely migrated to it. However, I am not very happy with it, it lags for me a lot and has some other issues.

I would like to export all Banshee data to Rhythmbox. That includes:

  • Music library
  • Playlists
  • Preferably playcounts and ratings
  • Radio stations
  • Cover pictures

What should I do to move all this data to Rhythmbox, get it to work as the default music player, and smoothly switch completely to it?

4 Answers 4

13
+50

My two cents, applicable to Banshee 2.3.3 / Rhythmbox 2.95:

  1. Music library: just specify your Music folder to Rhythmbox and it will be imported
  2. Playlists:
    • Dynamic Playlists: as far as I know you will have to re-create them. Not fun, with additional complication due to the different feature sets of each player.
    • Static Playlists: just export them as .m3u in Banshee and re-import them in Rhythmbox
  3. Playcounts and ratings
    • Playcounts: I don't know
    • Ratings: create a dynamic playlist for each of the stars (i.e. create "rating1,rating2,rating3,rating4,rating5" dynamic playlists, then export them as .m3u, then import them in Rhythmbox. I just tested it, both players use filenames relative to ~ , so you will be fine.
    • One solution to both would be to implement #538549 - Use of ID3v2 Popularimeter for Rating (maybe Play Count)
  4. Radio stations: I don't know
  5. Cover pictures: while not a "migration" option, Rhythmbox 2.9x/3 does a better job at handling cover art. Try it by enabling the Cover Art and Cover Art Search plugins in Edit / Plugins. In my case (cover art stored as .jpg in the folder, or as ID3), they are recognized just fine

Hope that helps! Good luck :)

6
  • @rafalcieslak Welcome :) . I also like Rhythmbox a lot, and 2.95 is really an encouraging step forward! Jan 20, 2012 at 2:32
  • This sucks. No easy import/export for playlists, play counts, or cover art, and others. This blocks me from updating to 12.04, because as I understand it, upgrading will remove banshee, so all the above will be lost in an upgrade. I've also only realised now that banshee has no playlists (plural) export feature. You need to export each playlist individually! I should have dumped banshee in the beginning and used rhythmbox. (I started on Ubuntu with v11.10) Apr 28, 2012 at 16:25
  • @BullfrogBlues: You are wrong. Upgrading to 12.04 will not remove Banshee, so you are safe to proceed! :) Also, keep in mind that even if you removed Banshee, after reinstalling it all your data would be there, untouched! Awesome, isn't it? But anyhow, you can continue to use Banshee in 12.04, no need to move to Rhythmbox, if you prefer your current music player. So go ahead, upgrade to 12.04! Apr 28, 2012 at 16:42
  • I don't prefer banshee. I already attempted an upgrade and was prompted that certain packages would be removed, banshee was on of them. Now, maybe I misunderstood the prompt message, but it said banshee would be removed because it is not a supported package in 12.04. Either way, it didn't instill with me confidence to go ahead with the upgrade. But you should be right in that the banshee config files ~/username/.config/banshee-1/* which contains the banshee db should be ok during and upgrade. Apr 28, 2012 at 16:59
  • @rafalcieslak FYI Some applications are removed, banshee is one of them askubuntu.com/questions/111163/… Apr 28, 2012 at 17:42
5

The rhythmbox-banshee-import script will migrate play counts and ratings. Thanks to @xiphosurus. However, for the script to work you need to tell it where the banshee and rhythmbox databases are.

Preparing the script

Locate your rhythmbox and banshee db files. The default locations will be:

/home/YOUR_USERNAME/.local/share/rhythmbox/rhythmdb.xml
/home/YOUR_USERNAME/.config/banshee-1/banshee.db

Back them up! I'll say that again. Make a backup.

Now copy the banshee.db file into the same folder as the rhythmbox-banshee-import script. And then modify the rhythmbox-banshee-import script where line says:

RB_DB = 'rhythmdb.xml'

insert the path/to/your/rhythmboxdb.xml file, e.g.:

RB_DB = '/home/YOUR_USERNAME/.local/share/rhythmbox/rhythmdb.xml'

Now run the script and all play counts and playlists will be updated.

Troubleshooting

  • No module named lxml

    If you get an error ... ImportError: No module named lxml ... you need to install Python Xml Parsers:

    sudo apt-get install python-lxml
    
  • Permission denied

    If you get "Permission denied", it's either because you do not have sufficient permissions to access the file in the directory of other users or because the file is not executable. To make it executable, run:

    chmod +x /path/to/your/rhythmbox-banshee-import-script
    

Appendix

rhythmbox-banshee-import Script
#!/usr/bin/python

"""
Copyright (c) 2009 Wolfgang Steitz

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 3 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 sqlite3
from lxml import etree

RB_DB = 'rhythmdb.xml'
BA_DB = 'banshee.db'

class banshee_db():
    def __init__(self, file):
        self.con = sqlite3.connect(file)

    def get_song_info(self, url):
        try:
            res = self.con.execute('select Rating, Playcount from CoreTracks where uri = ?', (url,) ).fetchone()
            if res is None:
                return None, None
            else:
                return res
        except:
            return None, None


banshee = banshee_db(BA_DB)

tree = etree.parse(RB_DB)
root = tree.getroot()
for song in root:
    if song.get("type") == 'song':
        rating = None
        playcount = None
        for attr in song:
            if attr.tag == 'location':
                location = attr.text
            if attr.tag == 'rating':
                rating = attr.text
            if attr.tag == 'play-count':
                playcount = int(attr.text)
                song.remove(attr)

        rating_banshee, playcount_banshee = banshee.get_song_info(location)
        if rating is None:# noch kein rating in db
            if not (rating_banshee == 0 or rating_banshee is None):
                rating = rating_banshee

        if not (playcount_banshee == 0 or playcount_banshee is None):
            if playcount is None:
                playcount = playcount_banshee
            else:
                playcount += playcount_banshee

        #insert rating into rb db
        if rating is not None:
            element = etree.Element('rating')
            element.text = str(rating)
            song.append( element)
        #update playcount
        if playcount is not None:
            element = etree.Element('play-count')
            element.text = str(playcount)
            song.append( element)


tree.write(RB_DB)
1
2

To import ratings and play count, use this script! Worked for me!

http://code.google.com/p/rhythmbox-banshee-import/

1
  • I had high hopes for this when I glanced at the code, but alas, I got an error ImportError: No module named lxml. If the solution to this is as easy as apt-get install lxml it would be happy days, but here's the install guide lxml.de/installation.html. I don't like installing things when I haven't a clue what I'm actually installing or doing. Which is often. I often don't know what I'm doing. Apr 28, 2012 at 17:07
1

Some general ideas without actually investigating Rhythmbox & Banshee details yet:

  1. Importing the music database should be as easy as letting Rhythmbox scan all the files again.

  2. If you have configured Banshee to store the playcounts & ratings into the audio file's tags, and Rhythmbox supports importing Banshee ratings (many apps store ratings in a more or less "standardized" format that is easy to convert or even works without conversion accross music players, and I know Banshee supports that, but I'm not sure if Rhythmbox does), then those shouldn't be an issue on re-scan either.

  3. Cover pictures are often stored together with music files, and those should be detected on re-scan too. I'm not sure if Banshee also stores covers elsewhere?

  4. I expect Banshee can export playlists to some standard playlist format (e.g. .m3u/.pls files), that Rhythmbox can import?


I just found a plugin to save/read FMPS-compatible ratings in Rhythmbox (those are the ratings as Banshee also uses them). The article is in French, but the plugin itself seems to be in English. And maybe somebody can package it...


There is a Banshee extension banshee-extension-albumartwriter which writes downloaded album art to the directory that contains the music (by default it's only saved in a cache directory), that should help to get them into Rhythmbox too.


Banshee can export playlists to .m3u, .pls & .xspf, Rhythmbox can import such playlists (but if you have lots of them, that might be a lot of work...).

1
  • I told Banshee to store the counts and ratings in the media files, but it didn't import them into rhythmbox. I'm looking at the import script currently. Banshee is version: 2.9.0+really2.6.2-2ubuntu2.1
    – isaaclw
    Jan 16, 2015 at 3:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .