2
* \file playlistcreator.h
9
* Copyright (C) 2009 Urs Fleisch
11
* This file is part of Kid3.
13
* Kid3 is free software; you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License as published by
15
* the Free Software Foundation; either version 2 of the License, or
16
* (at your option) any later version.
18
* Kid3 is distributed in the hope that it will be useful,
19
* but WITHOUT ANY WARRANTY; without even the implied warranty of
20
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
* GNU General Public License for more details.
23
* You should have received a copy of the GNU General Public License
24
* along with this program. If not, see <http://www.gnu.org/licenses/>.
27
#ifndef PLAYLISTCREATOR_H
28
#define PLAYLISTCREATOR_H
36
class ImportTrackData;
41
* Creates playlists from added items according to a playlist configuration.
43
class PlaylistCreator {
46
* An item from the file list which can be added to a playlist.
47
* The item will only be added to the playlist if add() is called.
54
* @param item item in file list
55
* @param ctr associated playlist creator
57
Item(FileListItem* item, PlaylistCreator& ctr);
65
* Check if item is a directory.
66
* @return true if item is directory.
68
bool isDir() const { return m_dirInfo != 0; }
71
* Check if item is a tagged file.
72
* @return true if item is file.
74
bool isFile() const { return m_taggedFile != 0; }
77
* Get the directory of the item.
78
* @return directory path with trailing separator.
80
const QString& getDirName() { return m_dirName; }
83
* Add item to playlist.
84
* This operation will write a playlist if the configuration is set to write
85
* a playlist in every directory and a new directory is entered.
93
* Format string using tags and properties of item.
95
* @param format format string
97
* @return string with percent codes replaced.
99
QString formatString(const QString& format);
101
PlaylistCreator& m_ctr;
102
FileListItem* m_item;
103
const DirInfo* m_dirInfo;
104
TaggedFile* m_taggedFile;
105
ImportTrackData* m_trackData;
112
* @param topLevelDir top-level directory of playlist
113
* @param cfg playlist configuration
115
PlaylistCreator(const QString& topLevelDir, const PlaylistConfig& cfg);
118
* Write playlist containing added Entry elements.
120
* @return true if ok.
128
unsigned long duration;
133
const PlaylistConfig& m_cfg;
134
QString m_playlistDirName;
135
QString m_playlistFileName;
136
QMap<QString, Entry> m_entries;
139
#endif // PLAYLISTCREATOR_H