Commit Graph

152 Commits

Author SHA1 Message Date
Matt Mascarenhas ce9a0e7635 Prevent file clashes
Config parsing now errors-out when it detects clashes between:
    base_dir and search_location, and global_search_dir
    base_dir and player_location

This prevents us from generating search / project pages of multiple
projects (incl. global_search_dir) at the same location, which would
screw up the asset landmarks.
2020-05-17 22:50:28 +01:00
Matt Mascarenhas 877dbab5bd Fix global search page generation and filter
This change makes GenerateGlobalSearchPage() pass the Config to
BuffersToHTML(), which in turn passes it on to GenerateNavigation(),
thus preventing a null-pointer deference when setting the Theme.

It also fixes the filter by using all three of baseURL, searchLocation
and playerLocation to associate the filter and index elements.
2020-05-17 20:35:04 +01:00
Matt Mascarenhas 9dfdc117be Fix search_ and player_location related bugs
On the search pages use the search_location and player_location, in
addition to the base_url, to associate filter and index entries, such
that the filter actually works.

Fix the .index file location for projects with a search_location. As
this is now consistent, we happen to fix a crash that happened when
changing the search_location.

New config option:

    deny_bespoke_templates
         Indexers may use the "template" attribute in the video node of
         an .hmml file to set a bespoke template for that entry,
         superseding any configured player_template. Setting
         "deny_bespoke_templates" to true prevents this.
2020-05-17 02:04:26 +01:00
Matt Mascarenhas e2ea8fdaf3 cinera.c: Memorable Templates
• Pack all templates before sync'ing the projects
• Delay generation of navigation bars until BuffersToHTML(), and free them
  when switching projects
• Change many variably-lengthed items to use memory_book
• Do not push on multiple support scopes with the same ID
• Prevent crash when trying to snipe an asset checksum into an HTML file
  we were never permitted to create
• Reorganise ReadFileIntoBuffer() and related functions into cinera.c

New Template Tags:

    __CINERA_GLOBAL_NAV__
2020-05-15 02:35:55 +01:00
Matt Mascarenhas 33e590c6da cinera_config.c: Prevent read access crash
Passing an empty string to StripSlashes() would crash.

Also add a conditional around the ctime calls in the Won Build System,
to only run it if it exists.
2020-05-10 21:25:05 +01:00
Matt Mascarenhas 3e0ba0b77b cinera.c: Add <div> to match closing </div> 2020-05-10 18:43:40 +01:00
Matt Mascarenhas 18b39b9f72 cinera.c: Always print entry deletion from DB
Previously we only printed deletion in DeletePlayerPageFromFilesystem().
If, however, the output parameter is set in a .hmml file, we needn't
delete that page from filesystem. What would happen is, we move the
file from one location (delete) to another (insert / append), and only
printed out the insertion / append. This gave the impression that the
old database entry remained, when it had correctly been deleted.
2020-05-10 17:32:44 +01:00
Matt Mascarenhas f20a35e0de cinera.c: Fix buffer sizing crash bug 2020-05-10 17:05:12 +01:00
Matt Mascarenhas 3728c8aaee cinera.c: Mention the default config path in -h 2020-05-09 22:27:40 +01:00
Matt Mascarenhas bd8c6b805d cinera.c: Bump the patch version 2020-05-09 19:18:17 +01:00
Matt Mascarenhas c883bbb971 cinera_config.c: Remove extraneous #endif 2020-05-09 19:16:57 +01:00
Matt Mascarenhas 05518781c4 cinera.c: Config
Database version 5

Major features:
    Config file parsing
    Multiple projects per instance
    Searching across multiple projects
    Art sprites, usable by project, medium and support

Minor features:
    The search results are now sortable
    Optimised the search page sorting

Fixes:
    More reliable file system monitoring
    Well-formed templates are now valid, even with the absence of assets
    Correctly resove ~ in paths
    Gracefully handle the lack of an internet connection
    Renamed "annotator" to "indexer"
    Removed PlayerURLPrefix, in favour of .hmml "output" parameter

