Commit 4fe719ff authored by Thomas Eschenbacher's avatar Thomas Eschenbacher

new plugin: export to K3B project file

parent 4ebea305
......@@ -62,6 +62,11 @@ Sven-Steffen Arndt <ssa29@gmx.de>
minor contributors, copyright holders and others
================================================
Sebastian Trueg <trueg@k3b.org>,
Gustavo Pichorim Boiko <gustavo.boiko@kdemail.net>
Michal Malek <michalm@jabster.pl>
* parts of plugins/export_k3b/K3BExportPlugin.cpp
Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
* libkwave/cpu_accel.cpp
......
......@@ -3,6 +3,7 @@ xx.xx.x [xxxx-xx-xx]
* reduced flicker of position widget
* bugfix: deleting labels per menu did not work
* new plugin: export to K3B project file
17.04.0 [2017-03-19]
......
......@@ -219,6 +219,7 @@ INCLUDE(GenerateExportHeader)
INCLUDE(FeatureSummary)
FIND_PACKAGE(KF5 REQUIRED COMPONENTS
Archive
Completion
Config
ConfigWidgets
......
......@@ -630,6 +630,18 @@ COMPLETE LIST OF FILES AND THEIR LICENSE
plugins/debug/DebugPlugin.h GPL2+
plugins/debug/kwaveplugin_debug.desktop.in GPL2+
plugins/export_k3b/CMakeLists.txt BSD (3 clause)
plugins/export_k3b/K3BExportDialog.cpp GPL2+
plugins/export_k3b/K3BExportDialog.h GPL2+
plugins/export_k3b/K3BExportPlugin.cpp GPL2+ / Sebastian Trueg <trueg@k3b.org>,
Gustavo Pichorim Boiko <gustavo.boiko@kdemail.net>
Michal Malek <michalm@jabster.pl>
plugins/export_k3b/K3BExportPlugin.h GPL2+
plugins/export_k3b/K3BExportWidget.cpp GPL2+
plugins/export_k3b/K3BExportWidget.h GPL2+
plugins/export_k3b/K3BExportWidegetBase.ui GPL2+
plugins/export_k3b/kwaveplugin_export_k3b.desktop.in GPL2+
plugins/goto/CMakeLists.txt BSD (3 clause)
plugins/goto/GotoDialog.cpp GPL2+
plugins/goto/GotoDialog.h GPL2+
......
......@@ -17,6 +17,7 @@
<!ENTITY url_flac "http://flac.sourceforge.net/">
<!ENTITY url_homepage "http://kwave.sourceforge.net/">
<!ENTITY url_id3lib "http://id3lib.sourceforge.net/">
<!ENTITY url_k3b "http://www.k3b.org/">
<!ENTITY url_lame "http://lame.sourceforge.net/">
<!ENTITY url_levelmeter "https://web.archive.org/web/*/http://www.rikkus.info/esound-level-meter/">
<!ENTITY url_libaudiofile "http://www.68k.org/~michael/audiofile/">
......@@ -147,6 +148,7 @@
<!ENTITY no-i18n-plugin_codec_ogg "codec_ogg">
<!ENTITY no-i18n-plugin_codec_wav "codec_wav">
<!ENTITY no-i18n-plugin_debug "debug">
<!ENTITY no-i18n-plugin_export_k3b "export_k3b">
<!ENTITY no-i18n-plugin_fileinfo "fileinfo">
<!ENTITY no-i18n-plugin_goto "goto">
<!ENTITY no-i18n-plugin_insert_at "insert_at">
......@@ -4456,6 +4458,9 @@
<indexdiv><title>d</title>
<indexentry><primaryie><link linkend="plugin_sect_debug" endterm="plugin_title_debug"/></primaryie></indexentry>
</indexdiv>
<indexdiv><title>e</title>
<indexentry><primaryie><link linkend="plugin_sect_export_k3b" endterm="plugin_title_export_k3b"/></primaryie></indexentry>
</indexdiv>
<indexdiv><title>f</title>
<indexentry><primaryie><link linkend="plugin_sect_fileinfo" endterm="plugin_title_fileinfo"/></primaryie></indexentry>
</indexdiv>
......@@ -5355,6 +5360,227 @@
</variablelist>
</sect1>
<!-- @PLUGIN@ export_k3b -->
<sect1 id="plugin_sect_export_k3b"><title id="plugin_title_export_k3b">&no-i18n-plugin_export_k3b; (Export to K3B Project)</title>
<screenshot>
<screeninfo>Screenshot</screeninfo>
<mediaobject>
<imageobject>
<imagedata fileref="kwave-plugin-export_k3b.png" format="PNG"/>
</imageobject>
<textobject>
<phrase>Screenshot of the K3B Export Plugin</phrase>
</textobject>
</mediaobject>
</screenshot>
<variablelist>
<varlistentry>
<term><emphasis role="bold">&i18n-plugin_lbl_internal_name;</emphasis></term>
<listitem><para><literal>&no-i18n-plugin_export_k3b;</literal></para></listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">&i18n-plugin_lbl_type;</emphasis></term>
<listitem><para>function</para></listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">&i18n-plugin_lbl_description;</emphasis></term>
<listitem>
<para>
Saves all sections between markers into a separate file and creates
a K3B project file. After having successfully written all files it
is possible to start <ulink url="&url_k3b;">K3B</ulink> and
burn the result to an audio CD.
This is useful for splitting a file with a recording that consists
of several parts, which are separated by labels, and then burn it
to an audio CD with multiple tracks, including CD text meta data
which is extracted from the descriptions of the labels.
</para>
<para>
(This plugin is internally using the
<link linkend="plugin_sect_saveblocks" endterm="plugin_title_saveblocks"/>
plugin.)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">&i18n-plugin_lbl_parameters;</emphasis></term>
<listitem>
<variablelist>
<varlistentry>
<term><replaceable>filename</replaceable></term>
<listitem>
<para>
The name of the K3B project file, will be used as
base name for the exported file names.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable>pattern</replaceable></term>
<listitem>
<para>
A pattern that will be used for detecting
title and artist from the label at the start
of a section.
It supports the following wildcards which
will be replaced by the corresponding content
when creating the CD text meta data:
</para>
<informaltable frame='all'>
<tgroup cols='2'>
<thead>
<row>
<entry align='left'>wildcard</entry>
<entry align='left'>description</entry>
</row>
</thead>
<tbody>
<row>
<entry>&no-i18n-tag;<command>[%artist]</command></entry>
<entry>
Will be replaced with the artist that performed
the corresponding block or alternatively the author.
</entry>
</row>
<row>
<entry>&no-i18n-tag;<command>[%title]</command></entry>
<entry>
Will be replaced with the title of the block, which is taken
from the descriptive text of the label at the
<emphasis>start</emphasis> of the block.
If that text is empty it will fall back to the title
of the file (see file information item
"<link linkend="INF_NAME">Name</link>").
If this also does not exist, it will fall back to the
base file name as described above.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
Example: <quote><command><literal>[%title] ([%artist])</literal></command></quote>
will detect author <quote><command><literal>Beethoven</literal></command></quote> and title
<quote><command><literal>Symphony No. 5</literal></command></quote> from the string
<quote><command><literal>Symphony No. 5 (Beethoven)</literal></command></quote>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable>selection only</replaceable></term>
<listitem>
<para>
<informaltable frame='all'>
<tgroup cols='2'>
<thead>
<row>
<entry align='left'>value</entry>
<entry align='left'>description</entry>
</row>
</thead>
<tbody>
<row>
<entry>&no-i18n-tag;<command>0</command></entry>
<entry>
Save all sections of the whole file.
</entry>
</row>
<row>
<entry>&no-i18n-tag;<command>1</command></entry>
<entry>
Save only the sections that are within the
current selection. If nothing is selected,
the whole file will be saved.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable>export location</replaceable></term>
<listitem>
<para>
Determines where the blocks should be saved.
<informaltable frame='all'>
<tgroup cols='2'>
<thead>
<row>
<entry align='left'>value</entry>
<entry align='left'>description</entry>
</row>
</thead>
<tbody>
<row>
<entry>&no-i18n-tag;<command>0</command></entry>
<entry>
Save to the same directory as the
K3B project file.
</entry>
</row>
<row>
<entry>&no-i18n-tag;<command>1</command></entry>
<entry>
Save into a sub directory of the directory
of the K3B project file, using the K3B
project file name as base and appending
<quote><command><literal>.dir</literal></command></quote>.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable>overwrite policy</replaceable></term>
<listitem>
<para>
Determines where the numbering should start.
<informaltable frame='all'>
<tgroup cols='2'>
<thead>
<row>
<entry align='left'>value</entry>
<entry align='left'>description</entry>
</row>
</thead>
<tbody>
<row>
<entry>&no-i18n-tag;<command>0</command></entry>
<entry>
Always start with index 1, with the risk
of overwriting existing files.
</entry>
</row>
<row>
<entry>&no-i18n-tag;<command>1</command></entry>
<entry>
Continue after the index of the highest
index that already exists, this avoids
overwriting existing files.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
</variablelist>
</sect1>
<!-- @PLUGIN@ fileinfo -->
<sect1 id="plugin_sect_fileinfo"><title id="plugin_title_fileinfo">&no-i18n-plugin_fileinfo; (File Info)</title>
<screenshot>
......@@ -6618,7 +6844,7 @@
<row>
<entry>&no-i18n-tag;<command>[%title]</command></entry>
<entry>
Will be replaced with the title the block, which is taken
Will be replaced with the title of the block, which is taken
from the descriptive text of the label at the
<emphasis>start</emphasis> of the block.
If that text is empty it will fall back to the title
......@@ -7722,6 +7948,18 @@
plugins/record/Record-PulseAudio.h
</para>
</listitem>
<listitem>
<para><emphasis role="bold">
Sebastian Trueg <email>trueg@k3b.org</email>,
Gustavo Pichorim Boiko <email>gustavo.boiko@kdemail.net</email>,
Michal Malek <email>michalm@jabster.pl</email>
</emphasis></para>
<para>
parts of plugins/export_k3b/K3BExportPlugin.cpp
</para>
</listitem>
</itemizedlist>
</para>
</sect1>
......
......@@ -105,6 +105,7 @@ ADD_SUBDIRECTORY( codec_mp3 ) # needs libmad + id3lib + "lame"
ADD_SUBDIRECTORY( codec_ogg ) # needs libogg and (libvorbis or libopus)
ADD_SUBDIRECTORY( codec_wav ) # needs libaudiofile
ADD_SUBDIRECTORY( debug )
ADD_SUBDIRECTORY( export_k3b )
ADD_SUBDIRECTORY( fileinfo )
ADD_SUBDIRECTORY( goto )
ADD_SUBDIRECTORY( lowpass )
......
#############################################################################
## Kwave - plugins/export_k3b/CMakeLists.txt
## -------------------
## begin : Thu Mar 23 2017
## copyright : (C) 2017 by Thomas Eschenbacher
## email : Thomas.Eschenbacher@gmx.de
#############################################################################
#
#############################################################################
# #
# Redistribution and use in source and binary forms, with or without #
# modification, are permitted provided that the following conditions #
# are met: #
# #
# 1. Redistributions of source code must retain the above copyright #
# notice, this list of conditions and the following disclaimer. #
# 2. Redistributions in binary form must reproduce the above copyright #
# notice, this list of conditions and the following disclaimer in the #
# documentation and/or other materials provided with the distribution. #
# #
# For details see the accompanying cmake/COPYING-CMAKE-SCRIPTS file. #
# #
#############################################################################
SET(plugin_export_k3b_LIB_SRCS
K3BExportDialog.cpp
K3BExportPlugin.cpp
K3BExportWidget.cpp
)
SET(plugin_export_k3b_LIB_UI
K3BExportWidgetBase.ui
)
SET(plugin_export_k3b_LIBS
KF5::Archive
)
KWAVE_PLUGIN(export_k3b)
#############################################################################
#############################################################################
/***************************************************************************
* K3BExportDialog.cpp - Extended KwaveFileDialog for exporting to K3B
* -------------------
* begin : Thu Apr 13 2017
* copyright : (C) 2017 by Thomas Eschenbacher
* email : Thomas.Eschenbacher@gmx.de
***************************************************************************/
/***************************************************************************
* *
* 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 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "config.h"
#include <QString>
#include <QUrl>
#include <KComboBox>
#include <KUrlComboBox>
#include "libkwave/String.h"
#include "K3BExportDialog.h"
#include "K3BExportWidget.h"
//***************************************************************************
Kwave::K3BExportDialog::K3BExportDialog(
const QString &startDir,
const QString &filter,
QWidget *parent,
const QUrl &last_url,
const QString &last_ext,
QString &pattern,
bool selection_only,
bool have_selection,
Kwave::K3BExportPlugin::export_location_t export_location,
Kwave::K3BExportPlugin::overwrite_policy_t overwrite_policy
)
:Kwave::FileDialog(startDir, Kwave::FileDialog::SaveFile, filter, parent,
last_url, last_ext),
m_widget(new(std::nothrow) Kwave::K3BExportWidget(
this, pattern, selection_only, have_selection,
export_location, overwrite_policy
))
{
Q_ASSERT(m_widget);
setCustomWidget(m_widget);
}
//***************************************************************************
Kwave::K3BExportDialog::~K3BExportDialog()
{
if (m_widget) delete m_widget;
m_widget = 0;
}
// //***************************************************************************
QString Kwave::K3BExportDialog::pattern() const
{
Q_ASSERT(m_widget);
return (m_widget) ? m_widget->pattern() : _("");
}
//***************************************************************************
bool Kwave::K3BExportDialog::selectionOnly() const
{
Q_ASSERT(m_widget);
return (m_widget) ? m_widget->selectionOnly() : false;
}
//***************************************************************************
Kwave::K3BExportPlugin::export_location_t
Kwave::K3BExportDialog::exportLocation() const
{
Q_ASSERT(m_widget);
return (m_widget) ? m_widget->exportLocation() :
Kwave::K3BExportPlugin::EXPORT_TO_SUB_DIR;
}
//***************************************************************************
Kwave::K3BExportPlugin::overwrite_policy_t
Kwave::K3BExportDialog::overwritePolicy() const
{
Q_ASSERT(m_widget);
return (m_widget) ? m_widget->overwritePolicy() :
Kwave::K3BExportPlugin::USE_NEW_FILE_NAMES;
}
//***************************************************************************
//***************************************************************************
/***************************************************************************
* K3BExportDialog.h - Extended KwaveFileDialog for exporting to K3B
* -------------------
* begin : Thu Apr 13 2017
* copyright : (C) 2017 by Thomas Eschenbacher
* email : Thomas.Eschenbacher@gmx.de
***************************************************************************/
/***************************************************************************
* *
* 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 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef K3B_EXPORT_DIALOG_H
#define K3B_EXPORT_DIALOG_H
#include "config.h"
#include <QObject>
#include <QString>
#include <QWidget>
#include "K3BExportPlugin.h"
#include "libgui/FileDialog.h"
class QUrl;
namespace Kwave
{
class K3BExportWidget;
class K3BExportDialog: public Kwave::FileDialog
{
Q_OBJECT
public:
/**
* Constructor.
* @see KFileFialog
* @param startDir the start directory
* @param filter string with a file type filter
* @param parent the parent widget
* @param last_url the last used URL
* @param last_ext the last used extension (preset only)
* @param pattern the pattern used for detecting title and artist
* @param selection_only if true, save only the selection
* @param have_selection if true, there is a selection
* @param export_location where to export files with tracks
* @param overwrite_policy overwrite existing files or use a new name
*/
K3BExportDialog(
const QString &startDir,
const QString &filter,
QWidget *parent,
const QUrl &last_url,
const QString &last_ext,
QString &pattern,
bool selection_only,
bool have_selection,
Kwave::K3BExportPlugin::export_location_t export_location,
Kwave::K3BExportPlugin::overwrite_policy_t overwrite_policy
);
/** Destructor */
virtual ~K3BExportDialog();
/** returns the title/artist detection pattern (as is, not escaped) */
QString pattern() const;
/** returns true if only the selection should be saved */
bool selectionOnly() const;
/** returns export location of the files of the tracks */
Kwave::K3BExportPlugin::export_location_t exportLocation() const;
/** returns the file overwrite policy */
Kwave::K3BExportPlugin::overwrite_policy_t overwritePolicy() const;
private:
/** the widget with extra settings for K3B export */
Kwave::K3BExportWidget *m_widget;
};
}
#endif /* K3B_EXPORT_DIALOG_H */
//***************************************************************************
//***************************************************************************
This diff is collapsed.
/*************************************************************************
* K3BExportPlugin.h - export of K3B project files
* -------------------
* begin : Thu Apr 13 2017
* copyright : (C) 2017 by Thomas Eschenbacher
* email : Thomas.Eschenbacher@gmx.de
***************************************************************************/
/***************************************************************************
* *
* 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 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef K3B_EXPORT_PLUGIN_H
#define K3B_EXPORT_PLUGIN_H
#include "config.h"
#include <QObject>
#include <QStringList>
#include <QUrl>
#include <QVariantList>
#include <QVector>
#include "libkwave/Plugin.h"
class QDomElement;
namespace Kwave
{
class K3BExportPlugin: public Kwave::Plugin
{
Q_OBJECT
public:
typedef enum {
EXPORT_TO_SAME_DIR = 0,
EXPORT_TO_SUB_DIR = 1
} export_location_t ;
typedef enum {
OVERWRITE_EXISTING_FILES = 0,
USE_NEW_FILE_NAMES = 1
} overwrite_policy_t;
/**
* Constructor
* @param parent reference to our plugin manager
* @param args argument list [unused]
*/
K3BExportPlugin(QObject *parent, const QVariantList &args);
/** Destructor */
virtual ~K3BExportPlugin();
/** @see Kwave::Plugin::load() */
virtual void load(QStringList &params);
/**
* Normally this method is used to set up all necessary parameters
* for executing the plugin. This plugin uses it for performing
* actions in the context of the GUI thread.
*
* @param params some parameters
* @return string list with parameters or null pointer
*/
virtual QStringList *setup(QStringList &params);
/**
* Saves the K3B project file, using the settings made in "setup()"
* @see Kwave::Plugin::start()
*/
virtual int start(QStringList &params);
/** returns a list of all known detection patterns */
static QStringList knownPatterns();