Exemplo n.º 1
0
def run_extracting(title, chapter, name, aid, sid=-1, donav=False):
    """
        dump vob file from dvd, specify title, chapter,
        prefix of resulting file, audio language (aid),
        subtitle language (sid), and whether to use dvdnav
    """
    sid_val = 0
    dvd = 'dvd'
    if donav:
        dvd = 'dvdnav'
    if sid < 0:
        command = 'mpv %s://%i --dvd-device=/dev/dvd ' % (dvd, title,) + \
                  '--chapter=%i ' % chapter + \
                  '--stream-dump=%s/vob/%s.vob ' % (DIR, name,) + \
                  '--aid=%i ' % aid
    else:
        command = 'mpv %s://%i --dvd-device=/dev/dvd  ' % (dvd, title,) + \
                  '--chapter=%i ' % chapter + \
                  '--stream-dump=%s/vob/%s.vob ' % (DIR, name,) + \
                  '--aid=%i --sid=%i ' % (aid, sid_val,)
    if donav:
        command = '%s ' % command

    if DEBUG:
        print(title, chapter, name, aid, sid)
    run_command(command)

    make_encoding_file(name)

    return 0
Exemplo n.º 2
0
def run_extracting(title, chapter, name, aid, sid=-1, donav=False):
    """
        dump vob file from dvd, specify title, chapter,
        prefix of resulting file, audio language (aid),
        subtitle language (sid), and whether to use dvdnav
    """
    sid_val = 0
    dvd = 'dvd'
    if donav:
        dvd = 'dvdnav'
    if sid < 0:
        command = 'mpv %s://%i --dvd-device=/dev/sr0 ' % (dvd, title,) + \
                  '--chapter=%i ' % chapter + \
                  '--stream-dump=%s/vob/%s.vob ' % (DIR, name,) + \
                  '--aid=%i ' % aid
    else:
        command = 'mpv %s://%i --dvd-device=/dev/sr0  ' % (dvd, title,) + \
                  '--chapter=%i ' % chapter + \
                  '--stream-dump=%s/vob/%s.vob ' % (DIR, name,) + \
                  '--aid=%i --sid=%i ' % (aid, sid_val,)
    if donav:
        command = '%s ' % command

    if DEBUG:
        print(title, chapter, name, aid, sid)
    run_command(command)

    make_encoding_file(name)

    return 0
Exemplo n.º 3
0
def read_dvd():
    """ run lsdvd """
    command = run_command('lsdvd /dev/sr0', do_popen=True)
    for line in command:
        items = line.split()
        if len(items) == 0 or items[0] != 'Title:':
            continue
        print(line.strip())
Exemplo n.º 4
0
def read_dvd():
    """ run lsdvd """
    command = run_command('lsdvd /dev/dvd', do_popen=True)
    for line in command:
        if hasattr(line, 'decode'):
            line = line.decode()
        items = line.split()
        if len(items) == 0 or items[0] != 'Title:':
            continue
        print(line.strip())
Exemplo n.º 5
0
def make_dvdextract():
    """ main function, handles input from the stdin """
    name = ''
    title = 0
    chapter = 0
    aid = 128
    sid = -1
    donav = False

    if len(os.sys.argv) > 1:
        if os.sys.argv[1].count('nav') == 1:
            donav = True
        if os.sys.argv[1][0] == 'h':
            print('make_dvdextract <read,run,runnav,rm,file,filenav,avi,' +
                  'avinav> <name> <title> <chapter> <aid=> <sid=>')
            return 0
        elif os.sys.argv[1][0:3] == 'run' and len(os.sys.argv) > 2:
            name = os.sys.argv[2]
            if len(os.sys.argv) > 3:
                for arg in os.sys.argv[3:]:
                    cmd, ent = arg.split('=')
                    if cmd == 'aid':
                        aid = int(ent)
                    elif cmd == 'sid':
                        sid = int(ent)
                    elif cmd == 'title' or cmd == 'tit':
                        title = int(ent)
                    elif cmd == 'chapter' or cmd == 'chap':
                        chapter = int(ent)
            return run_extracting(title, chapter, name, aid, sid, donav)
        elif os.sys.argv[1][0:3] == 'avi' and len(os.sys.argv) > 2:
            name = os.sys.argv[2]
            if len(os.sys.argv) > 3:
                for arg in os.sys.argv[3:]:
                    cmd, ent = arg.split('=')
                    if cmd == 'aid':
                        aid = int(ent)
                    elif cmd == 'sid':
                        sid = int(ent)
                    elif cmd == 'title' or cmd == 'tit':
                        title = int(ent)
                    elif cmd == 'chapter' or cmd == 'chap':
                        chapter = int(ent)
            return run_extracting(title, chapter, name, aid, sid, donav)
        elif os.sys.argv[1][0:4] == 'file' and len(os.sys.argv) > 2:
            conffile = open(os.sys.argv[2], 'r')
            for line in conffile:
                if hasattr(line, 'decode'):
                    line = line.decode()
                items = line.split()
                if len(items) == 0:
                    continue
                name = items[0]
                title = int(items[1])
                if len(items) > 2:
                    for arg in items[2:]:
                        if len(arg.split('=')) > 1:
                            cmd, ent = arg.split('=')
                            if cmd == 'aid':
                                aid = int(ent)
                            elif cmd == 'sid':
                                sid = int(ent)
                            elif cmd == 'title' or cmd == 'tit':
                                title = int(ent)
                            elif cmd == 'chapter' or cmd == 'chap':
                                chapter = int(ent)
                run_extracting(title, chapter, name, aid, sid, donav)
        elif os.sys.argv[1] == 'rm' and len(os.sys.argv) > 2:
            name = os.sys.argv[2]
            run_command('rm %s/*/%s*' % (DIR, name))
            return 0
        elif os.sys.argv[1] == 'read':
            read_dvd()
            return 0
        else:
            return 0
    else:
        return 0
