root/src/episode.h

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef EPISODE_H
#define EPISODE_H

#include <QObject>
#include <QString>
#include <QRegExp>
#include <QStringList>
#include <QDateTime>

#include "nwutils.h"
#include "videofile.h"

class Episode : public QObject
{
    Q_OBJECT
    friend class EpisodeList;
public:
    explicit Episode(nw::Describer *jw, QObject *parent = 0);
    explicit Episode(QString path, QObject *parent = 0);
    explicit Episode(const VideoFile* path, QObject* parent = 0);
    virtual ~Episode();
    
    void addPath(QString path);
    void addPath(const VideoFile* movieFile);

    void describe(nw::Describer *jw);
    void writeDetailed(nw::JsonWriter& jw, const QStringList& releaseGroupPreference);

    const VideoFile* getMovieFileForPath(QString path);
    const VideoFile* bestFile(const QStringList& releaseGroupPreference) const;

    QString getShowName() const;
    bool getWatched() const;
    void setWatched(bool value);

    float getEpisodeNumber() const;
    QDateTime getWatchedDate() const;
    QStringList releaseGroups() const;

    bool isSpecial() const;
    QList<const VideoFile*> missingFiles() const;

    bool removeFileFromList(QString filepath);

    QList<const VideoFile*> getFiles() const;

signals:
    void beforeWatchedChanged(bool newValue, bool oldValue);
    void watchedChanged(bool oldValue, bool newValue); // TODO change to old, new
    
public slots:
    
private:
    QList<const VideoFile*> files;
    QString showName;
    QDateTime watchedDate;
    float episodeNumber;

    void pushFile(const VideoFile*);
};

#endif // EPISODE_H