How do I make an app to get a video by url from youtube download it / process it/ and uploaded to a local db?
I liked the shrine tutorials and would like to use that as an upload to local disk solution.
I also found a gem called youtube-dl (https://github.com/layer8x/youtube-dl.rb) to help download from Youtube.
I have no clear idea about how to combine the two gems into a solution (user puts in url -> video is being downloaded and uploaded to local db)
For the most part, you can just plug in Shrine by opening up a File object in Ruby and then assigning it to the shrine attribute and calling save. That's basically the same process that Shrine uses on a browser upload so there is little to no difference to do this from an already downloaded file.
download = File.open("PATHTOFILE", "rb") @record = Record.where(youtube_id: ID).first_or_create @record.video = download @record.save
You might need to delete the file you downloaded once this is complete so you don't have duplicate files on disk.