mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-18 20:40:43 +01:00
Added format string to customize file names
This commit is contained in:
parent
a5021e656b
commit
a3f61bd612
@ -187,8 +187,7 @@ void RipCD::toThreadClickedRipButton() {
|
||||
lsn_t i_cursor;
|
||||
int16_t *p_readbuf = (int16_t *) calloc(CDIO_CD_FRAMESIZE_RAW, 1);
|
||||
|
||||
QString filename = source_directory + "track"
|
||||
+ QString("0%1").arg(i).right(2) + ".wav";
|
||||
QString filename = source_directory + ParseFileFormatString(ui_->format_filename->text(),i);
|
||||
FILE *fp = fopen(filename.toUtf8().constData(), "w");
|
||||
write_WAV_header(fp,
|
||||
(i_last_lsn - i_first_lsn + 1) * CDIO_CD_FRAMESIZE_RAW);
|
||||
@ -237,6 +236,17 @@ QString RipCD::GetOutputFileName(const QString& input,
|
||||
}
|
||||
}
|
||||
|
||||
QString RipCD::ParseFileFormatString(const QString& file_format, int trackNo) const {
|
||||
QString to_return = file_format;
|
||||
to_return.replace(QString("%artist%"),ui_->artistLineEdit->text());
|
||||
to_return.replace(QString("%album%"),ui_->albumLineEdit->text());
|
||||
to_return.replace(QString("%genre%"),ui_->genreLineEdit->text());
|
||||
to_return.replace(QString("%year%"),ui_->yearLineEdit->text());
|
||||
to_return.replace(QString("%tracknum%"),QString::number(trackNo));
|
||||
to_return.replace(QString("%track%"),track_names_.value(trackNo - 1)->text());
|
||||
return to_return;
|
||||
}
|
||||
|
||||
void RipCD::UpdateProgress() {
|
||||
int progress = (finished_success_ + finished_failed_) * 100;
|
||||
QMap<QString, float> current_jobs = transcoder_->GetProgress();
|
||||
|
@ -61,6 +61,7 @@ class RipCD: public QDialog {
|
||||
QString TrimPath(const QString& path) const;
|
||||
QString GetOutputFileName(const QString& input,
|
||||
const TranscoderPreset& preset) const;
|
||||
QString ParseFileFormatString(const QString& file_format, int trackNo) const;
|
||||
|
||||
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>601</width>
|
||||
<height>500</height>
|
||||
<height>575</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -20,7 +20,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>240</x>
|
||||
<y>450</y>
|
||||
<y>530</y>
|
||||
<width>341</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
@ -159,7 +159,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>410</y>
|
||||
<y>480</y>
|
||||
<width>98</width>
|
||||
<height>27</height>
|
||||
</rect>
|
||||
@ -172,7 +172,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>120</x>
|
||||
<y>410</y>
|
||||
<y>480</y>
|
||||
<width>455</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
@ -182,23 +182,23 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>300</y>
|
||||
<y>320</y>
|
||||
<width>571</width>
|
||||
<height>96</height>
|
||||
<height>131</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Output options</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Audio format</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="format">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
@ -208,21 +208,21 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="options">
|
||||
<property name="text">
|
||||
<string>Options...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Destination</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="destination">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
@ -240,13 +240,27 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<item row="2" column="2">
|
||||
<widget class="QPushButton" name="select">
|
||||
<property name="text">
|
||||
<string>Select...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>File Format</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="2">
|
||||
<widget class="QLineEdit" name="format_filename">
|
||||
<property name="text">
|
||||
<string>%tracknum% - %artist% - %track%</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
Loading…
Reference in New Issue
Block a user