From 026cfa6d20c186c69125212fd439eb100b445c96 Mon Sep 17 00:00:00 2001
From: Joe Rayhawk <jrayhawk@omgwallhack.org>
Date: Tue, 22 May 2018 18:52:03 -0700
Subject: lstwitchvid: add uploads

---
 lstwitchvid.rb | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/lstwitchvid.rb b/lstwitchvid.rb
index fc269d1..ecef766 100755
--- a/lstwitchvid.rb
+++ b/lstwitchvid.rb
@@ -4,9 +4,9 @@
 require 'json'
 require 'net/http'
 
-user = String.new
+channel = String.new
 
-user = URI.escape(ARGV[0])
+channel = URI.escape(ARGV[0])
 
 broadcasts = String.new
 
@@ -27,14 +27,14 @@ if width < 97
   width=97
 end
 
-def videos(http, path, width, broadcasts, client_id)
+def videos(http, channel, width, broadcast_type, client_id)
 
   total = 100
   offset = 0
   
   while offset <= total
   
-    response = JSON.parse(http.request(Net::HTTP::Get.new("#{path}?limit=100&offset=#{offset}&broadcasts=#{broadcasts}&client_id=#{client_id}")).body)
+    response = JSON.parse(http.request(Net::HTTP::Get.new("/kraken/channels/#{channel}/videos/?limit=100&offset=#{offset}&broadcast_type=#{broadcast_type}&client_id=#{client_id}")).body)
     if response['videos']
     total = response['_total']
       for video in response['videos']
@@ -48,10 +48,22 @@ def videos(http, path, width, broadcasts, client_id)
 
 end
 
-print("Highlights:\n\n")
+def clips( http, channel, width, client_id )
+  #-H 'Accept: application/vnd.twitchtv.v5+json'
+  #https://api.twitch.tv/kraken/clips/top?client_id=$( cat ~/.config/twitch/client_id )&channel=bungmonkey&period=all&trending=false&limit=100
+end
+
+print("Clips:\n\n")
+
+
+print("\nUploads:\n\n")
+
+videos( http, channel, width, 'upload', client_id )
+
+print("\nHighlights:\n\n")
 
-videos(http, "/kraken/channels/#{user}/videos/", width, false, client_id)
+videos( http, channel, width, 'highlight', client_id )
 
 print("\nBroadcasts:\n\n")
 
-videos(http, "/kraken/channels/#{user}/videos/", width, true, client_id)
+videos( http, channel, width, 'archive', client_id )
-- 
cgit v1.2.3