[k3b] [Bug 60272] A nero-like cover editor should be included

teknopaul via KDE Bugzilla bugzilla_noreply at kde.org
Sat Aug 20 21:09:05 UTC 2016


https://bugs.kde.org/show_bug.cgi?id=60272

teknopaul <teknopaul at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |teknopaul at gmail.com

--- Comment #16 from teknopaul <teknopaul at gmail.com> ---
Anyone finding this , the following script converts a .k3b saved MP3 CD image
file to an Inkscape compatible .svg file for printing.  A bit of SVG hacking is
required to tune the output.
You might want to fiddle the image size, I print smaller than CD size for
insert slips in a CD case.
Also might provide some hints for how to easily implement this feature in K3B.

Save as  k3btosvg.sh  in a ~/bin directory.


#!/bin/bash -e
#
# Create an Inkscape SVG file from a K3B saved disk.
#
# K3B saved disk format is a zipped XML file with a list of the files 
# including, thankfully, the expanded title an author from a MP3 files.
#
# Bit hacky, potentially breaks if the K3B XML writing code changes.
#

SRC="$1"

if [ "$SRC" == "" ] ; then
    echo "Usage: $0 [k3b filename]"
    exit 1
fi

#
# cd to the file's directory first
#
cd $(dirname "$SRC")

#
# Make a temp dir extract the k3b file.
#
mkdir .tmp
cp "$SRC" ".tmp/$SRC.out"
cd .tmp
unzip "$SRC.out" >/dev/null

#
# Extract the file title and artist from the XML.
#
cat maindata.xml | egrep  'title|artist' | sed ':a;N;$!ba;s/\n/ /g' | sed
's/<\/artist>/<\/flowPara>\n/g' > maindata.txt
sed -i 's/<title>/<flowPara>/g' maindata.txt
sed -i 's/<\/title>/ - /g' maindata.txt
sed -i 's/<artist>//g' maindata.txt

#
# Show the user what we found
#
cat maindata.txt

#
# Create ain inkscape compatible CD cover file.
#
echo '
<svg xmlns="http://www.w3.org/2000/svg"
     width="343pt"
     height="340pt"
     version="1.1">
    <g>
        <rect style="fill:none;stroke:#000000;stroke-width:0.12253583"
              width="335.02722" height="370.02722" x="48.736393" y="34.361393"
ry="0">
        </rect>
        <flowRoot
style="font-size:12px;line-height:125%;color:#000000;font-family:Sans">
            <flowRegion>
                <rect width="335.02722" height="370.02722" x="54.375" y="35" />
            </flowRegion>
' > "../$SRC.svg"

cat maindata.txt              >> "../$SRC.svg"

echo '
    </flowRoot>
  </g>
</svg>
' >> "../$SRC.svg"

#
# Open inkscape
#

inkscape "../$SRC.svg" &

#
# Clean up the extracted files
#
cd ..
rm .tmp/*
rmdir .tmp

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the k3b mailing list