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
63
64
65
#ifndef FSTRACKER_H
#define FSTRACKER_H
#include "onlinetracker.h"
class Library;
class FsTracker : public OnlineTracker
{
public:
class Config {
public:
Config(QString configFilePath);
QString path;
bool createDirectory;
};
class Credentials : public OnlineCredentials {
public:
Credentials() {}
const QString identifierKey() const { return "fs-sync-1";}
protected:
bool verifyCredentials() { return true; }
};
class Entry : public OnlineTracker::Entry {
public:
Entry(TvShow* remoteShow) : remoteShow(remoteShow) {}
virtual QDateTime lastUpdate() const { return remoteShow->getLastLocalUpdate(); }
virtual int remoteId() const { return remoteShow->getRemoteId("fs-sync-1"); }
virtual int watchedEpisodes() const { return remoteShow->episodeList().numberOfWatchedEpisodes(); }
virtual int rewatchMarker() const { return remoteShow->getRewatchMarker(); }
virtual int rewatchCount() const { return remoteShow->getRewatchCount(); }
virtual int totalEpisodes() const { return remoteShow->getTotalEpisodes(); }
virtual TvShow::WatchStatus getStatusWouldSendIfSynced(TvShow::WatchStatus showStatus) const { return showStatus; }
virtual TvShow::WatchStatus watchStatus() const { return remoteShow->getStatus(); }
virtual bool supportsRewatchMarker() const { return true; }
private:
TvShow* remoteShow;
};
class EntryList : public OnlineTracker::EntryList {
public:
EntryList(Library* library) : remoteLib(library) {}
virtual const Entry* get(const QString, const TvShow *show) const;
private:
Library* remoteLib;
};
FsTracker(const FsTracker::Config config, const OnlineCredentials &credentials, OnlineCredentials::TimeLock &lock, QObject *parent = NULL);
virtual bool requiresRemoteId() const { return false; }
virtual EntryList* fetchRemote();
virtual const QString identifierKey() const { return "fs-sync-1"; }
protected:
UpdateResult updateinOnlineTrackerOrAdd(const TvShow *show, const QString &actionType) const;
private:
const FsTracker::Config config;
Library* remoteLib;
};
#endif // FSTRACKER_H