Replaced the flags collection with:
    -0 Dry-run mode
    -c Set the config file path
    -e Examine the database
    -v Print version
    -h Print help

New template tags:
    __CINERA_NAV__ dropdown
    __CINERA_NAV__ horizontal
    __CINERA_NAV__ plain
    __CINERA_PROJECT_PLAIN__

Deleted template tags:
    __CINERA_MENUS__
    __CINERA_SCRIPT__
2020-05-09 18:33:25 +01:00
Matt Mascarenhas 9051caa94e cinera: Player page mobile style 2019-03-07 20:16:27 +00:00
Matt Mascarenhas 35b6b803e3 cinera.css: .cineraQueryContainer label margin 2019-03-04 00:08:06 +00:00
Matt Mascarenhas 9278390a38 cinera.c: Put sort button on query box's line 2019-03-03 23:32:58 +00:00
Matt Mascarenhas f5a767ff94 cinera.css: Typo 2019-03-03 01:09:57 +00:00
Matt Mascarenhas d6e633cf3e cinera.css: Search page mobile style
cinera_search.js: Conditionally display the results summary
2019-03-03 00:44:05 +00:00
Matt Mascarenhas 9b26d109be cinera.c: Increase AnnotationHeader buffer size 2018-10-26 20:31:37 +01:00
Matt Mascarenhas d37a39af32 cinera.c: Let inotify monitor IN_MOVED_TO events
It seems that rsync triggers these events, so we must handle these in
addition to the IN_CLOSE_WRITE ones triggered by re-saves.

Also fix MakeDir() to correctly make parent directories (i.e. mkdir -p).
2018-10-05 20:57:09 +01:00
Matt Mascarenhas c4ef54c742 cinera.c: Fix template validity checking 2018-09-20 01:13:41 +01:00
Matt Mascarenhas 9d0cdfb488 cinera.c: Add "Packing template" back 2018-09-20 00:43:47 +01:00
Matt Mascarenhas 2eddd7a7c2 cinera.c: Support limitless templates
Previously we had a template tag limit of 16. This commit lifts that
limit to support "unlimited" tags per template.

Skip already offset landmarks most efficiently when adding a new asset.

New template tags:
    __CINERA_SEARCH_URL__
    __CINERA_VOD_PLATFORM__
2018-09-19 20:50:21 +01:00
Matt Mascarenhas 3da53413ce cinera.c: Revved resources
Database version 4

Revving resources involves hashing asset files and appending a query
string to their URLs. Additionally we monitor asset files for changes
and edit their new checksum hash into all HTML files citing them.

This commit also introduces new template tags for assets (listed below)
with which you may instruct Cinera to rev assets of your choice. There
is further information about this in the help (-h) and the README.md

Amongst other minor changes, we now support unset $XDG_CACHE_HOME and
$HOME
    - Thanks to insofaras for wordexp()

New flags:
    -Q Set query string

New template tags:
    __CINERA_ASSET__
    __CINERA_CSS__
    __CINERA_IMAGE__
    __CINERA_JS__

Renamed template tag:
    __CINERA_SEARCH__ (was __CINERA_INDEX__)
