Ejemplo n.º 1
0
def play(fname):
    global player
    stop()
    player = mpylayer.MPlayerControl()
    player.loadfile(fname)
    #    player.volume = 0
    player.fullscreen = 1
Ejemplo n.º 2
0
def main_loop(screen):
    global current_episode, stdscr, main_display, debug_display, favourited_log_string, episode_length
    # Surely needs: global current_track
    global current_track
    global ep, JB_DATABASE
    global mp

    mp = mpylayer.MPlayerControl()

    stdscr = screen
    main_display = curses.newwin(DISPLAYHEIGHT + 1, LINEWIDTH, 1, 0)
    debug_display = curses.newwin(0, 0, DISPLAYHEIGHT + 2, 0)
    debug_display.scrollok(1)

    if HIDE_CURSOR:
        try:
            curses.curs_set(0)
        except:
            debug("Cannot hide cursor.")

    stdscr.nodelay(1)
    #curses.halfdelay(4)
    curses.init_pair(1, curses.COLOR_RED, curses.COLOR_BLACK)
    curses.init_pair(2, curses.COLOR_GREEN, curses.COLOR_BLACK)
    curses.init_pair(4, curses.COLOR_BLUE, curses.COLOR_BLACK)
    curses.init_pair(3, curses.COLOR_YELLOW, curses.COLOR_BLACK)
    curses.init_pair(6, curses.COLOR_CYAN, curses.COLOR_BLACK)
    curses.init_pair(5, curses.COLOR_MAGENTA, curses.COLOR_BLACK)
    curses.init_pair(7, curses.COLOR_WHITE, curses.COLOR_BLACK)

    display("Junction", "Box")
    led(0, 0, 0)

    ep = EpisodeDatabase.EpisodeDatabase(JB_DATABASE)

    if ep.nepisodes() == 0:
        #TODO when episode downloading is moved to junctionbox then it should
        #wait here while downloading instead of exiting.
        #B: Though in an ideal world it would immediately play the one it's downloading.
        sys.exit("Can't find any episodes to play in " + JB_DATABASE)

    #current_episode = ep.nepisodes() - 1
    current_episode = ep.nepisodes() - 1
    launch_track = -1
    if (len(sys.argv) > 1):
        current_episode = int(sys.argv[1])
    if (len(sys.argv) > 2):
        launch_track = int(sys.argv[2])
    while current_episode > -1 and current_episode < ep.nepisodes():
        episode_loop(launch_track)
        launch_track = -1
        current_episode = current_episode + PLAY_DIRECTION
Ejemplo n.º 3
0
    def start(self):
        """Mandatory method."""
        self.cap = Capture(self.screen, self.SPG, size=(320, 240))

        b = os.path.join(self.CPdatadir, '200px_80px_blue.png')
        b_ro = os.path.join(self.CPdatadir, '200px_80px_black.png')
        self.shootbut = SPWidgets.TransImgButton(b, b_ro, (300, 500), fcol=WHITE, \
                                             text=_("Shoot"))
        self.shootbut.connect_callback(self._cbf_shoot_but, MOUSEBUTTONUP,
                                       None)

        mp = mpylayer.MPlayerControl()
        test = os.path.join(ACTIVITYDATADIR, 'CPData', 'VideoData', 'video',
                            'test1')
        mp.loadfile(os.path.join(test, 'aquaa.mpg'))
Ejemplo n.º 4
0
#!/usr/bin/python2
import mpylayer
import time

player = None

if __name__ == "__main__":
    mp = mpylayer.MPlayerControl()
    mp.loadfile("/mnt/raid/anime/Wolf and Spices/Season 1/10.mkv")
    #    mp.volume = 0
    mp.fullscreen = 1
    print mp.sub_demux
    print mp.metadata
    time.sleep(10)
    mp.sub_select()
    time.sleep(10)
    mp.sub_select()
    time.sleep(10)
    mp.sub_select()


def play(fname):
    global player
    stop()
    player = mpylayer.MPlayerControl()
    player.loadfile(fname)
    #    player.volume = 0
    player.fullscreen = 1


