feat: Add YAML support for added / modified metadata #37

Merged
prologic merged 3 commits from gumbo2000/tube:master into master 6 days ago

This change introduces the ability to read additional
or modified metadata like title or description from a
YAML file.
Just like thumbnails are read from "filename.jpg", we now
look for "filename.yml" and override the meta data that
is embedded in the video file.

This is my very first look at golang, so please tell me if, or rather "where" I went wrong. ;-)

This change introduces the ability to read additional or modified metadata like title or description from a YAML file. Just like thumbnails are read from "filename.jpg", we now look for "filename.yml" and override the meta data that is embedded in the video file. This is my very first look at golang, so please tell me if, or rather "where" I went wrong. ;-)
gumbo2000 added 1 commit 1 week ago
e237bd5563 feat: Add YAML support for added / modified metadata
Poster

Most of the files I'd like to handle with "tube" are recordings of internal developer trainings or company meetings.

I have no tools to manipulate the meta data directly.

Adding yaml suppert seemd to be the easiest way to allow developers and slightly tech-savy users to annotate the videos.

If you consider merging this PR, I can also update the documentation.

Most of the files I'd like to handle with "tube" are recordings of internal developer trainings or company meetings. I have no tools to manipulate the meta data directly. Adding yaml suppert seemd to be the easiest way to allow developers and slightly tech-savy users to annotate the videos. If you consider merging this PR, I can also update the documentation.
Owner

@gumbo2000 This is pretty interseeting idea 👌 I'll have a closer look at this tonight (I'm in AEST or +10 UTC).

Q: Is there another commonly used "text"(ish) format that is more commonly/widely used other than YAML here? I don't mind the YAML of course, but more of a general question...

@gumbo2000 This is pretty interseeting idea 👌 I'll have a closer look at this tonight (I'm in AEST or +10 UTC). Q: Is there another commonly used "text"(ish) format that is more commonly/widely used other than YAML here? I don't mind the YAML of course, but more of a general question...
Poster

Using an external file for meta data, we could easily make metadata editable from the web interface. This obviously opens a can of worms when we care about security, as user-supplied data can be full of nasty things. Things that try to break the yaml file would be be the harmless end of the spectrum, while XSRF attacks are less so.

@prologic Regarding the text format... There are other text(ish) formats that are used for media meta data, but I don't know of any text format that dominates the scene.
Kodi for example is uses an xml format for its ".nfo" files.
We also could support json as json is already used by tube.
Both are ok but I prefer yml as it contains less "syntactic sugar" and looks less scary to new users.

I also was thinking about a way to make the handling of meta data a bit more flexible. Maybe I can refactor the existing ParseVideo function to extract the handling of "content" meta data (title, description,...) from "technical" meta data (path, filesize, ...)
Then we could make it easier to add other sources of metadata. (Kodi databases maybe or whatever somebody wants to add).

Using an external file for meta data, we could easily make metadata editable from the web interface. This obviously opens a can of worms when we care about security, as user-supplied data can be full of nasty things. Things that try to break the yaml file would be be the harmless end of the spectrum, while XSRF attacks are less so. @prologic Regarding the text format... There are other text(ish) formats that are used for media meta data, but I don't know of any text format that _dominates_ the scene. Kodi for example is uses an xml format for its ".nfo" files. We also could support json as json is already used by tube. Both are ok but I prefer yml as it contains less "syntactic sugar" and looks less scary to new users. I also was thinking about a way to make the handling of meta data a bit more flexible. Maybe I can refactor the existing `ParseVideo` function to extract the handling of "content" meta data (title, description,...) from "technical" meta data (path, filesize, ...) Then we could make it easier to add other sources of metadata. (Kodi databases maybe or whatever somebody wants to add).
gumbo2000 reviewed 1 week ago
media/video.go Outdated
Views int64
}
func GetTagsFromYml(p *Path, filename string, v *Video) (*Video, error) {
Poster

As you can see in the signature of that function, I was playing around with the arguments a bit, and didn't finish cleaning it up.

Is there any downside to passing the pointer to the Video struct instead of path and filename?

And what about the return value? I return the same pointer but that is just a relic.

As you can see in the signature of that function, I was playing around with the arguments a bit, and didn't finish cleaning it up. Is there any downside to passing the pointer to the Video struct instead of path and filename? And what about the return value? I return the same pointer but that is just a relic.
gumbo2000 added 1 commit 7 days ago
cc8ae33185 refactor: Remove unnecessary parameters
gumbo2000 added 1 commit 7 days ago
c223519f7b refactor: Make getTagsFromYml private
prologic approved these changes 6 days ago
prologic left a comment
Owner

Works for me 👌 Let's merge and continue iterating 👌

Works for me 👌 Let's merge and continue iterating 👌
prologic merged commit 7a4ef5b6df into master 6 days ago

Reviewers

prologic approved these changes 6 days ago
continuous-integration/drone/pr Build is passing
The pull request has been merged as 7a4ef5b6df.
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: prologic/tube#37
Loading…
There is no content yet.