2018-09-17 19:06:31 +01:00
Matt Mascarenhas f3b728ee6f cinera_search.js: Mitigate flickering 2018-07-15 23:52:52 +01:00
Matt Mascarenhas 8607ca87ea cinera: Finer-grained search input autofocus 2018-07-05 20:13:25 +01:00
Matt Mascarenhas aa0a8ba327 cinera: Single browser tab and no autofocus mode
This allows search result links to open in the same tab, and prevents
automatic scrolling to the search input box on page load
2018-07-03 15:26:17 +01:00
Matt Mascarenhas 92909a9ee9 cinera.c: Update Casey's support URL 2018-07-02 19:18:18 +01:00
Matt Mascarenhas 8a4a383705 cinera.c: Version bump for faster search 2018-06-23 16:10:55 +01:00
Asaf Gartner 6136a45886 Attempting to speed up rendering without hurting framerate. 2018-06-23 14:32:01 +00:00
Matt Mascarenhas 8c17194180 cinera.c: Correctly set theme 2018-06-13 16:05:21 +01:00
Matt Mascarenhas a1e8efe431 cinera.c: Fix CollationBuffers->ProjectID test 2018-06-12 20:32:56 +01:00
Matt Mascarenhas 966d616b48 cinera.c: Set CollationBuffers.Theme 2018-06-12 20:21:58 +01:00
Matt Mascarenhas 0eeadd560b cinera.c: Add PROJECT_ID and THEME template tags 2018-06-12 20:03:12 +01:00
Matt Mascarenhas 4d495543f5 cinera.c: Add coad and reader ProjectInfo 2018-06-07 18:55:40 +01:00
Matt Mascarenhas 45cf7772d9 cinera.c: Replace pcalc with risc ProjectInfo 2018-06-07 18:38:52 +01:00
Matt Mascarenhas 238427331f cinera.c: Generate index if any files changed
Previously it could fail to generate an index if the processing of the
final file set "Inserted" or "Deleted" to FALSE, even if a prior file
had set it to TRUE
2018-06-04 23:53:28 +01:00
Matt Mascarenhas fc7c28c047 cinera.c: Add :drawing medium
hmmlib: -std=gnu99
2018-06-03 15:22:06 +01:00
Matt Mascarenhas 8ec5475456 cinera.c: Fail earlier on unknown project
HTML-santitise episode title and project name from templates. This won't
always be correct, but I reckon the common case will require it.
2018-05-25 20:05:06 +01:00
Matt Mascarenhas c788fd464e cinera.css: Prevent link scrollbar, just in case 2018-05-22 22:57:39 +01:00
Matt Mascarenhas ce367b00aa cinera: Share link (to current annotation) 2018-05-22 22:43:59 +01:00
Matt Mascarenhas 426cbfccba cinera_player_pre.js: Use YouTube API's timer
This lets users of Firefox 59+ get sub-millisecond accurate performance:
https://developer.mozilla.org/en-US/docs/Web/API/Performance/now
2018-05-15 20:45:03 +01:00
Matt Mascarenhas 845a824d62 cinera.c: Fix fix from 0.5.49 2018-05-14 15:55:49 +01:00
Matt Mascarenhas 525590fa36 cinera.c: Prevent crash when no ProjectInfo->Unit 2018-05-13 17:10:05 +01:00
Matt Mascarenhas d420513e20 cinera_player_pre.js: Allow DOCTYPE html 2018-05-02 00:47:03 +01:00
Matt Mascarenhas e77d208645 cinera.c: Remove spurious file I/O
Don't \-escape anything in the index

Document server's security header (recommended) requirements
2018-05-01 22:05:44 +01:00
Matt Mascarenhas be37ea234a cinera: Replace all inline CSS and JS
We no longer prevent enforcement of strict server security policies (to
be documented)

Add bounds-checking to the Copy string functions, fixing buffer sizes

Fix the marker skipping (e.g. :afk)
2018-04-22 21:57:31 +01:00
Matt Mascarenhas 4a0630beb0 cinera.c: Reference and player tweaks
Different ISBN database, and slightly more flexible BuildReference()
Permit line-breaking on '/' in the references menu

cinera.css and cinera_player*.js:
More subtle "click here to regain focus" - for @insofaras
Persist theatre mode - for @insofaras
Resume in-progress video at previous timecode - for @AsafGartner
2018-04-18 00:05:14 +01:00
Matt Mascarenhas 8d75865cf3 cinera.c: Preserve the case of the markers' text 2018-04-07 06:30:28 +01:00
Matt Mascarenhas 4b9e1a2fa0 cinera.c: Add new reference combination 2018-04-05 22:25:23 +01:00
Matt Mascarenhas 1efd808783 cinera.c: Distinguish speakers from chat comments
It treats co-hosts and guests differently from chat commenters, styling
and categorising annotations for them such that their contributions
don't come under the "Chat comment" medium

