Difference between revisions of "Stream Scene Share"
From kunz
Views
Actions
Namespaces
Variants
Tools
Line 1: | Line 1: | ||
<syntaxhighlight lang='python'> | <syntaxhighlight lang='python'> | ||
import re, | import re, urllib | ||
url = 'http://hip.johnkunz.com/ttv/' | url = 'http://hip.johnkunz.com/ttv/' | ||
html = urllib.request.urlopen(url).read() | html = urllib.request.urlopen(url).read() | ||
Line 18: | Line 18: | ||
import re | import re | ||
try: | try: | ||
import | import urllib | ||
html = urllib.request.urlopen(url).read() | html = urllib.request.urlopen(url).read() | ||
except ImportError: | except ImportError: | ||
Line 29: | Line 29: | ||
<syntaxhighlight lang='python'> | <syntaxhighlight lang='python'> | ||
import re | import re | ||
# Get list of files | # Get list of files | ||
url = 'http:// | url = 'http://hip.johnkunz.com/ttv/' | ||
html = urllib2.urlopen(url).read() | try: | ||
import urllib | |||
html = urllib.request.urlopen(url).read() | |||
except ImportError: | |||
import urllib2 | |||
html = urllib2.urlopen(url).read() | |||
hipfile = sorted( re.findall(r'href=[\'"]?([^\'" >]+)', html )[5:], reverse=True) | hipfile = sorted( re.findall(r'href=[\'"]?([^\'" >]+)', html )[5:], reverse=True) | ||
# Select file from list inside Houdini | # Select file from list inside Houdini selection window | ||
mySelection=hou.ui.selectFromList(hipfile, default_choices=(), exclusive=True, message="Twitch.tv/JohnKunz Stream Files", title="Select File", column_header="Choices", num_visible_rows=10, clear_on_cancel=False, width=0, height=0) | mySelection=hou.ui.selectFromList(hipfile, default_choices=(), exclusive=True, message="Twitch.tv/JohnKunz Stream Files", title="Select File", column_header="Choices", num_visible_rows=10, clear_on_cancel=False, width=0, height=0) | ||
Revision as of 03:24, 1 October 2021
import re, urllib url = 'http://hip.johnkunz.com/ttv/' html = urllib.request.urlopen(url).read() hip = sorted( re.findall(r'href=[\'"]?([^\'" >]+)', html )[5:], reverse=True)[0] hou.hipFile.merge(url+hip)
import re, urllib2 url = 'http://hip.johnkunz.com/ttv/' html = urllib2.urlopen(url).read() hip = sorted( re.findall(r'href=[\'"]?([^\'" >]+)', html )[5:], reverse=True)[0] hou.hipFile.merge(url+hip)
import re try: import urllib html = urllib.request.urlopen(url).read() except ImportError: import urllib2 html = urllib2.urlopen(url).read() hip = sorted( re.findall(r'href=[\'"]?([^\'" >]+)', html )[5:], reverse=True)[0] hou.hipFile.merge(url+hip)
import re # Get list of files url = 'http://hip.johnkunz.com/ttv/' try: import urllib html = urllib.request.urlopen(url).read() except ImportError: import urllib2 html = urllib2.urlopen(url).read() hipfile = sorted( re.findall(r'href=[\'"]?([^\'" >]+)', html )[5:], reverse=True) # Select file from list inside Houdini selection window mySelection=hou.ui.selectFromList(hipfile, default_choices=(), exclusive=True, message="Twitch.tv/JohnKunz Stream Files", title="Select File", column_header="Choices", num_visible_rows=10, clear_on_cancel=False, width=0, height=0) # Merge selected file try: myFile = int(mySelection[0]) hou.hipFile.merge(url+hipfile[myFile]) print "File loaded: " + url+hipfile[myFile] except: print "Cancelled: No File Loaded"