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

Make proxy media filenames content-adressable #76

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

Make proxy media filenames content-adressable #76

wants to merge 2 commits into from

Conversation

Cmdv
Copy link
Contributor

@Cmdv Cmdv commented Jan 8, 2019

Description:

This pull requests fixes #24

Make sure to describe (where applicable):

  • imported video proxy naming is a combination of an original filename and randomly generated SHA1
  • GUI changes, preferably with screenshots none
  • Breaking changes none
  • Changed dependencies, Haskell or system ones
  • How it has been verified/tested manually but technically createSHA1BaseName could be tested to make sure given the same file name different SHA's are created, would that suffice?

Checklist:

Please make sure to check the following items (that are applicable.)

  • Doesn't duplicate any existing PR
  • Automated tests added
  • Includes relevant user guide/documentation changes

How to test:
import new video file and look at the command line output to see the naming of files should be as follows:
screenshot 2019-01-08 at 20 12 00

TODO: Testing instructions for reviewer.
I split this functionality out into its own file as I was unsure where it could live. This is because the function could also be used with #72

@Cmdv
Copy link
Contributor Author

Cmdv commented Jan 8, 2019

I may need tips regards to how I would write a test for this, I was thinking literally making sure calling the function twice with the same name returns different SHAs? 😸

@Cmdv
Copy link
Contributor Author

Cmdv commented Jan 10, 2019

I ended up working it out, but I'm unsure if that single test is enough it just makes sure calling the function twice returns different SHAs

Copy link
Owner

@owickstrom owickstrom left a comment

Choose a reason for hiding this comment

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

Hey, thanks for the PR! Sorry, maybe I should have written a bit more clear description. Using the term "avoiding collisions" was a bit misleading.

We need the hashing to work the other way around, i.e. it should be deterministic with respect to the file contents. Two files with same contents (regardless of where they're stored on the file system and with what name) should always produce the exact same hash. So if you'd reimport a file, the proxy media would already be there and we could short-cirtcuit that conversion instead of doing it once again.

@Cmdv
Copy link
Contributor Author

Cmdv commented Jan 11, 2019

Ah ok so is it a case of just removing this randomising part of the function?

@owickstrom
Copy link
Owner

Removing the randomness and using file contents, rather than file name, as the hash input.

@Cmdv
Copy link
Contributor Author

Cmdv commented Jan 15, 2019

@owickstrom I've tried to research how to Hash a file content in Haskell, but I'm not aquatentced on the subject overall so not been able to work out what needs to be done.

If you have any pointers that would be great 👍

@Cmdv
Copy link
Contributor Author

Cmdv commented Jun 12, 2019

@owickstrom totally forgot I was doing this!! is this still a valid PR and if so did you have any idea into hashing a file with Haskell?

@owickstrom
Copy link
Owner

Hey @Cmdv! No worries, but feel free to pick this up again if you'd like. I don't have any pointers for you right now, but if I find some time I'll try to post some links.

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.

Make proxy media filenames content-adressable
2 participants