Also do some essentially cosmetic code compression of the marker cases
and other things

cinera_player_pre.js: Make the credits menu initially focus the host's
person if they have no support, rather than the first credited person
who has support
2018-04-04 23:39:38 +01:00
Matt Mascarenhas 14afdc044d cinera.c: Add Pseudonym73 credentials 2018-04-02 21:52:45 +01:00
Matt Mascarenhas 33cbb5b05f cinera.c: Support private videos
It merely checks the video's privacy status and, if not public, records
its corresponding HMML base filename privately in the .metadata without
generating a player page or a search / table of contents entry for it.
Every four hours it will loop over the .metadata to recheck the privacy
status of any privately recorded entries, and process newly public ones.

Fix template validation to check that the script comes after both the
player and menus (previously it only specified the player).

Fix relocation code to try and remove only the child directories of the
BaseDir, and no shallower (previously it would try and "recursively"
remove directories all the way back to /, obviously not actually getting
there because it would encounter a non-empty directory along the way).

Add "Modes" to the startup printout.

Flags:
    -g Ignore privacy status
2018-04-01 21:58:53 +01:00
Matt Mascarenhas a27e603e6e cinera.c: Add info for Per and Bitwise 2018-03-23 15:33:37 +00:00
Matt Mascarenhas de2c632806 cinera.c: Binary search the .metadata
Also optimise out superfluous searches, and relieve IndexToBuffer() of
the need to string-search the .index

Rewrite the table of contents page after deleting an entry

This commit also retains profiling, as a reminder to me how I used it,
and the old linear search code. The timing blocks and the old code may
be deleted in a future commit
2018-03-06 20:40:12 +00:00
Matt Mascarenhas ab598e37e6 cinera_player_pre.js: Reenable YT interaction
Essentially, the previous change prevented the marker progress code from
firing if the user only interacts with the YouTube player directly.

cinera.c: Try to curl the quotes in, rather than straight up deleting
them, if(ShouldFetchQuotes)
2018-02-28 20:18:11 +00:00
Matt Mascarenhas 6f99a50f50 cinera_player_pre.js: Only resume() if playing 2018-02-28 01:25:50 +00:00
Matt Mascarenhas e7aefbada0 cinera.css: Marker and categories style
cinera_player_pre.js: Episode keyboard navigation. Also swap out A for
K, and D for J
cinera_player_pre.js: Handle the case in onRefChanged() in which the
filter_container or filterState is not present
cinera.c: Refetch quotes when processing a set of annotations >60 mins
after the last fetch

Flags:
    -w Force quote cache rebuild
2018-02-28 01:04:06 +00:00
Matt Mascarenhas 2cac3ed03b cinera.c: Add <!-- __CINERA_CUSTOMn__--> tags
Also compress the template code

cinera_player_pre.js: Fix bug in which onRefChanged() tried to call
player.jumpToNextMarker(); before the player was ready. This could
happen if its first marker's timecode is 0:00 and medium is :afk

Enable Theatre mode to work in containers styled with max-width or
max-height
2018-02-23 23:36:42 +00:00
Matt Mascarenhas c5bc487313 cinera.c: Prev / Next Episode Links
Also fix the inotify loop, augment the index (the .metadata files) to
contain data useful for insobot, and futureproof UpgradeDB()

Flags:

    * -e Examine Index
        Just pop an -e on the end of your usual list of flags
    * -u Update Interval (was -U)
