gmod-medialib
gmod-medialib copied to clipboard
Create a standard for querying meta
-- For all
title = "x"
duration = -1 -- -1 signifies unavailability/non-finite length, but duration MUST still always exist
error = "x" -- if video can't be played for some reason eg. country restriction
-- For twitch, ustream, webradio
isStream = true
isStreamOnline = true
-- For webradio
currentSong = "song title"
Also needs a standard for error strings.
Example: error_id:Readable error string that can describe the error better
timed_out:Video query timed out
inexistent:Video does not exist
apierror:API error (eg. didn't return JSON or 404'd)
Note: these should only be query related errors. If video can't be played because of eg. country restriction, it should be specified in 'error' field of meta instead of a query error
Also add a way to tell query function what data should be queried for. Possible dataTypes:
- nil (url) [this is default for all queries]
- basic (title, duration, isStream)
- streamInfo (isStreamOnline, currentSong for webradio)
- id3 (runs id3 parser and mp3duration parsers, note: mp3duration should be stored in another field than duration)
This should change Service#query to following
Service#query(link [, dataTypes], callback)
where dataTypes is a table of data types to query.
Also needs a way to force update cached mediaclip:lookupMeta.
Does this mean some keys should have a flag that means they can not update and don't need to be re-queried or vice versa (some keys should have a flag that they can update)?