wplayer

Check-in [0544a82571]
Login

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

Overview
Comment:Deal with non-ASCII file names
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256:0544a82571a72a5cd0103a0dfea2ab2323007ed2774a25dccf1a01e460e1a657
User & Date: ajv-899-334-8894@vsta.org 2017-06-24 04:33:09
Context
2017-10-24
05:00
Permit player to be entered with "...?noflac", and have it receive a transcode to ogg. check-in: b0fbc45b9f user: ajv-899-334-8894@vsta.org tags: master, trunk
2017-06-24
04:33
Deal with non-ASCII file names check-in: 0544a82571 user: ajv-899-334-8894@vsta.org tags: master, trunk
2017-04-22
03:41
Dynamic reload of index contents. check-in: 14a0ab9378 user: ajv-899-334-8894@vsta.org tags: master, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to get.py.

6
7
8
9
10
11
12

13
14
15














16
17
18
19
20
21
22
..
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
..
60
61
62
63
64
65
66


67
68
69

70



71
72
73
74
75
76
77
#  /
#	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, sys, stat, urllib
import utils


# Max search results when filtering
MAXSEARCH=20















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

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

................................................................................
	for path,dirs,files in os.walk(path):
	    break
	else:
	    # If the walk got nothing, provide empty lists
	    files = dirs = ()

	# Normalize to UTF-8
	files = [urllib.quote(f.decode('utf-8', 'replace')) for f in files]
	dirs = [urllib.quote(d.decode('utf-8', 'replace')) for d in dirs]

	# In order
	files.sort()
	dirs.sort()

	# Put into place
	res["files"] = files
................................................................................
	    if tup[0] == elem:
		return tup[1]
        return None

    # GET dispatcher
    # See if it's a configured path, and serve file or dir
    def send_path(self):


	app = self.server
	webroot = app.approot
	cpaths = webroot.config["files"]

	pp = [urllib.unquote(p) for p in self.paths]




	# We serve /media/prefix/blah/blah...
	if pp[0] != "media":
	    return False,None
	del pp[0]

	# Root; list configured prefixes themselves







>



>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|
|







 







>
>



>

>
>
>







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
..
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
..
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#  /
#	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, sys, stat, urllib
import utils
from chore.utils import uncharenc

# Max search results when filtering
MAXSEARCH=20

# Turn names into plain ASCII ones, with remap record so they
#  can still be opened
remaps = {}
def plain_names(names):
    global remaps

    res = []
    for n in names:
        n2 = uncharenc(n)
        if n != n2:
            remaps[n2] = n
        res.append(urllib.quote(n2))
    return res

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

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

................................................................................
	for path,dirs,files in os.walk(path):
	    break
	else:
	    # If the walk got nothing, provide empty lists
	    files = dirs = ()

	# Normalize to UTF-8
        files = plain_names(files)
        dirs = plain_names(dirs)

	# In order
	files.sort()
	dirs.sort()

	# Put into place
	res["files"] = files
................................................................................
	    if tup[0] == elem:
		return tup[1]
        return None

    # GET dispatcher
    # See if it's a configured path, and serve file or dir
    def send_path(self):
        global remaps

	app = self.server
	webroot = app.approot
	cpaths = webroot.config["files"]
        # Get URL level quoting out of the way
	pp = [urllib.unquote(p) for p in self.paths]
        # If we had to flatten out characters, restore
        #  to filesystem name
        pp = [remaps.get(p, p) for p in pp]

	# We serve /media/prefix/blah/blah...
	if pp[0] != "media":
	    return False,None
	del pp[0]

	# Root; list configured prefixes themselves