Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

Add file and page tags to the cache file #281

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

adisney
Copy link

@adisney adisney commented Dec 4, 2022

I'm working on a personal project that will require inspecting files that have specific tags on them. As a part of doing that, I have modified rmapi to include the names of the tags that have been applied to the top level file or to specific pages within a file.

This may address some what is desired in issue #249.

The file tags are in the fileTags field.

"fileTags": [
    {
        "name": "Daily",
        "timestamp": 1655955509272
    }
]

The page tags are in the pageTags field.

"pageTags": [
    {
        "name": "Planning",
        "pageId": "016892c0-1a4c-44e2-93d3-23b1f111a858",
        "timestamp": 1670176484275
    }
]

The updated cache file entry for a file with tags will look like the following:

{
    "coverPageNumber": 0,
    "documentMetadata": {
    },
    "dummyDocument": false,
    "extraMetadata": {
        "LastBallpointColor": "Black",
        "LastBallpointSize": "2",
        "LastBallpointv2Color": "Black",
        "LastBallpointv2Size": "2",
        "LastCalligraphyColor": "Black",
        "LastCalligraphySize": "2",
        "LastClearPageColor": "Black",
        "LastClearPageSize": "2",
        "LastEraseSectionColor": "Black",
        "LastEraseSectionSize": "2",
        "LastEraserColor": "Black",
        "LastEraserSize": "1",
        "LastEraserTool": "EraseSection",
        "LastFinelinerColor": "Black",
        "LastFinelinerSize": "2",
        "LastFinelinerv2Color": "Black",
        "LastFinelinerv2Size": "2",
        "LastHighlighterColor": "Black",
        "LastHighlighterSize": "2",
        "LastHighlighterv2Color": "Black",
        "LastHighlighterv2Size": "2",
        "LastMarkerColor": "Black",
        "LastMarkerSize": "2",
        "LastMarkerv2Color": "Black",
        "LastMarkerv2Size": "3",
        "LastPaintbrushColor": "Black",
        "LastPaintbrushSize": "2",
        "LastPaintbrushv2Color": "Gray",
        "LastPaintbrushv2Size": "3",
        "LastPen": "Ballpointv2",
        "LastPencilColor": "Black",
        "LastPencilSize": "2",
        "LastPencilv2Color": "Black",
        "LastPencilv2Size": "2",
        "LastReservedPenColor": "Black",
        "LastReservedPenSize": "2",
        "LastSelectionToolColor": "Black",
        "LastSelectionToolSize": "2",
        "LastSharpPencilColor": "Black",
        "LastSharpPencilSize": "2",
        "LastSharpPencilv2Color": "Black",
        "LastSharpPencilv2Size": "2",
        "LastSolidPenColor": "Black",
        "LastSolidPenSize": "2",
        "LastTool": "SelectionTool",
        "LastUndefinedColor": "Black",
        "LastUndefinedSize": "2",
        "LastZoomToolColor": "Black",
        "LastZoomToolSize": "2"
    },
    "fileType": "notebook",
    "fontName": "",
    "formatVersion": 1,
    "lineHeight": -1,
    "margins": 100,
    "orientation": "portrait",
    "originalPageCount": -1,
    "pageCount": 5,
    "pageTags": [
        {
            "name": "Planning",
            "pageId": "016892c0-1a4c-44e2-93d3-23b1f111a858",
            "timestamp": 1670176484275
        }
    ],
    "pages": [
        "701d6ba6-c3cc-4bb2-9424-c6fe546979f8",
        "5527ba53-ef9f-4b5d-a35a-1cb768608567",
        "016892c0-1a4c-44e2-93d3-23b1f111a858",
        "37b227c5-6f06-44a9-a175-94ff0018b988",
        "64124558-0ae7-40ef-96b4-b054ad34aa82"
    ],
    "redirectionPageMap": [
    ],
    "sizeInBytes": "3389175",
    "fileTags": [
        {
            "name": "Daily",
            "timestamp": 1655955509272
        }
    ],
    "textAlignment": "left",
    "textScale": 1
}

@faroit
Copy link

faroit commented Dec 17, 2022

@adisney this looks great to me

}
err = json.Unmarshal(content, &contentFile)
if err != nil {
log.Error.Printf("cannot read content %s %v", fileEntry.DocumentID, err)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we return the error here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I should have done that initially. Updated.

@Azeirah
Copy link

Azeirah commented Jul 26, 2023

@adisney I know this is an old pull request, but how do I access the tags from the interface or from the ctx *ShellCtxt?

It doesn't show up in stat and from what I can tell as someone with little go experience it's not part of the node either.

Note, I ported this PR to the current main branch as it didn't work as-is, probably because of updates to the API. The variables are present on the blob document but I have no idea how to access them.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants