I decided to take a stab at this, however after running the script on MacOS, I get the following âtest.rb:1: syntax error, unexpected backslash, expecting '}'
{\rtf1\ansi\ansicpg1252\cocoart...â.
My Ruby script is:
require 'httparty'
require 'json'
server_url = 'http://192.168.1.100:8089'
video_group = 'VIDEO_GROUP_ID'
source_files = HTTParty.get("#{server_url}/dvr/groups/#{video_group}/files")
source_files.each do |file|
file_id = file['ID']
title = file['Airing']['EpisodeTitle']
yt_match = title.match(/(((\d\d\d\d-\d\d-\d\d)))??[(.*)]/)
if yt_match
yt_date = yt_match[2]
yt_id = yt_match[3]
yt_thumbnail_url = "https://i3.ytimg.com/vi/#{yt_id}/maxresdefault.jpg"
new_title = title.gsub(yt_match[0], '')
package = {Thumbnail: yt_thumbnail_url, Airing: {EpisodeTitle: new_title}}
if yt_date
package[:Airing][:OriginalDate] = yt_date
end
HTTParty.put("#{server_url}/dvr/files/#{file_id}", :body => package.to_json)
end
end
Any thoughts?