Skip to content

Commit

Permalink
Recurrent records fix
Browse files Browse the repository at this point in the history
(recurrence mask will be applied to the start date)
  • Loading branch information
Pavion committed Jan 21, 2016
1 parent 39c5596 commit fe43cf7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -49,4 +49,5 @@ coverage.xml
# Sphinx documentation
docs/_build/channels.m3u
/nbproject/
!/cherrypy/lib/
!/cherrypy/lib/
/live.m3u
8 changes: 4 additions & 4 deletions tvstreamrecord.py
Expand Up @@ -921,13 +921,13 @@ def __init__(self, row):
else:
self.ext = row[7]
if self.mask > 0:
w = self.bis.isoweekday() if self.bis.isoweekday()<7 else 0
if not (self.bis>=datetime.now() and getWeekdays(self.mask)[w]):
w = self.von.isoweekday() if self.von.isoweekday()<7 else 0
if not (self.von>=datetime.now() and getWeekdays(self.mask)[w]):
delta = timedelta(days=1)
while not (self.bis>=datetime.now() and getWeekdays(self.mask)[w]):
while not (self.von>=datetime.now() and getWeekdays(self.mask)[w]):
self.von = self.von + delta
self.bis = self.bis + delta
w = self.bis.isoweekday() if self.bis.isoweekday()<7 else 0
w = self.von.isoweekday() if self.von.isoweekday()<7 else 0
print ("Recurrent record '%s' moved to %s" % (self.name, self.von))
sqlRun("UPDATE records SET rvon='%s', rbis='%s' WHERE rowid=%d" % (datetime.strftime(self.von,"%Y-%m-%d %H:%M:%S"), datetime.strftime(self.bis,"%Y-%m-%d %H:%M:%S"), self.id ) )

Expand Down

1 comment on commit fe43cf7

@Pavion
Copy link
Owner Author

@Pavion Pavion commented on fe43cf7 Jan 21, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just why have I done it otherwise first?! No answer...

Please sign in to comment.