Exemplo n.º 6
0
def make_dvdextract():
    """ main function, handles input from the stdin """
    name = ''
    title = 0
    chapter = 0
    aid = 128
    sid = -1
    donav = False

    if len(os.sys.argv) > 1:
        if os.sys.argv[1].count('nav') == 1:
            donav = True
        if os.sys.argv[1][0] == 'h':
            print('make_dvdextract <read,run,runnav,rm,file,filenav,avi,' +
                  'avinav> <name> <title> <chapter> <aid=> <sid=>')
            return 0
        elif os.sys.argv[1][0:3] == 'run' and len(os.sys.argv) > 2:
            name = os.sys.argv[2]
            if len(os.sys.argv) > 3:
                for arg in os.sys.argv[3:]:
                    cmd, ent = arg.split('=')
                    if cmd == 'aid':
                        aid = int(ent)
                    elif cmd == 'sid':
                        sid = int(ent)
                    elif cmd == 'title' or cmd == 'tit':
                        title = int(ent)
                    elif cmd == 'chapter' or cmd == 'chap':
                        chapter = int(ent)
            return run_extracting(title, chapter, name, aid, sid, donav)
        elif os.sys.argv[1][0:3] == 'avi' and len(os.sys.argv) > 2:
            name = os.sys.argv[2]
            if len(os.sys.argv) > 3:
                for arg in os.sys.argv[3:]:
                    cmd, ent = arg.split('=')
                    if cmd == 'aid':
                        aid = int(ent)
                    elif cmd == 'sid':
                        sid = int(ent)
                    elif cmd == 'title' or cmd == 'tit':
                        title = int(ent)
                    elif cmd == 'chapter' or cmd == 'chap':
                        chapter = int(ent)
            return run_extracting(title, chapter, name, aid, sid, donav)
        elif os.sys.argv[1][0:4] == 'file' and len(os.sys.argv) > 2:
            conffile = open(os.sys.argv[2], 'r')
            for line in conffile:
                items = line.split()
                if len(items) == 0:
                    continue
                name = items[0]
                title = int(items[1])
                if len(items) > 2:
                    for arg in items[2:]:
                        if len(arg.split('=')) > 1:
                            cmd, ent = arg.split('=')
                            if cmd == 'aid':
                                aid = int(ent)
                            elif cmd == 'sid':
                                sid = int(ent)
                            elif cmd == 'title' or cmd == 'tit':
                                title = int(ent)
                            elif cmd == 'chapter' or cmd == 'chap':
                                chapter = int(ent)
                run_extracting(title, chapter, name, aid, sid, donav)
        elif os.sys.argv[1] == 'rm' and len(os.sys.argv) > 2:
            name = os.sys.argv[2]
            run_command('rm %s/*/%s*' % (DIR, name))
            return 0
        elif os.sys.argv[1] == 'read':
            read_dvd()
            return 0
        else:
            return 0
    else:
        return 0
Exemplo n.º 7
0
# -*- coding: utf-8 -*-
'''
    script to send commands to roku
'''

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

import os

from roku_app.util import run_command
from roku_app.roku_utils import send_to_roku, HOMEDIR

if __name__ == '__main__':
    HOSTNAME = os.uname()[1]
    REMOTEHOST = 'ddbolineathome.mooo.com'
    USER = '******'

    if HOSTNAME != 'dilepton-tower':
        SCRIPT_DIR = '%s/setup_files/build/roku_app/' % HOMEDIR
        CMD = 'python %s/send_to_roku.py' % SCRIPT_DIR
        for arg in os.sys.argv[1:]:
            CMD = '%s %s' % (CMD, arg)
        run_command('ssh %s@%s \"%s\"' % (USER, REMOTEHOST, CMD))
    else:
        RETVAL = send_to_roku(os.sys.argv[1:])
        if len(RETVAL) > 0 and 'command' not in RETVAL:
            print(RETVAL.strip())