MythTV
master
libs
libmythbase
remotefile.h
Go to the documentation of this file.
1
#ifndef REMOTEFILE_H_
2
#define REMOTEFILE_H_
3
4
#include <sys/stat.h>
5
6
#include <QDateTime>
7
#include <QStringList>
8
#include <QMutex>
9
10
#include "
mythbaseexp.h
"
11
#include "
mythtimer.h
"
12
13
class
MythSocket
;
14
class
QFile;
15
class
ThreadedFileWriter
;
16
17
class
MBASE_PUBLIC
RemoteFile
18
{
19
public
:
20
RemoteFile
(
const
QString &url =
""
,
21
bool
write
=
false
,
22
bool
usereadahead =
true
,
23
int
timeout_ms = 2000
/*RingBuffer::kDefaultOpenTimeout*/
,
24
const
QStringList *possibleAuxiliaryFiles =
nullptr
);
25
~
RemoteFile
();
26
27
bool
ReOpen(QString newFilename);
28
29
long
long
Seek(
long
long
pos,
int
whence,
long
long
curpos = -1);
30
31
static
bool
DeleteFile(
const
QString &url);
32
static
bool
Exists(
const
QString &url,
struct
stat *fileinfo);
33
static
bool
Exists(
const
QString &url);
34
static
QString GetFileHash(
const
QString &url);
35
static
QDateTime LastModified(
const
QString &url);
36
QDateTime LastModified(
void
)
const
;
37
static
QString FindFile(
const
QString &filename,
const
QString &host,
38
const
QString &storageGroup,
bool
useRegex =
false
,
39
bool
allowFallback =
false
);
40
41
static
QStringList FindFileList(
const
QString &filename,
const
QString &host,
42
const
QString &storageGroup,
bool
useRegex =
false
,
43
bool
allowFallback =
false
);
44
static
bool
CopyFile
(
const
QString &src,
const
QString &
dest
,
45
bool
overwrite =
false
,
bool
verify =
false
);
46
static
bool
MoveFile(
const
QString &src,
const
QString &
dest
,
47
bool
overwrite =
false
);
48
49
int
Write(
const
void
*data,
int
size);
50
int
Read(
void
*data,
int
size);
51
void
Reset(
void
);
52
bool
SetBlocking(
bool
block =
true
);
53
54
bool
SaveAs(QByteArray &data);
55
56
void
SetTimeout(
bool
fast);
57
58
bool
isOpen(
void
)
const
;
59
static
bool
isLocal(
const
QString &path);
60
bool
isLocal(
void
)
const
;
61
long
long
GetFileSize
(
void
)
const
;
62
long
long
GetRealFileSize(
void
);
63
64
QStringList
GetAuxiliaryFiles
(
void
)
const
65
{
return
auxfiles; }
66
67
private
:
68
bool
Open(
void
);
69
bool
OpenInternal(
void
);
70
void
Close(
bool
haslock =
false
);
71
bool
CheckConnection(
bool
repos =
true
);
72
bool
IsConnected(
void
);
73
bool
Resume(
bool
repos =
true
);
74
long
long
SeekInternal(
long
long
pos,
int
whence,
long
long
curpos = -1);
75
76
MythSocket
*openSocket(
bool
control);
77
78
QString
path
;
79
bool
usereadahead
;
80
int
timeout_ms
;
81
long
long
filesize
;
82
bool
timeoutisfast
;
83
long
long
readposition
;
84
long
long
lastposition
;
85
bool
canresume
;
86
int
recordernum
;
87
88
mutable
QMutex
lock
;
89
MythSocket
*
controlSock
;
90
MythSocket
*
sock
;
91
QString
query
;
92
93
bool
writemode
;
94
bool
completed
;
95
MythTimer
lastSizeCheck
;
96
97
QStringList
possibleauxfiles
;
98
QStringList
auxfiles
;
99
int
localFile
;
100
ThreadedFileWriter
*
fileWriter
;
101
};
102
103
#endif
RemoteFile::filesize
long long filesize
Definition:
remotefile.h:81
mythburn.write
def write(text, progress=True)
Definition:
mythburn.py:279
RemoteFile::usereadahead
bool usereadahead
Definition:
remotefile.h:79
MythTimer
A QElapsedTimer based timer to replace use of QTime as a timer.
Definition:
mythtimer.h:13
RemoteFile::readposition
long long readposition
Definition:
remotefile.h:83
RemoteFile::timeoutisfast
bool timeoutisfast
Definition:
remotefile.h:82
RemoteFile::completed
bool completed
Definition:
remotefile.h:94
RemoteFile::recordernum
int recordernum
Definition:
remotefile.h:86
mythbaseexp.h
mythtimer.h
RemoteFile::lock
QMutex lock
Definition:
remotefile.h:88
RemoteFile::localFile
int localFile
Definition:
remotefile.h:99
RemoteFile::writemode
bool writemode
Definition:
remotefile.h:93
MBASE_PUBLIC
#define MBASE_PUBLIC
Definition:
mythbaseexp.h:15
RemoteFile::lastposition
long long lastposition
Definition:
remotefile.h:84
CopyFile
static int CopyFile(const MythUtilCommandLineParser &cmdline)
Definition:
fileutils.cpp:10
RemoteFile::auxfiles
QStringList auxfiles
Definition:
remotefile.h:98
RemoteFile::controlSock
MythSocket * controlSock
Definition:
remotefile.h:89
RemoteFile::canresume
bool canresume
Definition:
remotefile.h:85
RemoteFile::lastSizeCheck
MythTimer lastSizeCheck
Definition:
remotefile.h:95
RemoteFile::sock
MythSocket * sock
Definition:
remotefile.h:90
RemoteFile
Definition:
remotefile.h:17
RemoteFile::fileWriter
ThreadedFileWriter * fileWriter
Definition:
remotefile.h:100
RemoteFile::query
QString query
Definition:
remotefile.h:91
RemoteFile::path
QString path
Definition:
remotefile.h:78
ThreadedFileWriter
This class supports the writing of recordings to disk.
Definition:
threadedfilewriter.h:41
MythSocket
Class for communcating between myth backends and frontends.
Definition:
mythsocket.h:26
RemoteFile::GetAuxiliaryFiles
QStringList GetAuxiliaryFiles(void) const
Definition:
remotefile.h:64
RemoteFile::possibleauxfiles
QStringList possibleauxfiles
Definition:
remotefile.h:97
RemoteFile::timeout_ms
int timeout_ms
Definition:
remotefile.h:80
GetFileSize
static qint64 GetFileSize(ProgramInfo *program_info)
Definition:
mythtv/programs/mythcommflag/main.cpp:610
hardwareprofile.getLink.dest
dest
Definition:
getLink.py:39
Generated on Sat Oct 5 2019 05:30:18 for MythTV by
1.8.15