Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have Rhythmbox syncing quite well with my Android phone. It automatically transcodes from FLAC to M4a and keeps the correct directory structure and track file names. So far so good.

However, the sync process is not copying over the album art. In each album directory I have a file called "cover.jpg" which Rhythmbox uses quite well, but it doesn't make the journey to my Android SD card. On Banshee, the album art is copied, but it has a vexing array of other bugs which keep me from using it as a workaround.

share|improve this question
add comment

1 Answer 1

I have a very similar setup with the exception that I do not transcode my flac files. I found that I needed to embed the album art into the flac file itself using metaflac:

metaflac --import-picture-from="yourcover.jpg" "yourmusicfile.flac"

You'll have to make a script for this process, but I have a perl script that you can use that just needs modifying to match your directory locations:

#!/usr/bin/perl

use strict;
use warnings;

my $artist;
my $album;
my $filename;
my $cover_filename;

if($#ARGV != 0)
{
    print("Usage: add_album_art_flac.pl <TOP DIR>\n");
    exit;
}

print("Getting artist album info...\n");
my @flac_album_artist = `find . -type f -name \"*.flac\" -exec metaflac --with-filename --show-tag=\"Artist\" --show-tag=\"Album\" {} \\\;`;
print("Got artist album info\n");

foreach my $flac_file (@flac_album_artist)
{
    if($flac_file =~ /^(.+):ARTIST=(.+)$/)
    {
        $filename = $1;
        $artist = $2;
    }
    elsif($flac_file =~ /^(.+):ALBUM=(.+)$/)
    {
        if($filename ne $1)
        {
            undef $artist;
            print("ERROR: Failed Sanity Check.  Dying...");
            die;
        }
        elsif(defined $artist)
        {
            $album = $2;
            $cover_filename = "/home/fred/.cache/rhythmbox/covers/$artist - $album.jpg";

            print("Fetching $cover_filename...\n");
            system("metaflac --import-picture-from=\"$cover_filename\" \"$filename\"");

            if($? == -1)
            {
                print("Failed to add $cover_filename to $artist - $album\n");
            }
            else
            {
                print("Successfully added $cover_filename to $filename\n");
            }
        }

        undef $artist;
    }
    else
    {
        print("ERROR: Bad line.  Dying...\n");
        die;
    }
}
share|improve this answer
    
I didn't even know this was possible with FLAC files. Been using RubyRip, Picard and QuodLibet and none of these has this option. Will have to think about the pros/cons of this approach before I do it. In general, however, I like the idea...thanks! –  HDave Mar 5 '13 at 20:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.