65
65
'attempting remote write outside base path')
66
66
return FileTransfer(host, filename, sgroup, type, db)
68
sgs = db.getStorageGroup(groupname=sgroup, hostname=host)
68
sgs = db.getStorageGroup(groupname=sgroup)
71
71
# prefer local storage always
277
if offset > self.size:
277
elif offset > self.size:
278
278
offset = self.size
279
279
elif whence == 1:
280
280
if offset + self.pos < 0:
281
281
offset = -self.pos
282
if offset + self.pos > self.size:
282
elif offset + self.pos > self.size:
283
283
offset = self.size - self.pos
284
284
elif whence == 2:
287
if offset < -self.size:
287
elif offset < -self.size:
288
288
offset = -self.size
290
offset = self.size+offset
290
curhigh,curlow = self.splitInt(self.pos)
291
offhigh,offlow = self.splitInt(offset)
292
curhigh,curlow = self.control.splitInt(self.pos)
293
offhigh,offlow = self.control.splitInt(offset)
293
295
res = self.control.backendCommand('QUERY_FILETRANSFER '+BACKEND_SEP\
294
296
.join([str(self.sockno),'SEEK',str(offhigh),
295
297
str(offlow),str(whence),str(curhigh),
297
299
).split(BACKEND_SEP)
298
self.pos = self.joinInt(int(res[0]),int(res[1]))
300
self.pos = self.control.joinInt(int(res[0]),int(res[1]))
300
302
class FileOps( MythBEBase ):
301
303
__doc__ = MythBEBase.__doc__+"""
302
Includes several canned file management tasks.
304
getRecording() - return a Program object for a recording
305
deleteRecording() - notify the backend to delete a recording
306
forgetRecording() - allow a recording to re-record
307
deleteFile() - notify the backend to delete a file
309
getHash() - return the hash of a file in a storage group
310
reschedule() - trigger a run of the scheduler
304
312
logmodule = 'Python Backend FileOps'
340
348
'QUERY_FILE_HASH',file, sgroup)))
342
350
def reschedule(self, recordid=-1):
343
"""FileOps.getHash() -> None"""
351
"""FileOps.reschedule() -> None"""
344
352
self.backendCommand('RESCHEDULE_RECORDINGS '+str(recordid))
854
862
elif (chanid is not None) and (starttime is not None):
855
863
self.__dict__['where'] = 'chanid=%s AND starttime=%s'
856
864
DBDataWrite.__init__(self, (chanid,starttime), db, None)
866
DBDataWrite.__init__(self, None, db, None)
858
868
def create(self, data=None):
859
869
"""Job.create(data=None) -> Job object"""
1057
1067
c = self.db.cursor(self.log)
1058
1068
fields = ' AND '.join(['%s=%%s' % f for f in \
1059
1069
('title','subtitle','season','episode')])
1060
count = c.execute("""SELECT inetref FROM videometadata WHERE %s""" %
1070
count = c.execute("""SELECT intid FROM videometadata WHERE %s""" %
1061
1071
fields, (self.title, self.subtitle, self.season, self.episode))
1063
1073
id = c.fetchone()[0]