root/src/videofile.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
#ifndef MOVIEFILEA_H
#define MOVIEFILEA_H

#include <QString>
#include "nwutils.h"

/// This parses useful info out of a VideoFileName
/// I made all data public for easy access, so please only create const instances.
/// Side-effects:
/// It might check the parent directory name & symlinks
class VideoFile {
public:
    VideoFile(const QString originalPath, bool resolveLinks = true);

    static bool hasVideoExtension(QString filename);

    void writeForApi(nw::Writer& de) const;
    bool isSpecial() const;
    static bool isSpecial(QString episodeNumberString);
    float numericEpisodeNumber() const;

    QString xbmcEpisodeNumber() const;
    QString xbmcEpisodeName() const;
    QString fileExtension() const;
    bool exists() const;

    // keep public and only create const instances of this
    QString path;
    QString releaseGroup;
    QString episodeName;
    QStringList techTags;
    QString showName;
    QString seasonName;
    QString episodeNumber;
    QString hashId;

    static const float UNKNOWN;
    static const float SPECIAL;
    static const float INVALID;
    /// Generates a list of alternative interpretations for the ShowName
    /// shall be used for online-db searches
    std::map<QString, QString> alternativeTitles() const;
};

#endif // MOVIEFILE_H