1 urls
j edited this page 2023-07-02 12:57:13 +05:30

URL Scheme

[Documents, pandora*, 0xdb2*)]TOC(heading=Design

Is there any reason why we're using url search syntax like ?find=...&sort=... ?
Why not 0xdb.org/ID/view/sort/find ?
And for most users, dropping the regexp special chars would be a good thing

k=v k!=v k==v k!==v (contains, does not contain, is, is not)
k=v* k!=v* k=*v k!=*v (starts with, ends with, does not start with, does not end with)
k<v k>v k<=v k>=v (less, greater, less or equal, greater or equal)
k=a:b k!=a:b (is between, is not between)

the corresponding operators would change only slightly
= != == !==
^ !^ $ !$
< > <= >=
: !:

fewer characters would have to be escaped in string values:
/ & | ( ) = *
and : in list names
# should work unescaped

before: 0xdb.org/grid/?find=list:rlx/foo%3Abar,[director:^JLG$|director:^FFC$]&sort=-votes
after:  0xdb.org/grid/-votes/list=rlx:foo%3Abar&(director==JLG|director==FFC)
... looks nicer

before: ???
after:  0xdb.org/0060304/clips/clip:saturation/subtitles=hello
before: ???
after:  0xdb.org/0060304/timeline/01:00:00/subtitles=hello
before: ???
after:  0xdb.org/0060304/map/barcelona/subtitles=hello
0xdb.org/page
0xdb.org/(part/)(view/)(?find=)(&sort=)
0xdb.org/(part/)(item/)(view/)(time/)(?find=)(&sort=)


page: special page
      about, contact, faq, help, home, news, preferences,
      signin, signout, signup, software, tour, tos
      / is /home on page load, and /items otherwise

part: part of the site 
      items [movies/videos/...], edits, texts
      items can be omitted

item: item id
      0123456 (imdb), 0x0123456789ABCDEF (0xdb), ABC (base 26)
      always begins with 0-9A-Z

view: list or item view
      list: list, icons, info, clips, timelines, maps, calendars, clip, map, calendar, json
      item: info, statistics, clips, video, timeline, files, json
      list views share their namespace with page and part

time: position and selection in video or timeline view
      time can be position, selection, position,selection or selection,position
      position can be 01:02:03 or 0.5: or 1000
      selection can be 01:00-02:00 or 01:00- or -02:00 or - or ABC or subtitles:1
      annotation IDs have to be base 26

find: query
      see query syntax
      can be present in all list and clip views
      (will filter in clips view, highlight in timeline view, etc.)

sort: sort 
      key or +key or -key or +keyA,-keyB
      in list clip view, this can be duration,clip:duration or clip:saturation,brightness

NOTE: if there is an applicable query (foo, or layer:foo),
      list clip view and item clips view will always filter clips accordingly.
      There is no list clip view for "all clips of movies with clips that match foo".

When loading 0xdb.org/foo, if foo is not a page, part, item or view,
check if foo is an exact item title, otherwise treat foo as a query string.

QUERY STRING
    ?find=conditions[&sort=sort]

conditions
    single: condition
    multiple (a and b): condition+condition
    multiple (a or b or c): condition|condition|condition
    multiple (a and (b or c) and d): condition+(condition|condition)+condition

condition
    [key:]value

key
    any item key, or list, or some special stuff (canplayvideo etc)

value
    encode(value) ... we have to escape:
    ? & = # [url special chars]
    : + | ( ) [query special chars]
    ! ^ $ < > [operator special chars]
    / [in list names, see below]

NOTE:
    list:username/listname is ambiguous (one may create a list "foo/bar", where "foo" is an existing user)
    unless we make it list:username/foo%2Fbar (i.e. encode slashes in list names)

encodeURI() does not encode:
    0-9A-Za-z - _ . ! ~ * ' ( ) ; , / ? : @ & = + $ #
encodeURIComponent() does not encode
    0-9A-Za-z - _ . ! ~ * ' ( )
VALID NAMES

username
    0-9 A-Z a-z SPACE . - '
    at least one char, case-insensitive
    non-alphanumeric chars must follow and be followed by an alphanumeric char,
    except ".", which must follow a letter and be followed by space or end of string
    The idea is that anyone who can spell their name in ASCII
    can use their name (George W. O'Donald-Douglas),
    and it's not totally easy to impersonate someone (admin vs. admîn vs. admiN)

listname
    could be 0-9 A-Z a-z SPACE . , : ; ! ? ' " ( ) [ ] { } + - * / & | = < > ` ~ @ # $ % ^ _ \
    (all printable ASCII characters)
    but why not anything unicode, at least one char?
0xdb.org/                           find with welcome screen
0xdb.org/0060304                   item with imdb id
0xdb.org/0060304/23                item with subtitle #23
0xdb.org/0060304/01:23:45          item with subtitle near 01:23:45
0xdb.org/0x0123456789ABCDEF        item with oxdb id
0xdb.org/ABC                       item with pandora id (0-9|A-Z)
0xdb.org/ABC/01:23:45              item with position
0xdb.org/ABC/12:34-56:00           item with selection
0xdb.org/ABC/DEF                   item with layer
0xdb.org/ABC/calendar              item in calender view
0xdb.org/ABC/clips                 item in clips view
0xdb.org/ABC/editor                item in editor view (padma)
0xdb.org/ABC/files                 item in files view (staff/admin)
0xdb.org/ABC/info                  item in info view
0xdb.org/ABC/map                   item in maps view
0xdb.org/ABC/posters               item in posters view (admin)
0xdb.org/ABC/statistics            item in statistics view
0xdb.org/ABC/timeline              item in timeline view (0xdb)
0xdb.org/(0-9|A-Z)                 item not found
0xdb.org/edit                      new timeline
0xdb.org/edit=name                 existing timeline
0xdb.org/edit=user.name            public timeline
0xdb.org/find                      find without welcome screen
0xdb.org/find=value                find all
0xdb.org/find=key:value
0xdb.org/find=key:!value
0xdb.org/find=key:^value
0xdb.org/find=key:!^value
0xdb.org/find=key:value$
0xdb.org/find=key:!value$
0xdb.org/find=key:^value$
0xdb.org/find=key:!^value$
0xdb.org/find=key:>value
0xdb.org/find=key:!>value
0xdb.org/find=key:<value
0xdb.org/find=key:!<value
0xdb.org/find=key:value-value
0xdb.org/find=key:!value-value
0xdb.org/find=key:value,key:value
0xdb.org/find=key:value|key:value
0xdb.org/find=value&sort=key
0xdb.org/find=value&view=view
0xdb.org/find=k:v&sort=k&view=view
0xdb.org/(a-z)                     alias for find=(a-z) (for any non-reserved word)
0xdb.org/(a-z),(a-z)               alias for find=(a-z),(a-z) (for any non-reserved word)
0xdb.org/key:value                 alias for find=key:value
0xdb.org/key:value,value           alias for find=key:value,key:value
0xdb.org/(k:v,k:v)|(k:v,k:v)       alias for find=(k:v,k:v)|(k:v,k:v)
0xdb.org/list:name                 alias for find=list:name
0xdb.org/list:0xdb.name            alias for find=list:0xdb.name
0xdb.org/list:user.name            alias for find=list:user.name
0xdb.org/list:user.name,user.name  alias for find=list:user.name,list:user.name
0xdb.org/sort=key,-key
0xdb.org/view=view
0xdb.org/calendar                  alias for view=calendar
0xdb.org/calendars                 alias for view=calendars
0xdb.org/clips                     alias for view=clip (results with clips)
0xdb.org/flow                      alias for view=flow (coverflow meets snowstack)
0xdb.org/icon                      alias for view=icon
0xdb.org/icon/poster               alias for view=icon/poster
0xdb.org/icon/still                alias for view=icon/still
0xdb.org/icon/timeline             alias for view=icon/timeline
0xdb.org/list                      alias for view=list
0xdb.org/map                       alias for view=map
0xdb.org/maps                      alias for view=maps
0xdb.org/mix                       alias for view=mix (results as clips)
0xdb.org/timeline                  alias for view=timeline (result as timeline)
0xdb.org/timelines                 alias for view=timelines
0xdb.org/about                     last page with dialog
0xdb.org/contact                   last page with dialog
0xdb.org/faq                       last page with dialog
0xdb.org/help                      last page with dialog
0xdb.org/login                     last page with dialog
0xdb.org/logout                    last page with dialog
0xdb.org/news                      last page with dialog
0xdb.org/preferences               last page with dialog
0xdb.org/register                  last page with dialog
0xdb.org/reset                     last page with dialog
0xdb.org/tos                       last page with dialog
0xdb.org/tour                      last page with dialog
0xdb.org/admin

views

list (classic): calendars, clips, flow, icon, json, list, maps, timelines
list (special): calendar, map, mix, timeline
item (view): calendar, clips, files, info, json, map, posters, statistics, video
item (edit): calendar/edit|events, info/edit|metadata, map/edit|locations, video/edit|editor

keys

accessed
aspectratio
bitrate
bitsperpixel
brightness
budget
cast
cinematographer
cinematographers
clips
color
companies
company
connections
countries
country
created
director
directors
duration
editor
editors
event
events
filename
files
filminglocation
filminglocations
genre
genres
gross
id
keyword
keywords
language
links
location
locations
modified
pixels
popularity
producer
producers
profit
published
rating
releasedate
resolution
reviews
runtime
saturation
score
shots
shotsperminute
size
summary
synopsis
title
trivia
volume
votes
words
wordsperminute
writer
writers
year

see [0xdb2Metadata]wiki:pandora/metadata