wplayer

Check-in [264e89591f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Normalize capitalization of mixins. Switch to account server.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256:264e89591f923b99096f835b7f778e9087af4efdb27974f96749676b50d7155f
User & Date: ajv-899-334-8894@vsta.org 2016-11-21 22:08:15
Context
2016-11-24
17:26
Ignore production config files check-in: 5e9f18ddb9 user: ajv-899-334-8894@vsta.org tags: master, trunk
2016-11-21
22:08
Normalize capitalization of mixins. Switch to account server. check-in: 264e89591f user: ajv-899-334-8894@vsta.org tags: master, trunk
2016-06-18
03:27
Work on now playing data display. Add "drop all" list. check-in: 7d0b100321 user: ajv-899-334-8894@vsta.org tags: master, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added etc/config.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
serve http
    port 8082
    # iface eth0
# serve https
    # port 443
    # iface eth1
    # publicCert certs/server.crt
    # privateKey certs/server.key

files mp3
    path /mnt/media1/vandys/mp3

Deleted etc/player.cfg.

1
2
3
4
5
6
7
8
9
10
11
serve http
    port 8082
    # iface eth0
# serve https
    # port 443
    # iface eth1
    # publicCert certs/server.crt
    # privateKey certs/server.key

files mp3
    path /mnt/media1/vandys/mp3
<
<
<
<
<
<
<
<
<
<
<






















Changes to get.py.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#	Main UI.  Top part is playlist, bottom is file/dir browser
#  /media/<prefix>/...
#	For each prefix of files, its contents is served by
#	way of its path under here.
import os, stat, urllib

# The GET part of our handling
class GET_Mixin(object):

    # Configure our WPlayer GET treatment
    def __init__(self):

	# GET handlers
	self.dispatchers.append( ("GET", self.send_path) )








|







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#	Main UI.  Top part is playlist, bottom is file/dir browser
#  /media/<prefix>/...
#	For each prefix of files, its contents is served by
#	way of its path under here.
import os, stat, urllib

# The GET part of our handling
class GET_mixin(object):

    # Configure our WPlayer GET treatment
    def __init__(self):

	# GET handlers
	self.dispatchers.append( ("GET", self.send_path) )

Changes to main.py.

1
2
3
4
5
6
7

8
9
10

11
12
13

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32





33
34
35
36
37
38
39
40
41
42
43





44
45
46
47
48
49
50
#
# main.py
#	Main driver for WWW-Usenet interface
#
import sys, time
import chore
from get import GET_Mixin


# Tie our various handlers together
class App_Handler(chore.handlers.Chore_Handler, GET_Mixin):

    def __init__(self, conn, tup, approot):
	chore.handlers.Chore_Handler.__init__(self, conn, tup, approot,
	    (GET_Mixin.__init__,))


# Load our configuration file
#
# This includes configuring our config file elements,
#  then processing the supplied file.
def load_cfg(fn):

    # A configurator
    c = chore.config.Config()

    # Here's how our config file looks
    c.fields0.add("files")
    c.mults0.add("files")
    c.subconfig.add("files")
    c.fields1.add("path")
    c.onearg.update( ("files", "path") )

    # Let the web network side add its config entries
    chore.www.add_config(c)






    # Parse the input
    return c.load_cfg(fn)

# Root of our app server
class App(chore.server.Server):

    def __init__(self, config):
	# Let Chore handle most things
	chore.server.Server.__init__(self, config, App_Handler);






if __name__ == "__main__":
    if len(sys.argv) != 2:
	sys.stderr.write("Usage is: %s <config-file>\n" %
	    (sys.argv[0],))
	sys.exit(1)

    # Create the server with config






|
>


|
>


|
>










<
<
<
<
<
<
<


>
>
>
>
>





|





>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26







27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#
# main.py
#	Main driver for WWW-Usenet interface
#
import sys, time
import chore
from get import GET_mixin
from chore.authen import Authen_mixin, Authen_Server_mixin

# Tie our various handlers together
class App_Handler(chore.handlers.Chore_Handler, GET_mixin,
        Authen_mixin):
    def __init__(self, conn, tup, approot):
	chore.handlers.Chore_Handler.__init__(self, conn, tup, approot,
	    (GET_mixin.__init__,
             Authen_mixin.__init__))

# Load our configuration file
#
# This includes configuring our config file elements,
#  then processing the supplied file.
def load_cfg(fn):

    # A configurator
    c = chore.config.Config()








    # Let the web network side add its config entries
    chore.www.add_config(c)

    # Here's how our config file looks
    c.onearg.add( ("files",) )
    c.mults.add( ("files",) )
    c.onearg.add( ("files", "path") )

    # Parse the input
    return c.load_cfg(fn)

# Root of our app server
class App(chore.server.Server, Authen_Server_mixin):

    def __init__(self, config):
	# Let Chore handle most things
	chore.server.Server.__init__(self, config, App_Handler);

        # Authen server
        Authen_Server_mixin.__init__(self)
        self.authentication.append(Authen_mixin.auth_server)
        self.init_acct_server()

if __name__ == "__main__":
    if len(sys.argv) != 2:
	sys.stderr.write("Usage is: %s <config-file>\n" %
	    (sys.argv[0],))
	sys.exit(1)

    # Create the server with config

Changes to post.py.

6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#
# / - An old-skool Form submit; non-JS browser
# /msg.json - JSON of a message to send
#
import json
from utils import toascii

class POST_Mixin(object):

    # Write @buf's contents to the file named @fn
    def putfile(self, fn, buf):
	f = open(fn, "w")
	f.write(buf)
	f.close()








|







6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#
# / - An old-skool Form submit; non-JS browser
# /msg.json - JSON of a message to send
#
import json
from utils import toascii

class POST_mixin(object):

    # Write @buf's contents to the file named @fn
    def putfile(self, fn, buf):
	f = open(fn, "w")
	f.write(buf)
	f.close()