Rob Shortt wrote:
This is SO FUNNY! I am doing the exact same thing right this instant with my search/view scheduled recordings/view favorites pops.
-Rob
[EMAIL PROTECTED] wrote:
Update of /cvsroot/freevo/freevo/src/tv In directory sc8-pr-cvs1:/tmp/cvs-serv31681
Modified Files:
record_schedule.py record_video.py tv.py Log Message:
Changed the "Schedule Editor" to show up in the TV Submenu, along with "Guide" and
"Recorded Shows" which makes a lot more sense then where it was before, which was
also exceptionally well hidden.
To do this properly, I also had to move record_schedule into a class, subclassing
from Item, and so problems may and possibly will arise. I've tested it a little,
but please bang on this, because while it's a relatively minor change, it does
get things working inside the properly model, at least for a start.
Bug reports are expected and welcome :)
Index: record_schedule.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/tv/record_schedule.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** record_schedule.py 20 Apr 2003 12:43:33 -0000 1.3
--- record_schedule.py 2 Jun 2003 21:29:21 -0000 1.4
***************
*** 16,19 ****
--- 16,31 ----
# -----------------------------------------------------------------------
# $Log$
+ # Revision 1.4 2003/06/02 21:29:21 outlyer
+ # Changed the "Schedule Editor" to show up in the TV Submenu, along with "Guide" and
+ # "Recorded Shows" which makes a lot more sense then where it was before, which was
+ # also exceptionally well hidden.
+ #
+ # To do this properly, I also had to move record_schedule into a class, subclassing
+ # from Item, and so problems may and possibly will arise. I've tested it a little,
+ # but please bang on this, because while it's a relatively minor change, it does
+ # get things working inside the properly model, at least for a start.
+ #
+ # Bug reports are expected and welcome :)
+ #
# Revision 1.3 2003/04/20 12:43:33 dischi
# make the rc events global in rc.py to avoid get_singleton. There is now
***************
*** 87,272 ****
FALSE = 0
menuwidget = menu.get_singleton()
killflag = 0
! def main_menu():
! ! recmenu = generate_main()
! ! menuwidget.pushmenu(recmenu)
! menuwidget.refresh()
! def generate_main():
! if DEBUG:
! print 'Recording Schedule: generate_main'
- items = []
- - items += [menu.MenuItem('View Recording Schedule',
- view_schedule,0)]
- - items += [menu.MenuItem('Delete Scheduled Item',
- view_schedule,1)]
- - recmenu = menu.Menu('RECORDING SCHEDULE', items,
- reload_func=generate_main)
- - rc.app(None)
- - return recmenu
- - - def view_schedule(arg=None, menuw=None):
- '''Set up the view recording menu or the delete scheduled
- item menu'''
- - items = []
- line = '0'
- itemcount = 0
- global killflag
- - fd = open(record_daemon.SCHEDULE,'r')
- - #delete old scheduled items from the file since we wont need them
- #this could be done more efficiently from record_daemon
- if arg == 0:
- newstringlist = fd.readline()
- oldchecker = fd.readlines()
- fd.close()
fd = open(record_daemon.SCHEDULE,'w')
! ! for st in oldchecker:
! #check if item is recording
! timecomp= st[st.find('-'): st.rfind(',')].split(',')
! timecomp[0] = timecomp[0].replace('-','').replace(':','').replace(' ','')
! length = string.atoi(timecomp[1])
! currenttime = string.atoi(time.strftime('%m%d%H%M%S', time.localtime()))
! recording = currenttime < addtime(string.atoi(timecomp[0]),length)
! ! #delete old items that are not recording
! if st.find('#') == -1 or (recording and killflag != 1):
! newstringlist += st
! killflag = 0
fd.write(newstringlist)
fd.close()
! fd = open(record_daemon.SCHEDULE,'r')
! ! fd.readline()
! ! while line != '':
! oldline = line
! line = fd.readline()
! if line.find('#') != -1:
! recordingflag = 1
! else:
! recordingflag = 0
! ! #get only the title, the record time and the channel
! line = line[ line.rfind('/') +1: line.find('.avi')]
! #line = line[ line.rfind('/') +1: line.find('.mpg')]
! line = line.replace('_',' ')
! ! #skip multiple occurences of the same thing
! if oldline != line and line != '':
! itemline = line
! if recordingflag:
! itemline += ' (currently recording)'
! if arg == 0: ! items += [ menu.MenuItem(itemline)]
! elif arg == 1:
! items += [ menu.MenuItem(itemline, delete_selection,itemline)]
! fd.close()
! ! if arg == 0:
! submenu = menu.Menu('VIEW RECORDING SCHEDULE', items,
! reload_func=view_schedule)
! else:
! submenu = menu.Menu('DELETE SCHEDULED ITEM', items,
! reload_func=view_schedule)
! menuwidget.pushmenu(submenu)
! if killflag and arg == 1:
! AlertBox(text='All Currently Recording Items Have Been Killed!').show()
! killflag = 0
! ! ! ! ! def delete_selection(arg=None, menuw=None):
! ! global killflag
! #stop all recordings if needed
! if arg.find(' (currently recording)') != -1:
! os.system('pkill mencoder')
! killflag = 1 #blood has been spilt today
! ! arg = arg.replace(' (currently recording)','').replace(' ','_')
! fd = open(record_daemon.SCHEDULE,'r')
! ! stringlist = fd.readlines()
! fd.close()
! ! fd = open(record_daemon.SCHEDULE,'w')
! newstringlist = ''
! ! for item in stringlist:
! if item.find(arg) == -1:
! print item
! print arg
! newstringlist += item
! fd.write(newstringlist)
! fd.close()
! menuwidget.back_one_menu()
! view_schedule(1)
! ! ! ! ! ! ! def addtime(rtime,length):
! '''This function will add two time integers together
! where one is in localtime and the other is a length in
! seconds,
! example:
! rtime = 0305235900
! length = 3650
! addtime(rtime,length)
! will return 0306005950'''
! ! lhour = (length / 3600)*10000
! lminute = ((length % 3600) / 60)*100
! lsecond = length % 60
- rmonth = (rtime / 100000000)*100000000
- rday = (rtime % 100000000 / 1000000)*1000000
- rhour =( rtime % 1000000 / 10000)*10000
- rminute = (rtime % 10000 / 100)*100
- rsecond = rtime % 100
- months = 0
- days = 0
- hours = 0
- minutes = 0
- seconds = 0
! if lsecond + rsecond >= 60:
! minutes += 100
! seconds = (lsecond + rsecond) % 60
! ! minutes += lminute + rminute
! if minutes >= 6000:
! hours += 10000
! minutes = minutes % 6000
! ! hours += lhour + rhour
! if hours >= 240000:
! days += 1000000
! hours = hours % 240000
! ! days += rday
! ! return rmonth + days + hours + minutes + seconds
! --- 99,284 ----
FALSE = 0
+ from item import Item
+ menuwidget = menu.get_singleton()
killflag = 0
! class ScheduleEdit(Item):
+ def __init__ (self):
+ Item.__init__(self)
+ self.type = 'tv'
+ ! def main_menu(self):
! recmenu = self.generate_main()
! ! menuwidget.pushmenu(recmenu)
! menuwidget.refresh()
! ! ! def generate_main(self):
! items = []
! items += [menu.MenuItem('View Recording Schedule',
! self.view_schedule,0)]
! items += [menu.MenuItem('Delete Scheduled Item',
! self.view_schedule,1)]
! recmenu = menu.Menu('RECORDING SCHEDULE', items,
! reload_func=self.generate_main, item_types = 'tv')
! rc.app(None)
! return recmenu
! ! ! def view_schedule(self,arg=None, menuw=None):
! '''Set up the view recording menu or the delete scheduled
! item menu'''
! ! items = []
! line = '0'
! itemcount = 0
! global killflag
! ! fd = open(record_daemon.SCHEDULE,'r')
! ! #delete old scheduled items from the file since we wont need them
! #this could be done more efficiently from record_daemon
! if arg == 0:
! newstringlist = fd.readline()
! oldchecker = fd.readlines()
! fd.close()
! fd = open(record_daemon.SCHEDULE,'w')
! ! for st in oldchecker:
! #check if item is recording
! timecomp= st[st.find('-'): st.rfind(',')].split(',')
! timecomp[0] = timecomp[0].replace('-','').replace(':','').replace(' ','')
! length = string.atoi(timecomp[1])
! currenttime = string.atoi(time.strftime('%m%d%H%M%S', time.localtime()))
! recording = currenttime < self.addtime(string.atoi(timecomp[0]),length)
! ! #delete old items that are not recording
! if st.find('#') == -1 or (recording and killflag != 1):
! newstringlist += st
! killflag = 0
! fd.write(newstringlist)
! fd.close()
! fd = open(record_daemon.SCHEDULE,'r')
! ! fd.readline()
! ! while line != '':
! oldline = line
! line = fd.readline()
! if line.find('#') != -1:
! recordingflag = 1
! else:
! recordingflag = 0
! ! #get only the title, the record time and the channel
! line = line[ line.rfind('/') +1: line.find('.avi')]
! #line = line[ line.rfind('/') +1: line.find('.mpg')]
! line = line.replace('_',' ')
! ! #skip multiple occurences of the same thing
! if oldline != line and line != '':
! itemline = line
! if recordingflag:
! itemline += ' (currently recording)'
! if arg == 0: ! items += [ menu.MenuItem(itemline)]
! elif arg == 1:
! items += [ menu.MenuItem(itemline, self.delete_selection,itemline)]
! fd.close()
! ! if arg == 0:
! submenu = menu.Menu('VIEW RECORDING SCHEDULE', items,
! reload_func=self.view_schedule, item_types='tv')
! else:
! submenu = menu.Menu('DELETE SCHEDULED ITEM', items,
! reload_func=self.view_schedule, item_types='tv')
! menuwidget.pushmenu(submenu)
! if killflag and arg == 1:
! AlertBox(text='All Currently Recording Items Have Been Killed!').show()
! killflag = 0
! ! ! ! ! def delete_selection(self,arg=None, menuw=None):
! ! global killflag
! #stop all recordings if needed
! if arg.find(' (currently recording)') != -1:
! os.system('pkill mencoder')
! killflag = 1 #blood has been spilt today
! ! arg = arg.replace(' (currently recording)','').replace(' ','_')
! fd = open(record_daemon.SCHEDULE,'r')
! ! stringlist = fd.readlines()
! fd.close()
fd = open(record_daemon.SCHEDULE,'w')
! newstringlist = ''
! ! for item in stringlist:
! if item.find(arg) == -1:
! print item
! print arg
! newstringlist += item
fd.write(newstringlist)
fd.close()
! menuwidget.back_one_menu()
! self.view_schedule(1)
! ! ! ! def addtime(self,rtime,length):
! '''This function will add two time integers together
! where one is in localtime and the other is a length in
! seconds,
! example:
! rtime = 0305235900
! length = 3650
! addtime(rtime,length)
! will return 0306005950'''
! ! lhour = (length / 3600)*10000
! lminute = ((length % 3600) / 60)*100
! lsecond = length % 60
! ! rmonth = (rtime / 100000000)*100000000
! rday = (rtime % 100000000 / 1000000)*1000000
! rhour =( rtime % 1000000 / 10000)*10000
! rminute = (rtime % 10000 / 100)*100
! rsecond = rtime % 100
! ! months = 0
! days = 0
! hours = 0
! minutes = 0
! seconds = 0
! ! if lsecond + rsecond >= 60:
! minutes += 100
! seconds = (lsecond + rsecond) % 60
! ! minutes += lminute + rminute
! if minutes >= 6000:
! hours += 10000
! minutes = minutes % 6000
! ! hours += lhour + rhour
! if hours >= 240000:
! days += 1000000
! hours = hours % 240000
+ days += rday
+ + return rmonth + days + hours + minutes + seconds
+ + Index: record_video.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/tv/record_video.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** record_video.py 31 May 2003 20:53:03 -0000 1.16
--- record_video.py 2 Jun 2003 21:29:22 -0000 1.17
***************
*** 10,13 ****
--- 10,25 ----
# -----------------------------------------------------------------------
# $Log$
+ # Revision 1.17 2003/06/02 21:29:22 outlyer
+ # Changed the "Schedule Editor" to show up in the TV Submenu, along with "Guide" and
+ # "Recorded Shows" which makes a lot more sense then where it was before, which was
+ # also exceptionally well hidden.
+ #
+ # To do this properly, I also had to move record_schedule into a class, subclassing
+ # from Item, and so problems may and possibly will arise. I've tested it a little,
+ # but please bang on this, because while it's a relatively minor change, it does
+ # get things working inside the properly model, at least for a start.
+ #
+ # Bug reports are expected and welcome :)
+ #
# Revision 1.16 2003/05/31 20:53:03 outlyer
# Fix what I hope is the last event-related crash. Choosing shows to record
***************
*** 115,119 ****
# Schedule editor
! import record_schedule
import event as em
--- 127,131 ----
# Schedule editor
! #import record_schedule
import event as em
***************
*** 341,347 ****
print 'using record_video event handler'
# XXX Hack, make it better!!!!
! if event == em.MENU_CHANGE_STYLE:
! record_schedule.main_menu()
! elif event == em.MENU_BACK_ONE_MENU or event == em.MENU_GOTO_MAINMENU:
menu.MenuWidget.eventhandler( menuwidget, event )
rc.app(None) #give control back to the main program
--- 353,359 ----
print 'using record_video event handler'
# XXX Hack, make it better!!!!
! #if event == em.MENU_CHANGE_STYLE:
! # record_schedule.main_menu()
! if event == em.MENU_BACK_ONE_MENU or event == em.MENU_GOTO_MAINMENU:
menu.MenuWidget.eventhandler( menuwidget, event )
rc.app(None) #give control back to the main program
Index: tv.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/tv/tv.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** tv.py 24 Apr 2003 19:56:42 -0000 1.12
--- tv.py 2 Jun 2003 21:29:22 -0000 1.13
***************
*** 10,13 ****
--- 10,25 ----
# -----------------------------------------------------------------------
# $Log$
+ # Revision 1.13 2003/06/02 21:29:22 outlyer
+ # Changed the "Schedule Editor" to show up in the TV Submenu, along with "Guide" and
+ # "Recorded Shows" which makes a lot more sense then where it was before, which was
+ # also exceptionally well hidden.
+ #
+ # To do this properly, I also had to move record_schedule into a class, subclassing
+ # from Item, and so problems may and possibly will arise. I've tested it a little,
+ # but please bang on this, because while it's a relatively minor change, it does
+ # get things working inside the properly model, at least for a start.
+ #
+ # Bug reports are expected and welcome :)
+ #
# Revision 1.12 2003/04/24 19:56:42 dischi
# comment cleanup for 1.3.2-pre4
***************
*** 65,68 ****
--- 77,82 ----
from gui.PopupBox import PopupBox
+ import record_schedule
+ # Set to 1 for debug output
DEBUG = config.DEBUG
***************
*** 73,76 ****
--- 87,94 ----
import plugin
+ from record_schedule import ScheduleEdit
+ + m = ScheduleEdit()
+ def get_tunerid(channel_id):
***************
*** 105,110 ****
items = [ menu.MenuItem('TV Guide', action=self.start_tvguide),
DirItem(config.DIR_RECORD, None, name = 'Recorded Shows',
! display_type='tv') ]
! menuw.pushmenu(menu.Menu('TV MAIN MENU', items, item_types = 'tv'))
--- 123,128 ----
items = [ menu.MenuItem('TV Guide', action=self.start_tvguide),
DirItem(config.DIR_RECORD, None, name = 'Recorded Shows',
! display_type='tv'),
! menu.MenuItem('Scheduled Recordings',action=self.view_schedule) ]
menuw.pushmenu(menu.Menu('TV MAIN MENU', items, item_types = 'tv'))
***************
*** 123,126 ****
--- 141,147 ----
return time.mktime(stime)
+ def view_schedule(self,arg, menuw):
+ m.main_menu()
+ return
def start_tvguide(self, arg, menuw):
------------------------------------------------------- This SF.net email is sponsored by: eBay Get office equipment for less on eBay! http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5 _______________________________________________ Freevo-cvslog mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freevo-cvslog
------------------------------------------------------- This SF.net email is sponsored by: eBay Get office equipment for less on eBay! http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5 _______________________________________________ Freevo-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freevo-devel