#!/usr/bin/python

import requests
import argparse


def get_se_channel(twitch_channel):
    response = requests.get('https://api.streamelements.com/kappa/v2/channels/' + twitch_channel)
    response.raise_for_status()
    json = response.json()
    display_name = json['displayName']
    se_channel = json['_id']
    print("Found channel {} with StreamElements channel ID {}".format(display_name, se_channel))
    return se_channel


def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("--channel", "-c", type=str, required=True, help="Twitch channel name (lowercase)")
    args = parser.parse_args()

    twitch_channel = args.channel
    se_channel = get_se_channel(twitch_channel)

    request = requests.get('https://api.streamelements.com/kappa/v2/store/{}/items'.format(se_channel))
    request.raise_for_status()
    se_playsounds = request.json()

    print()
    print()
    print()

    for se_playsound in se_playsounds:
        name = se_playsound["bot"]["identifier"]
        link = se_playsound["alert"]["audio"]["src"]
        volume = int(se_playsound["alert"]["audio"]["volume"] * 100)
        cooldown = se_playsound["cooldown"]["user"]
        enabled = se_playsound["enabled"]


        print("!add playsound {name} {link} --volume {volume} --cooldown {cooldown}{disabled}".format(
            name=name,
            link=link,
            volume=volume,
            cooldown=cooldown,
            disabled="" if enabled else " --disabled"
        ))

    print()
    print()
    print()
    print("Done listing.")
    print("Copy paste this list into a pastebin and then run "
          "\"!eval bot.eval_from_file(event, 'https://pastebin.com/raw/link')\"")


if __name__ == '__main__':
    main()

@@ -8,14 +8,35 @@
 bin/
+env 
 python
+3%0Aimport argparse
 %0A%0Aim
@@ -49,32 +49,16 @@
 equests%0A
-import argparse%0A
 %0A%0Adef ge
@@ -107,33 +107,42 @@
  = requests.get(
-'
+%0A        %22
 https://api.stre
@@ -174,17 +174,17 @@
 hannels/
-'
+%22
  + twitc
@@ -192,16 +192,21 @@
 _channel
+%0A    
 )%0A    re
@@ -282,17 +282,17 @@
  = json%5B
-'
+%22
 displayN
@@ -294,17 +294,17 @@
 playName
-'
+%22
 %5D%0A    se
@@ -323,13 +323,13 @@
 son%5B
-'_id'
+%22_id%22
 %5D%0A  
@@ -336,16 +336,25 @@
   print(
+%0A        
 %22Found c
@@ -405,16 +405,29 @@
 .format(
+%0A            
 display_
@@ -434,33 +434,47 @@
 name, se_channel
-)
+%0A        )%0A    
 )%0A    return se_
@@ -558,16 +558,25 @@
 rgument(
+%0A        
 %22--chann
@@ -583,14 +583,30 @@
 el%22,
- %22-c%22,
+%0A        %22-c%22,%0A       
  typ
@@ -611,16 +611,24 @@
 ype=str,
+%0A       
  require
@@ -634,16 +634,24 @@
 ed=True,
+%0A       
  help=%22T
@@ -681,16 +681,22 @@
 ercase)%22
+,%0A    
 )%0A    ar
@@ -831,17 +831,26 @@
 sts.get(
-'
+%0A        %22
 https://
@@ -895,17 +895,17 @@
 %7B%7D/items
-'
+%22
 .format(
@@ -915,16 +915,21 @@
 channel)
+%0A    
 )%0A    re
@@ -1331,17 +1331,16 @@
 bled%22%5D%0A%0A
-%0A
         
@@ -1345,16 +1345,29 @@
   print(
+%0A            
 %22!add pl
@@ -1455,24 +1455,28 @@
             
+    
 name=name,%0A 
@@ -1482,24 +1482,28 @@
             
+    
 link=link,%0A 
@@ -1501,16 +1501,20 @@
 k=link,%0A
+    
         
@@ -1536,32 +1536,36 @@
 me,%0A            
+    
 cooldown=cooldow
@@ -1579,16 +1579,20 @@
         
+    
 disabled
@@ -1624,17 +1624,22 @@
 isabled%22
-%0A
+,%0A    
         
@@ -1639,16 +1639,25 @@
        )
+%0A        
 )%0A%0A    p
@@ -1724,16 +1724,25 @@
   print(
+%0A        
 %22Copy pa
@@ -1786,18 +1786,16 @@
 n run %22%0A
-  
         
@@ -1864,16 +1864,21 @@
 ink')%5C%22%22
+%0A    
 )%0A%0A%0Aif _
@@ -1892,17 +1892,17 @@
  == 
-'
+%22
 __main__
 ':%0A 
@@ -1897,17 +1897,17 @@
 __main__
-'
+%22
 :%0A    ma

reformat streamelements playsound import script