Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local x,y = term.getSize()
- local serverID = 426
- if paintutils then
- if term.isColor() ~= true then
- print("Computer doesn't support colors.")
- return
- end
- else
- print("Outdated Computercraft, failed to run.")
- return
- end
- local function cPrint(text)
- x2,y2 = term.getCursorPos()
- term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
- write(text.. "\n")
- end
- local drawingBoard = {
- ["A"] = colors.white,
- ["B"] = colors.orange,
- ["C"] = colors.magenta,
- ["D"] = colors.lightBlue,
- ["E"] = colors.yellow,
- ["F"] = colors.lime,
- ["G"] = colors.pink,
- ["H"] = colors.gray,
- ["I"] = colors.lightGray,
- ["J"] = colors.cyan,
- ["K"] = colors.purple,
- ["L"] = colors.blue,
- ["M"] = colors.brown,
- ["N"] = colors.green,
- ["O"] = colors.red,
- ["P"] = colors.black,
- }
- function advWrite( pos1, pos2, str )
- for i=1,#str do
- local symb = drawingBoard[ string.sub( str, i, i) ]
- term.setCursorPos( pos1 + (i-1) , pos2 )
- if symb then
- term.setBackgroundColour( symb )
- write(" ")
- end
- end
- end
- function drawTop()
- term.setTextColour( colors.white )
- term.setBackgroundColour( colors.black )
- term.clear()
- term.setCursorPos(1,1)
- write("cc")
- term.setBackgroundColour( colors.red )
- term.setTextColour( colors.black )
- write("Tube")
- term.setTextColour( colors.white )
- term.setBackgroundColour( colors.black )
- write(" | rednet.broadcast() yourself")
- for i=1,x do
- term.setCursorPos(i,2)
- write("-")
- end
- print()
- end
- function drawThumbnail( thumbnail, title, views, description1, description2 )
- term.setTextColour( colors.white )
- term.setBackgroundColour( colors.black )
- local xz,yz = term.getCursorPos()
- print("XXXXXXXXXXX " ..title)
- print("XXXXXXXXXXX ")
- print("XXXXXXXXXXX " ..views.. " views")
- print("XXXXXXXXXXX " ..description1)
- print("XXXXXXXXXXX " ..description2)
- for i=1,5 do
- advWrite( 1, yz+(i-1), thumbnail[i] )
- end
- print()
- local xz,yz = term.getCursorPos()
- term.setBackgroundColour( colors.black )
- for i=1,x do
- term.setCursorPos( i, yz )
- write("-")
- end
- print()
- end
- drawTop()
- --[[
- testVideos = {
- [1] = {
- ["Thumbnail"] = { --11x5 = highest RES
- "JJJJMJJJJJJ",
- "JJJMMMJJJJJ",
- "JJJMMMJJJJJ",
- "NNNNNNNNNNN",
- "MMMMMMMMMMM",
- },
- ["Title"] = "screen_recorder_1",
- ["Views"] = 301,
- ["Desc"] = "Example video, made",
- ["Desc2"] = "with ccRec v2.0",
- },
- }
- for i=1,#testVideos do
- drawThumbnail( testVideos[i]["Thumbnail"], testVideos[i]["Title"], testVideos[i]["Views"], testVideos[i]["Desc"], testVideos[i]["Desc2"] )
- end
- ]]--
- local videos = {}
- rednet.send( serverID, "request_videos" )
- repeat
- id, message = rednet.receive()
- until id == serverID
- videos = textutils.unserialize( message )
- for i=1,#videos do
- drawThumbnail( videos[i]["Thumbnail"], videos[i]["Title"], videos[i]["Views"], videos[i]["Desc"], videos[i]["Desc2"] )
- end
- sleep(1)
Advertisement
Add Comment
Please, Sign In to add comment