Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library .vha structure and format #29

Closed
cal2195 opened this issue Dec 19, 2018 · 4 comments
Closed

Library .vha structure and format #29

cal2195 opened this issue Dec 19, 2018 · 4 comments
Assignees
Labels
discussion Thoughts and ideas enhancement Improves existing features
Milestone

Comments

@cal2195
Copy link
Collaborator

cal2195 commented Dec 19, 2018

The current .vha file structure is a json of the following:

export interface FinalObject {
  hubName: string;      // the name of the hub -- for recently-opened
  ssSize: number;       // screen shot size -- so when you reimport it remembers your preference
  numOfFolders: number; // number of folders
  inputDir: string;     // later may support array of many input directories
  addTags?: string[];    // tags to add
  removeTags?: string[]; // tags to remove
  images: ImageElement[]; // see below
}

export type ImageElement = [string, string, string, string, number, string, number, number];
/*                            0       1       2       3       4       5       6       7
-------------------------------------------------------------------------------------------------------
index   type      description                   more info
-----   ------    -------------------------------------------------------------------------------------
  0     string    partial path to file,    <--- for opening the file, just prepend the `inputDir`
  1     string    full original file name, <--- for opening the file
  2     string    file name cleaned
                  of dots, underscores,
                  and file extension       <--- for searching
  3     string    hash of the file         <--- used for detecting changed files and as a screenshot
                                                identifier
  4     number    duration                 <-- duration of film as number
  5     string    depicting size           <-- e.g. `720`, `1080`, `SD`, `HD`
  6     number    width of screenshot      <-- e.g 124 etc
  7     number    fileSize in megabytes    <-- rounded to nearest MB

*/

Why are ImageElements arrays, rather than objects, so we could do ImageElement.duration?

If it's to save space in the saved file, we could compress the file (which would work very well due to the duplicated values across files eg. object names, input folder, resolution, width) at the cost of slightly less easy manual editing of the file?

Alternatively, using constants like PATH_TO_FILE=0, FILENAME=1 so we can easily index the array would be nice!

Let me know if I'm misunderstanding something! 😄

@cal2195 cal2195 added enhancement Improves existing features discussion Thoughts and ideas labels Dec 19, 2018
@cal2195 cal2195 added this to the v2.0.0 milestone Dec 19, 2018
@whyboris
Copy link
Owner

I started out the structure out of convenience; resisted making the elements into objects (rather than arrays) because of redundant information that would be stored in the .vha file. Compression would solve that of course. If we use compression, I'd prefer the simplest zip compression so users could unzip, edit, and re-zip if needed.

I like the constants idea - makes the code easier to read than foo[4], but I'm also happy to change the structure to an array of objects. I'm also fine with keeping things as is -- what do you see as the biggest benefit(s) of changing?

The main down side would be no backwards compatibility unless we write a conversion script.

@cal2195
Copy link
Collaborator Author

cal2195 commented Dec 19, 2018

I agree about using .zip (similar to .jar files). It was this ability that allowed #6 to be solved with a workaround before changing the code! 👍

While it would remove backwards compatibility, we're already giving that up with v2.0.0! And it would have a massive upside - future compatibility! 🚀 As field are named, we can add new ones, and old files just won't have any values for them, which we can account for in the code!

I think this trade off is worth it! 👍

@whyboris
Copy link
Owner

I do like objects better than idiosyncratically rigidly ordered arrays 😅

I'm happy with a backwards-compatibility-breaking refactor.

@whyboris
Copy link
Owner

whyboris commented Jan 3, 2019

Closed with PR #49 - thank you @cal2195 🙇

@whyboris whyboris closed this as completed Jan 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Thoughts and ideas enhancement Improves existing features
Projects
None yet
Development

No branches or pull requests

2 participants