def get_video_source(filename, args): if filename.endswith("avi"): return avi(filename, args) elif filename.endswith("vob"): return avi(filename, args) elif filename.startswith("dvd://"): return dvd(filename, args) else: return mplayer(filename, args)
def addSingle(): keyboard = xbmc.Keyboard( "", lang.get( "Add_Single_Input_File_Header" ) ) keyboard.doModal() if not keyboard.isConfirmed(): return location = getSaveLocation( lang.get( "Add_Single_Browse_Location_Header" ) ) if location is None: return name = keyboard.getText() video = dvd.dvd( location, name ) status = video.add() response = xbmcgui.Dialog() if status > 0: #successfully added response.ok( lang.get( "Add_Single_Results_Header" ), lang.get( "Add_Single_Results_Success_Info" ), name ) elif status == 0: response.ok( lang.get( "Add_Single_Results_Header" ), lang.get( "Add_Single_Results_Skipped_Info" ), name, lang.get( "Add_Single_Results_Skipped_Footer" ) ) else: response.ok( lang.get( "Add_Single_Results_Header" ), lang.get( "Add_Single_Results_Failure_Info" ), name, lang.get( "Add_Single_Results_Failure_Footer" ) )
def processBatch( batchFile, saveLocation, progress, lang ): try: input = open( batchFile, "r" ) except IOError: log.error( "Zero files saved, unable to open the input file: " + batchFile ) return -1, -1, -1 data = input.read() input.close() names = data.splitlines() count = len( names ) runningTotal = 0 successes = 0 failures = 0 skips = 0 for name in names: if progress.iscanceled(): break else: runningTotal = runningTotal + 1 progress.update( runningTotal * 100 / count, lang.get( "Add_Batch_Progress_Status" ).replace( "{0}", str( runningTotal ) ).replace( "{1}", str( count ) ), name ) if name == "" or name is None: skips = skips + 1 continue video = dvd.dvd( saveLocation, name ) result = video.add() if result > 0: successes = successes + 1 elif result < 0: failures = failures +1 else: skips = skips + 1 return successes, failures, skips
import pygame import dvd width = 800 height = 600 screen = pygame.display.set_mode((width, height)) running = True screen.fill((0, 0, 0)) clock = pygame.time.Clock() timesince = clock.tick(90) pygame.display.flip() dvd = dvd.dvd(height, width) direction = 0 while (running): clock.tick(90) direction = dvd.update(direction, screen)