2018-02-21 21:50:23 +00:00
Matt Mascarenhas c7762a0f7d cinera.css: Let cinera__*.css colour the indicator 2018-02-12 22:39:27 +00:00
Matt Mascarenhas 87e63a54e7 cinera.css: Index a:visited style 2018-02-12 21:54:28 +00:00
Matt Mascarenhas 9d9d8a6332 cinera.c: Validate timecode chronology
Also correctly skip .hmml files for credentials-related reasons
2018-02-05 23:57:17 +00:00
Matt Mascarenhas 1603245fad cinera.c: HTTPS for Miblo's HomepageURL 2018-02-04 21:52:32 +00:00
Matt Mascarenhas bd590d4c07 cinera.c: Miblo pledge credentials 2018-02-04 20:04:01 +00:00
Matt Mascarenhas e5d592dc11 cinera_search.js: Remove console.log 2018-01-28 21:57:35 +00:00
Matt Mascarenhas 0f27c96b29 cinera_search.js: Prevent crashes caused by | 2018-01-28 21:56:40 +00:00
Matt Mascarenhas 3d7add5b66 cinera: Handle sorting state separately from UI
Also add user-select: none
2018-01-21 19:30:54 +00:00
Matt Mascarenhas d7d27f59b7 cinera: Sortable index 2018-01-21 18:59:09 +00:00
Matt Mascarenhas b8013133b9 cinera: Fix theatre and add GUI clickable for it 2018-01-17 20:15:00 +00:00
Matt Mascarenhas f270ee2afa cinera: Theatre Mode
This also changes the hardcoded, unintegrated output to wrap cineraMenus
and cineraPlayerContainer in a <div>, as newly reflected in the example
template_player.html
2018-01-15 21:52:24 +00:00
Matt Mascarenhas 5e7029d2b0 cinera: Tweak filter
Introduce nullTopic, visually represent the media in annotations and
default to "exclusive" mode
2018-01-15 00:03:11 +00:00
Matt Mascarenhas 78861a1c78 cinera.css: Better behaving search .css
Keeps the results looking more consistent between various display widths
2018-01-12 23:26:07 +00:00
Matt Mascarenhas 93fa77b055 cinera.c: Correct template buffers
The template buffers no longer contain indentation spaces at the start
or a \n at the end. This removes any weirdness from template composition

Also remove the cleanup code added in 0.5.22
2018-01-08 22:59:36 +00:00
Matt Mascarenhas 6b1156292c cinera.c: Fix index reinsertion bug 2018-01-08 20:04:22 +00:00
Matt Mascarenhas acbe38b01f cinera.c: Fix 0.5.20 more correctly
The actual bug was that MarkerIndex wasn't being incremented for
HMML_CATEGORY markers mid-annotation... (HMML_MEMBER and HMML_PROJECT
were fine.)
2018-01-06 00:00:05 +00:00
Matt Mascarenhas b55f20dcb1 cinera.c: Keep non-topics out of cinera_topics.css
You would find @members and ~projects ending up in cinera_topics.css if
they were preceded by a topic :category in their annotation
2018-01-05 23:47:00 +00:00
Matt Mascarenhas 7d88e3c17d cinera.c: Only build search if != Single Edition 2018-01-05 20:03:02 +00:00
Matt Mascarenhas c1d6c87746 cinera.c: Bespoke template in Single Edition
Also fail gracefully if supplied with an .hmml file containing an
incomplete [video] node, or a template containing tags whose buffers
cannot be populated
2018-01-04 20:55:51 +00:00
Matt Mascarenhas 8f37ce0b76 cinera.c: Video-specific medium and template
Remove environment variable CINERA_INTEGRATE because this is meaningless
now that the default template locations are blank

Flags
    -t Template Directory (was Player Template Location)
    -y Player Template Location

Bug Fixes
    Correctly skip annotation sets that couldn't be processed for
    various reasons
    Fix crash caused by <!-- __CINERA_INDEX__ --> tag in a player
    template, because its buffer was being freed
    Fix 2048 bytes leak per processed set of annotations
