Sayonara Player
StreamRecorder.h
1 /* StreamRecorder.h */
2 
3 /* Copyright (C) 2011-2016 Lucio Carreras
4  *
5  * This file is part of sayonara player
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 
22 
23 #ifndef STREAMRECORDER_H
24 #define STREAMRECORDER_H
25 
26 #include "Components/PlayManager/PlayManager.h"
27 #include "Helper/Settings/SayonaraClass.h"
28 #include "Helper/MetaData/MetaDataList.h"
29 
30 
31 #include <QDateTime>
32 
33 class StreamRecorder : public QObject, protected SayonaraClass
34 {
35 
36 private:
37 
38  PlayManager* _play_manager;
39  QString _sr_recording_dst; // recording destination
40  QString _session_path; // where to store the mp3 files of the session
41  QString _session_playlist_name; // playlist name
42  MetaDataList _session_collector; // gather all tracks of a session
43  MetaData _md; // current track
44 
45  bool _recording; // is in a session currently
46  int _idx; // index of track (used for filename)
47 
48  // set metadata, add to session collector
49  bool save();
50 
51  // saves session collector into playlist, creates new session,
52  void new_session();
53 
54  // check and create session path
55  QString check_session_path(const QString& sr_path);
56 
57 
58 public:
59  StreamRecorder(QObject *parent=nullptr);
60  virtual ~StreamRecorder();
61 
62  // change recording destination, create session path
63  // returns destination file
64  QString change_track(const MetaData& md);
65 
66  // start or end a session
67  void record(bool b);
68 
69  // destination path
70  QString get_dst_file() const ;
71 
72  // is in a session currently
73  bool is_recording() const;
74 
75 private slots:
76  void playstate_changed(PlayManager::PlayState state);
77 
78 
79 };
80 
81 #endif // STREAMRECORDER_H
The SayonaraClass class provides access to Settings and notifications.
Definition: SayonaraClass.h:31
Definition: MetaData.h:49
PlayState
Current Playing state.
Definition: PlayManager.h:79
Definition: StreamRecorder.h:33
Definition: MetaDataList.h:46
Global handler for current playback state (Singleton)
Definition: PlayManager.h:67