Exemplo n.º 1
0
    def remcontrols(self, play = 0, pause=0, stop = 0, quit = 0, vol_up = 0, vol_down = 0, ff = 0, rw = 0, next_file = 0, prev_file = 0):
        global p
        if pause > 0:
            controls.send_cmd(p, config_dict['pause_key'])
            if controls.get_status() == 'playing':
                controls.update_status("paused", controls.get_playing())
            else:
                controls.update_status("playing", controls.get_playing())

        if stop > 0:     
            p = controls.send_cmd(p, config_dict['stop_key'])
            controls.update_status("stopped")

        if vol_up > 0:
            for i in range(7):
                controls.send_cmd(p, config_dict['vol_up_key'])

        if vol_down > 0:
            for i in range(7):
                controls.send_cmd(p, config_dict['vol_down_key'])

        if ff > 0:
            controls.send_cmd(p, config_dict['ff_key'])
        
        if rw > 0:
            controls.send_cmd(p, config_dict['rw_key'])
        if play > 0:
            p = controls.start(config_dict['executable'], config_dict['cmd_args'], play, p)
        
        return controls.get_playing()
Exemplo n.º 2
0
 def videos(self):
     conn = sqlite3.connect("remote.db")
     cursor = conn.cursor()
     template = env.get_template("filelist.tpl")
     sql = "SELECT key, name FROM library WHERE type='.mp4' OR type='.avi' OR type='.mkv'"
     cursor.execute(sql)
     row = cursor.fetchall()
     return template.render(playing=controls.get_playing(), files = row)
Exemplo n.º 3
0
 def videos(self):
     conn = sqlite3.connect("remote.db")
     cursor = conn.cursor()
     template = env.get_template("filelist.tpl")
     sql = "SELECT key, name FROM library WHERE type='.mp4' OR type='.avi' OR type='.mkv'"
     cursor.execute(sql)
     row = cursor.fetchall()
     return template.render(playing=controls.get_playing(), files=row)
Exemplo n.º 4
0
 def playlist(self):
     conn = sqlite3.connect("remote.db")
     cursor = conn.cursor()
     template = env.get_template("playlist.tpl")
     sql = "SELECT key, name FROM playlists"
     cursor.execute(sql)
     row = cursor.fetchall()
     
     return template.render(playing = controls.get_playing(), playlists = row)
Exemplo n.º 5
0
    def playlist(self):
        conn = sqlite3.connect("remote.db")
        cursor = conn.cursor()
        template = env.get_template("playlist.tpl")
        sql = "SELECT key, name FROM playlists"
        cursor.execute(sql)
        row = cursor.fetchall()

        return template.render(playing=controls.get_playing(), playlists=row)
Exemplo n.º 6
0
    def remcontrols(self,
                    play=0,
                    pause=0,
                    stop=0,
                    quit=0,
                    vol_up=0,
                    vol_down=0,
                    ff=0,
                    rw=0,
                    next_file=0,
                    prev_file=0):
        global p
        if pause > 0:
            controls.send_cmd(p, config_dict['pause_key'])
            if controls.get_status() == 'playing':
                controls.update_status("paused", controls.get_playing())
            else:
                controls.update_status("playing", controls.get_playing())

        if stop > 0:
            p = controls.send_cmd(p, config_dict['stop_key'])
            controls.update_status("stopped")

        if vol_up > 0:
            for i in range(7):
                controls.send_cmd(p, config_dict['vol_up_key'])

        if vol_down > 0:
            for i in range(7):
                controls.send_cmd(p, config_dict['vol_down_key'])

        if ff > 0:
            controls.send_cmd(p, config_dict['ff_key'])

        if rw > 0:
            controls.send_cmd(p, config_dict['rw_key'])
        if play > 0:
            p = controls.start(config_dict['executable'],
                               config_dict['cmd_args'], play, p)

        return controls.get_playing()
Exemplo n.º 7
0
    def index(self, quit = 0):
        global exit
        global env
        global config_dict
        exit = quit

        conn = sqlite3.connect("remote.db")
        cursor = conn.cursor()

        template = env.get_template("index.tpl")
        sql = "SELECT key, path FROM library"
        cursor.execute(sql)
        row = cursor.fetchall()
        return template.render(playing=controls.get_playing())
Exemplo n.º 8
0
    def index(self, quit=0):
        global exit
        global env
        global config_dict
        exit = quit

        conn = sqlite3.connect("remote.db")
        cursor = conn.cursor()

        template = env.get_template("index.tpl")
        sql = "SELECT key, path FROM library"
        cursor.execute(sql)
        row = cursor.fetchall()
        return template.render(playing=controls.get_playing())