2018-01-03 22:16:20 +00:00
Matt Mascarenhas f1e39e0513 cinera.c: Namespace .text to .cineraText 2017-12-29 16:00:44 +00:00
Matt Mascarenhas f6b85b5958 cinera.c: Enforce superscription of <sup> elements 2017-12-24 17:16:08 +00:00
Matt Mascarenhas e4c1446256 cinera.c: Call MakeDir() in GenerateTopicColours() 2017-12-24 01:57:11 +00:00
Matt Mascarenhas 120290b398 cinera.c: Support a combination of modes
Specifically, with the addition of MODE_ONESHOT in v0.5.12 we must allow
for the possibility of being in both that mode and MODE_INTEGRATE
2017-12-18 15:10:02 +00:00
Matt Mascarenhas 4a954b6ac6 cinera.c: Add -q flag
This sets cinera to "oneshot mode" which makes a Project Edition instance
quit after syncing from annotation files in project input directory
2017-12-18 14:31:05 +00:00
Matt Mascarenhas 1bbdf5aea4 cinera: Fix bug in image URL prefix construction 2017-12-18 00:15:03 +00:00
Matt Mascarenhas 153d14a810 cinera.c: Update Credentials array 2017-12-17 20:44:00 +00:00
Matt Mascarenhas 0aa585a15d cinera: Allow custom output paths
Relative to the Base:
    -a sets the player location
    -n sets the index location

Tweak flags, and add -B to set Base URL (necessary if setting -a or -n)

New template tags:
    __CINERA_URL__
    __CINERA_VIDEO_ID__

Bump DB version: 2
    index_header now contains the Index and Player Locations
2017-12-12 23:24:10 +00:00
Matt Mascarenhas 7312de5691 cinera: SendOwl 2017-12-10 17:29:00 +00:00
Matt Mascarenhas f7b3e6ffe2 cinera.css: Help z-index increase 2017-12-10 17:15:37 +00:00
Matt Mascarenhas fda3ee819b cinera: More namespacing and style tweak 2017-12-10 17:05:46 +00:00
Matt Mascarenhas f07cc87629 cinera.c: Namespacing 2017-12-10 00:17:19 +00:00
Matt Mascarenhas 9ce24be33a cinera_player_post.js: Mouse nav in quotes menu 2017-12-08 01:04:59 +00:00
Matt Mascarenhas 6f751dd2b2 cinera.c: Add support for alternative URL prefixes
This is hardcoded for now, for ease of use, pending the config system

Also add Medium to the ProjectInfo array, to save users having to set
this with -m (which option remains available to them)

Reorganise the CSS, Images and JS files back to their location in the
same directory, since a default invocation of the program assumes they
are in the same directory as the Root Directory, to hopefully alleviate
some potential user frustration thanks to the requirement to set their
locations (with -c, -i and -j) before any usable output is produced
2017-12-07 21:07:36 +00:00
Matt Mascarenhas f454e01e28 Add -s flag, project info and CINERA_PROJECT tag
-s flag sets the style / theme
Also some general code clean-up and repo organisation
2017-12-07 01:15:13 +00:00
Matt Mascarenhas 24f02aec93 cinera.c: Add csnover credential 2017-12-03 18:25:20 +00:00
Matt Mascarenhas 75f65e561d cinera.c: Add powerc9000 credential 2017-12-03 18:14:19 +00:00
Matt Mascarenhas 0f38660b2e cinera.c: Add cbloom credential for Handmade Hero 2017-12-03 00:55:01 +00:00
Matt Mascarenhas 50e2880d1b cinera.c: Add credentials for Handmade Hero 2017-12-03 00:47:27 +00:00
Matt Mascarenhas 1636c5fa14 cinera: Add :multimedia and :hat
hmdshow_2016_03 uses :multimedia
Various riscy and hero annotations may use :hat
2017-11-28 23:02:00 +00:00
Matt Mascarenhas 1b241ddcfe cinera.c: Add credentials and -v flag
README.md: Add dependency on curl
2017-11-18 00:27:33 +00:00