enumerated-media-types: add some Android values

This commit is contained in:
Nigel Tao committed 2026-06-23 11:30:07 +10:00
1 parent e0a44a0c40
commit 15a1cbf055
2 files changed
+69 -10

No files matched your search

+6
View File
@@ -213,6 +213,12 @@
0x197816_E971D000 7168914218930176 text/xvcr/.. text/x-vcard
0x197816_FE887DA3 7168914572737955 text/~~~~/~~ text/*
0x1B0CAA_5CAC5000 7613750209957888 vand/curd/.. vnd.android.cursor.dir
0x1B0CAA_5CAC7800 7613750209968128 vand/curi/.. vnd.android.cursor.item
0x1B0CAA_5CAC7DA3 7613750209969571 vand/curi/~~ vnd.android.cursor.item/*
0x1B0CAA_623F0A27 7613750303459879 vand/docu/di vnd.android.document/directory
0x1B0CAA_623F0C41 7613750303460417 vand/docu/ro vnd.android.document/root
0x1B384F_1DE9D000 7661736826621952 vide/3gpp/.. video/3gpp
0x1B384F_1DE9D072 7661736826622066 vide/3gpp/2. video/3gpp2
0x1B384F_9EAA7000 7661738986729472 vide/mp4./.. video/mp4
+63 -10
View File
@@ -15,7 +15,7 @@ package main
// base38-encode.go prints the base38 encoding of each argument.
//
// Usage: go run base38-encode.go gif json
// Usage: go run base38-encode.go gif json text/html/..
import (
"fmt"
@@ -36,23 +36,76 @@ func main1() error {
args := os.Args
if len(args) > 1 {
for _, arg := range args[1:] {
arg := (strings.ToLower(arg) + "....")[:4]
if code, ok := base38.Encode(arg); ok {
code0 := fmt.Sprintf("0x%06X", code)
code1 := fmt.Sprintf("0x%08X", code<<10)
fmt.Printf("%s code: %s %s code<<10: %s %s\n",
arg, code0, underscore(code0), code1, underscore(code1))
} else {
fmt.Printf("%s -\n", arg)
if len(arg) <= 4 {
arg := (strings.ToLower(arg) + "....")[:4]
if code, ok := base38.Encode(arg); ok {
code0 := fmt.Sprintf("0x%06X", code)
code1 := fmt.Sprintf("0x%08X", code<<10)
fmt.Printf("%s code: %s %s code<<10: %s %s\n",
arg, code0, underscore4(code0), code1, underscore4(code1))
continue
}
} else if len(arg) == 7 {
// Assume that arg is of the form "aaaa/bb".
arg0 := arg[0:4]
arg1 := ".." + arg[5:7]
c0, ok0 := base38.Encode(arg0)
c1, ok1 := base38.Encode(arg1)
if ok0 && ok1 {
c := (c0 << 11) | c1
code := fmt.Sprintf("0x%08X", c)
fmt.Printf("%s\t%10d\t%s\n", underscore4(code), c, arg)
continue
}
} else if len(arg) == 12 {
// Assume that arg is of the form "aaaa/bbbb/cc".
arg0 := arg[0:4]
arg1 := arg[5:9]
arg2 := ".." + arg[10:12]
c0, ok0 := base38.Encode(arg0)
c1, ok1 := base38.Encode(arg1)
c2, ok2 := base38.Encode(arg2)
if ok0 && ok1 && ok2 {
c := (uint64(c0) << 32) | (uint64(c1) << 11) | uint64(c2)
code := fmt.Sprintf("0x%014X", c)
fmt.Printf("%s\t%16d\t%s\n", underscore8(code), c, arg)
continue
}
} else if len(arg) == 14 {
// Assume that arg is of the form "aaaa/bbbb/cccc".
arg0 := arg[0:4]
arg1 := arg[5:9]
arg2 := arg[10:14]
c0, ok0 := base38.Encode(arg0)
c1, ok1 := base38.Encode(arg1)
c2, ok2 := base38.Encode(arg2)
if ok0 && ok1 && ok2 {
c := (uint64(c0) << 42) | (uint64(c1) << 21) | uint64(c2)
code := fmt.Sprintf("0x%016X", c)
fmt.Printf("%s\t%19d\t%s\n", underscore8(code), c, arg)
continue
}
}
fmt.Printf("%s -\n", arg)
}
}
return nil
}
func underscore(s string) string {
func underscore4(s string) string {
if n := len(s) - 4; n > 0 {
return s[:n] + "_" + s[n:]
}
return s
}
func underscore8(s string) string {
if n := len(s) - 8; n > 0 {
return s[:n] + "_" + s[n:]
}
return s
}