Exemplo n.º 9
0
    def settings(self, pause_key='', stop_key='', vol_up_key='', vol_down_key='', ff_key='', rw_key='', remove = '', add = '', add_dir = '', submit = '', port = '', recurse = '1', cmd_args = '', executable = ''):
        conn = sqlite3.connect("remote.db")
        cursor = conn.cursor()
        
        if add_dir != '':
            cursor.execute("INSERT INTO library_paths (path, recurse, monitor) VALUES (?, ?, ?)", [add_dir, recurse, 1])
            conn.commit()
            controls.add_path_to_library(add_dir, recurse)

        if port != '':
            cursor.execute("UPDATE config SET value=? WHERE name='port'", [port])
            conn.commit()
        if remove != '':
            cursor.execute("SELECT path, recurse FROM library_paths WHERE key=?", [remove])
            row = cursor.fetchone()
            path = row[0]
            path_recurse = row[1] 
            cursor.execute("DELETE FROM library_paths WHERE key=?", [remove])
            if path_recurse == 1:
                cursor.execute("DELETE FROM library WHERE path LIKE ?", ['%' + path + '%']) 
            else:
                cursor.execute("DELETE FROM library WHERE path=?", [path])
            conn.commit()
        if cmd_args != '':
            cursor.execute("UPDATE config SET value=? WHERE name='cmd_args'", [cmd_args])
            conn.commit()
            config_dict['cmd_args'] = cmd_args
        if executable != '':
            cursor.execute("UPDATE config SET value=? WHERE name='executable'", [executable])
            conn.commit()
            config_dict['executable'] = executable

        if stop_key != '':
            cursor.execute("UPDATE config SET value=? WHERE name='stop_key'", [stop_key])
            conn.commit()
            config_dict['stop_key'] = stop_key     

        if vol_up_key != '':
            cursor.execute("UPDATE config SET value=? WHERE name='vol_up_key'", [vol_up_key])
            conn.commit()
            config_dict['vol_up_key'] = vol_up_key     

        if vol_down_key != '':
            cursor.execute("UPDATE config SET value=? WHERE name='vol_down_key'", [vol_down_key])
            conn.commit()
            config_dict['vol_down_key'] = vol_down_key     

        if ff_key != '':
            cursor.execute("UPDATE config SET value=? WHERE name='ff_key'", [ff_key])
            conn.commit()
            config_dict['ff_key'] = ff_key     

        if rw_key != '':
            cursor.execute("UPDATE config SET value=? WHERE name='rw_key'", [rw_key])
            conn.commit()
            config_dict['rw_key'] = rw_key     

        if pause_key != '':
            cursor.execute("UPDATE config SET value=? WHERE name='pause_key'", [pause_key])
            conn.commit()
            config_dict['pause_key'] = pause_key     

        cursor.execute("SELECT path, key, recurse FROM library_paths")
        lib_paths = cursor.fetchall()
        template = env.get_template("settings.tpl")
        return template.render(playing=controls.get_playing(),lib_paths = lib_paths, config_dict = config_dict) 
Exemplo n.º 10
0
    def settings(self,
                 pause_key='',
                 stop_key='',
                 vol_up_key='',
                 vol_down_key='',
                 ff_key='',
                 rw_key='',
                 remove='',
                 add='',
                 add_dir='',
                 submit='',
                 port='',
                 recurse='1',
                 cmd_args='',
                 executable=''):
        conn = sqlite3.connect("remote.db")
        cursor = conn.cursor()

        if add_dir != '':
            cursor.execute(
                "INSERT INTO library_paths (path, recurse, monitor) VALUES (?, ?, ?)",
                [add_dir, recurse, 1])
            conn.commit()
            controls.add_path_to_library(add_dir, recurse)

        if port != '':
            cursor.execute("UPDATE config SET value=? WHERE name='port'",
                           [port])
            conn.commit()
        if remove != '':
            cursor.execute(
                "SELECT path, recurse FROM library_paths WHERE key=?",
                [remove])
            row = cursor.fetchone()
            path = row[0]
            path_recurse = row[1]
            cursor.execute("DELETE FROM library_paths WHERE key=?", [remove])
            if path_recurse == 1:
                cursor.execute("DELETE FROM library WHERE path LIKE ?",
                               ['%' + path + '%'])
            else:
                cursor.execute("DELETE FROM library WHERE path=?", [path])
            conn.commit()
        if cmd_args != '':
            cursor.execute("UPDATE config SET value=? WHERE name='cmd_args'",
                           [cmd_args])
            conn.commit()
            config_dict['cmd_args'] = cmd_args
        if executable != '':
            cursor.execute("UPDATE config SET value=? WHERE name='executable'",
                           [executable])
            conn.commit()
            config_dict['executable'] = executable

        if stop_key != '':
            cursor.execute("UPDATE config SET value=? WHERE name='stop_key'",
                           [stop_key])
            conn.commit()
            config_dict['stop_key'] = stop_key

        if vol_up_key != '':
            cursor.execute("UPDATE config SET value=? WHERE name='vol_up_key'",
                           [vol_up_key])
            conn.commit()
            config_dict['vol_up_key'] = vol_up_key

        if vol_down_key != '':
            cursor.execute(
                "UPDATE config SET value=? WHERE name='vol_down_key'",
                [vol_down_key])
            conn.commit()
            config_dict['vol_down_key'] = vol_down_key

        if ff_key != '':
            cursor.execute("UPDATE config SET value=? WHERE name='ff_key'",
                           [ff_key])
            conn.commit()
            config_dict['ff_key'] = ff_key

        if rw_key != '':
            cursor.execute("UPDATE config SET value=? WHERE name='rw_key'",
                           [rw_key])
            conn.commit()
            config_dict['rw_key'] = rw_key

        if pause_key != '':
            cursor.execute("UPDATE config SET value=? WHERE name='pause_key'",
                           [pause_key])
            conn.commit()
            config_dict['pause_key'] = pause_key

        cursor.execute("SELECT path, key, recurse FROM library_paths")
        lib_paths = cursor.fetchall()
        template = env.get_template("settings.tpl")
        return template.render(playing=controls.get_playing(),
                               lib_paths=lib_paths,
                               config_dict=config_dict)