コード例 #1
0
ファイル: service.py プロジェクト: Giftie/service.makemkv.rip
def _daemon():
    previous_getDVDState = 4 # this should insure only on rip is done
    while ( not xbmc.abortRequested ):
        xbmc.sleep( 250 )
        if xbmc.getDVDState() == 4 and previous_getDVDState != 4:
            utils.log( "Disc Detected, Checking for Movie Disc(s)", xbmc.LOGNOTICE )
            xbmc.sleep( 3000 )
            previous_getDVDState = xbmc.getDVDState()
            disc = makemkv.makeMKV( general_settings ).findDisc( general_settings[ "temp_folder" ] )
            if disc:
                utils.log( "Movie Disc Detected", xbmc.LOGNOTICE )
                if general_settings[ "movie_disc_insertion" ] == "Rip":
                    makeMKV().rip( disc )
                elif general_settings[ "movie_disc_insertion" ] == "Notify":
                    pass
                elif general_settings[ "movie_disc_insertion" ] == "Stream":
                    pass
                elif general_settings[ "movie_disc_insertion" ] == "Ask":
                    pass
                elif general_settings[ "movie_disc_insertion" ] == "Backup":
                    pass
                else: #do nothing
                    pass
        elif xbmc.getDVDState() !=4:
            previous_getDVDState = xbmc.getDVDState()
コード例 #2
0
ファイル: service.py プロジェクト: Giftie/service.makemkv.rip
    def rip(self, discs):        
        log = logger.logger( "Rip", True )

        mkv_save_path = general_settings[ "temp_folder" ]
        mkv_tmp_output = general_settings[ "temp_folder" ]

        mkv_api = makemkv.makeMKV( general_settings )

        log.debug("Ripping started successfully")
        
        log.debug("%d Movie Disc%s found" % ( len(discs), ( "", "s" )[len(discs) > 1] ) )

        if (len(discs) > 0):
            # Best naming convention ever
            for disc in discs:
                mkv_api.setTitle(disc["discTitle"])
                mkv_api.setIndex(disc["discIndex"])

                movie_title = mkv_api.getTitle()

                if not xbmcvfs.exists( os.path.join(mkv_save_path, movie_title) ):
                    xbmcvfs.mkdir( os.path.join(mkv_save_path, movie_title) )

                    mkv_api.getDiscInfo()

                    with stopwatch.stopwatch() as t:
                        status = mkv_api.ripDisc(mkv_save_path, mkv_tmp_output)

                    if status:
                        if general_settings[ "eject_disc_upon_completion" ]:
                            xbmc.executebuiltin( "EjectTray()" )
                            
                        log.info("It took %s minute(s) to complete the ripping of %s" %
                             (t.minutes, movie_title)
                        )

                    else:
                        log.error("MakeMKV did not did not complete successfully")
                        log.error("See log for more details")
                        log.error("Movie title: %s" % movie_title)

                else:
                    log.info("Movie folder %s already exists" % movie_title)

        else:
            log.info("Could not find any Movie Discs in drive list")