Last active
June 28, 2021 22:09
-
-
Save XanderStrike/772686f5d2adedfa3a07c07c13e48f09 to your computer and use it in GitHub Desktop.
Revisions
-
XanderStrike revised this gist
Jan 3, 2021 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # fillgaps.rb # Alex Standke 2021 # # Requirements: # * You must have Gaps and Ombi set up and running @@ -10,7 +10,7 @@ # # Use: # * Modify the four variables below # * Optionally remove the line at the bottom to avoid being prompted for every movie # * Run! GAPS_RSS="" -
XanderStrike created this gist
Jan 3, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,64 @@ #!/usr/bin/env ruby # fillgaps.rb # Alex Standke 2020 # # Requirements: # * You must have Gaps and Ombi set up and running # * https://github.com/JasonHHouse/gaps # * https://github.com/tidusjar/Ombi # # Use: # * Modify the four variables below # * Optionally uncomment the line at the bottom to be prompted to confirm each film # * Run! GAPS_RSS="" OMBI_API_KEY="" OMBI_USER="" OMBI_URL="" require 'net/http' require 'json' require 'cgi' def getJSON(url, method: Net::HTTP::Get, body: "") uri = URI(url) req = method.new(uri) req.body = body req['Accept'] = 'application/json' req['Content-Type'] = 'application/json' req['ApiKey'] = OMBI_API_KEY req['UserName'] = OMBI_USER res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') {|http| http.request(req) } JSON.parse(res.body) end def request(movie) route = "#{OMBI_URL}/api/v1/Search/movie/#{CGI.escape(movie["title"])}" id = getJSON(route).first["theMovieDbId"] body = { theMovieDbId: id, languageCode: 'en' } route = "#{OMBI_URL}/api/v1/Request/movie" response = getJSON(route, method: Net::HTTP::Post, body: body.to_json) print response["message"], response["errorMessage"], "\n" end someJson = getJSON(GAPS_RSS) puts "#{someJson.count} missing movies identified" someJson.each do |movie| print "Request #{movie['title']}..." next unless gets.downcase.start_with?('y') # remove this line to add em all request(movie) end