def pause():
Ejemplo n.º 5
0
    def applySettings(self):
        if self.gui.get_object('radiobutton1').get_active():
            if self.backend.lower() != self.gui.get_object(
                    'combobox1').get_active_text().lower():
                if self.gui.get_object(
                        'combobox1').get_active_text().lower() == 'vlc-tvmx':
                    try:
                        import vlc
                        self.parent.mediaPlayer.quit()
                        self.backend = self.gui.get_object(
                            'combobox1').get_active_text().lower()
                        self.parent.stopCallback()
                    except:
                        self.backend = 'gstreamer'
                elif self.gui.get_object(
                        'combobox1').get_active_text().lower() == 'mplayer':
                    try:
                        import mpylayer
                        mpylayer.MPlayerControl()
                        self.parent.mediaPlayer.quit()
                        self.backend = self.gui.get_object(
                            'combobox1').get_active_text().lower()
                        self.parent.stopCallback()
                    except:
                        self.backend = 'gstreamer'
                elif self.gui.get_object(
                        'combobox1').get_active_text().lower() == 'gstreamer':
                    try:
                        import gst, pygst
                        self.parent.mediaPlayer.quit()
                        self.backend = self.gui.get_object(
                            'combobox1').get_active_text().lower()
                        self.parent.stopCallback()
                    except:
                        self.backend = 'mplayer'
                self.parent.mediaPlayer = self.parent.players[self.backend]

        if self.internal != self.gui.get_object('radiobutton1').get_active():
            self.internal = self.gui.get_object('radiobutton1').get_active()
            try:
                self.parent.mediaPlayer.stop()
            except:
                pass
            if self.gui.get_object('radiobutton1').get_active():
                self.gui.get_object('menuitem8').set_sensitive(True)
                self.gui.get_object('menuitem7').set_sensitive(True)
                self.gui.get_object('checkmenuitem1').set_sensitive(True)
                self.gui.get_object('vbox2').show()
            if self.gui.get_object('radiobutton2').get_active():
                self.gui.get_object('menuitem8').set_sensitive(False)
                self.gui.get_object('menuitem7').set_sensitive(False)
                self.gui.get_object('checkmenuitem1').set_sensitive(False)
                self.gui.get_object('vbox2').hide()
            self.gui.get_object('menuitem7').activate()

        if self.enableremote != self.gui.get_object(
                'checkbutton2').get_active():
            if self.gui.get_object('checkbutton2').get_active():
                pass  #self.parent.initRemote()
            else:
                self.parent.infrared.quit()

        if self.enablehttpremote != self.gui.get_object(
                'checkbutton5').get_active():
            if self.gui.get_object('checkbutton5').get_active():
                self.parent.HTTPremote.stop()
                self.parent.HTTPremote.start(
                    int(self.gui.get_object('spinbutton3').get_value()))
            else:
                self.parent.HTTPremote.stop()

        if self.remoteport != self.gui.get_object('spinbutton3').get_value():
            self.parent.HTTPremote.stop()
            self.parent.HTTPremote.start(
                int(self.gui.get_object('spinbutton3').get_value()))

        if not self.internal:
            self.parent.radioWidget.modTV(None)
            self.parent.gui.get_object('modradiomenu').set_sensitive(False)
        self.parent.channelList(self.parent.gui.get_object('menuitem7'))
Ejemplo n.º 6
0
    def __init__(self, parent):
        global slist
        self.slist = slist
        self.parent = parent
        self.cfgfile = cfgfile
        self.gui = self.parent.gui
        self.abonamente = self.getSubscriptions()
        self.updateList = False
        if not os.path.exists(cfgfile):
            config.add_section('General')
            config.set('General', 'volume', '1.0')
            try:
                import mpylayer
                mpylayer.MPlayerControl()
                config.set('General', 'backend', 'MPlayer')
            except:
                config.set('General', 'backend', 'GStreamer')
                try:
                    import vlc
                except:
                    config.set('General', 'internal', 'False')
            config.set('General', 'internal', 'True')
            config.set('General', 'player', '/usr/bin/totem')
            config.set('General', 'staticports', 'False')
            config.set('General', 'inport', '10320')
            config.set('General', 'outport', '10321')
            config.set('General', 'enableremote', 'True')
            config.set('General', 'enablehttpremote', 'False')
            config.set('General', 'remoteport', '8080')
            config.set('General', 'aspect', 'Auto')
            config.set('General', 'contrast', '1.0')
            config.set('General', 'brightness', '1.0')
            config.set('General', 'saturation', '1.0')
            config.set('General', 'showDonate', '')
            config.set('General', 'statusIcon', 'False')
            config.set('General', 'theme', self.getTheme())
            config.set('General', 'shutdownCMD', self.guess_shutdown_cmd())
            config.set('General', 'subscriptions', json.dumps(self.slist))
            config.set('General', 'windowSize', '660x437')
            config.set('General', 'HPanedPosition', '210')
            config.add_section('Remote')
            config.set('Remote', 'playpause', '00000000000100a4')
            config.set('Remote', 'switch_fullscreen', '0000000000010174')
            config.set('Remote', 'stop', '0000000000010080')
            config.set('Remote', 'volumeup', '0000000000010073')
            config.set('Remote', 'volumedown', '0000000000010072')
            config.set('Remote', 'mute', '0000000000010071')
            config.set('Remote', 'quit', '0000000000010179')
            config.set('Remote', 'nextchannel', '0000000000010192')
            config.set('Remote', 'prevchannel', '0000000000010193')
            config.set('Remote', 'info', '000000000001008b')
            config.set('Remote', 'up', '0000000000010067')
            config.set('Remote', 'down', '000000000001006c')
            config.set('Remote', 'ok', '0000000000010160')
            config.set('Remote', 'sleep', '000000000001008e')
            config.add_section('PBX')
            config.set('PBX', 'username', '')
            config.set('PBX', 'password', '')
            config.set('PBX', 'remember', 'False')
            config.add_section('Recording')
            config.set('Recording', 'recordingQuality', '5')
            config.set('Recording', 'acodec', 'copy')
            config.set('Recording', 'vcodec', 'copy')
            config.set('Recording', 'format', 'matroska')
            config.add_section('Petrodava')
            config.set('Petrodava', 'enable', 'False')
            config.set('Petrodava', 'server', 'petrodava.tv-maxe.org')
            config.set('Petrodava', 'port', '80')
            config.set('Petrodava', 'username', 'petrodava')
            config.set('Petrodava', 'password', 'petrodava')

            with open(cfgfile, 'wb') as configfile:
                config.write(configfile)

        self.petrodavaPortChanged_handler =\
            self.gui.get_object('petrodavaPort').connect('key-release-event', self.petrodavaPortChanged, None)
        self.petrodavaEnableChanged_handler =\
            self.gui.get_object('petrodavaEnable').connect('toggled', self.petrodavaEnableChanged, None)

        self.initiallabel53text = self.gui.get_object('label53').get_text()
        self.readSettings()
        self.setAbonamente()