This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Advert's profile picture

[1.21] Tmart (Formerly Pget): Gui Pastebin Downloader V0.51

Started by Advert, 13 February 2012 - 02:22 AM
Advert #1
Posted 13 February 2012 - 03:22 AM
Notice: 'official' filename changed from pget to tmart.

Screenshots out of date, will upload new ones (in a smaller quantity, and resolution).

Code: http://pastebin.com/nuX33xq7
Note that the code is currently very messy, as I really want to share this script to get TrollMart populated with scripts.
You can put it in rom/programs; or on a disk, It should run from anywhere.
I'd preffer if you saved it as tmart as that's what it refers to itself as.

Usage:
pget - opens gui
pget –test -does some testing that I used for debugging, not sure what exactly, though.
pget –help – Shows some syntax, that is probably outdated.
pget –get <code> –saveas <name> - Downloads pastebin/code and saves as <name>.

I'd appreciate bug-reports and suggestions!
Known bugs/issues:
! (un-'fix'able) tmart –get http://* will always return the raw output of the server, and may give you html.
Old bugs:
Spoiler1) tmart –get invalidcode -> attempt to index ? a nil value
– Will not be fixed for a while, since I can't simply check for an http error code.

This was actually fairly simple to fix; but I doubt it'll be an universal fix.
Changelog:
Spoilerv0.50: Now shows which category/item you have selected, and scrolls the category/item lists.
Changes in some strings; now supports http:// for nodes and files.
v0.41: "ws" keys now work properly, ws both used to move the selection down a program.
Added version # instead of "vnil"
v0.40: Public Release
Current node tree:

Master ->
Advert_Node
Espen_Node

Please post in this thread if you'd like to offer your scripts on TrollMart!
Prerequisites:
SpoilerPastebin account (for updating your scripts)

Make a new paste, and format it like so:
No spaces, because I am lazy.


--#maintainer:YOU
-- Safety comment incase readAll doesn't take this already-read line.
program,PASTEBINCODE,Program_name/filetobesavedas,file_category,YOU
....

Example: (ignore the last node declaration; #releasedate and #pgetversion are unused, and the node declaration, because it won't work.)



--#maintainer:Advert
--#releasedate:12/2/2012
--#pgetversion:0.1
-- Safety comment incase readAll doesn't take this already-read line.
program,ZXeRgLHt,matrix-ss,screensaver,Advert
program,gUzi0bRj,lsave,api,Advert
node,pUYV8kuU,Adverts Node #2,nodes,Advert

Once you've done that, post a link to your 'node' on pastebin, and I'll consider adding it!

What categories are there? Any! But since I didn't impliment scrolling yet, there are a max displayed of 9 (you can still access the others; same with files (per category)).
Please try to keep the category simple; e.g
editor (for, say, parker's vi)
game (for any game)

Do not include slashes in your program's name, as it may prevent them from being downloaded and saved.

TODO:
Spoiler– Everything marked TODO in the code
– Everything not marked TODO in the code

*Get more programs hosted.

Screens (:
Spoiler
Spoiler
Spoiler

Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler




OP Beuautification later. Too lazy.
Edited on 14 February 2012 - 04:20 PM
FuzzyPurp #2
Posted 13 February 2012 - 07:57 AM
How is it incompatible? All http programs must be placed in the redworks/programs/http folder.
Espen #3
Posted 13 February 2012 - 12:23 PM
Nice program, to the point &amp; easy to use.
Also kudos for making the effort of coming up with a user friendly interface, and nice ASCII art. ;)/>/>
One suggestion: Maybe post one or two pictures of the title screen and/or the menu or sth.
Some users have a no-pix no-download policy and I'm sure it would also help making its purpose clear to those with tl;dr syndrome.^^
Advert #4
Posted 13 February 2012 - 12:45 PM
Nice program, to the point &amp; easy to use.
Also kudos for making the effort of coming up with a user friendly interface, and nice ASCII art. ;)/>/>
One suggestion: Maybe post one or two pictures of the title screen and/or the menu or sth.
Some users have a no-pix no-download policy and I'm sure it would also help making its purpose clear to those with tl;dr syndrome.^^

Good idea!


How is it incompatible? All http programs must be placed in the redworks/programs/http folder.

Hah, I wasn't sure what I was doing when I posted this yesterday. It was 3 am and I wanted to release the finally-working version.
I guess I just wanted to avoid confusion if it didn't work, on redworks, for some reason.

I'll start adding some more features to this, and fix some bugs in a few hours, I think I need a small programming break :)/>/>
bastrian #5
Posted 13 February 2012 - 12:58 PM
Ok, just tryed it with Redworks. d
I get the error 'attempt to index ? (a nil value)' right after the 'pget by Advert' text.
Advert #6
Posted 13 February 2012 - 01:08 PM
Ok, just tryed it with Redworks. d
I get the error 'attempt to index ? (a nil value)' right after the 'pget by Advert' text.

Could you do the following: (as per Espen's instructions, in this post.)
type 'lua' to enter the lua interpreter
type 'require "org.luaj.vm2.lib.DebugLib"'
ignore the error, and type 'exit()'
run pget again, and it should give you a line #, post that here.

Also: Added screns.
Advert #7
Posted 13 February 2012 - 03:12 PM
Updated; V0.41: "ws" keys now work properly, ws both used to move the selection down a program.
Added version # instead of "vnil"
rockymc #8
Posted 13 February 2012 - 03:21 PM
Copied much Pastebin Paste Downloader?
Espen #9
Posted 13 February 2012 - 03:33 PM
Copied much Pastebin Paste Downloader?
To the contrary, he was inspired by Pastebin Paste Downloader to write his own version of it, but with another focus.
If you take a good look at the code then you can see that he made it from scratch.
It has a lot more functionality, like a repository based storage of code along with metadata and a GUI for ease-of-use, for example.
They both have their different use cases, so it's not really accurate to say he just "copied" it.
Advert #10
Posted 13 February 2012 - 03:38 PM
Copied much Pastebin Paste Downloader?
That's pretty rude.
No, I did not copy tomass' pastebin downloader.
Yes, I was inspired by it.
Yes, I also credited tomass for the inspiration:
Spoiler
rockymc #11
Posted 13 February 2012 - 04:36 PM
Ah, it's because the two programs do the same…
Advert #12
Posted 13 February 2012 - 04:52 PM
Ah, it's because the two programs do the same…
No, they don't do the same.

Did you even run the programs?
Or look at the code?

pget opens a GUI; where you can download from a list grabbed at runtime.
tomass' pastebin downloader requires you to type in the pasteID.
rockymc #13
Posted 13 February 2012 - 05:15 PM
Somewhat like that.
FuzzyPurp #14
Posted 13 February 2012 - 10:50 PM
Any confirmation with redworks, since cc-get as well stopped working with redworks, i'm assuming it's something in my code :(/>/> with http programs, but ccirc works just fine so i beg to differ.
Advert #15
Posted 13 February 2012 - 11:06 PM
I'll test it myself, since bastrian seems to have gone poof.

It works, though I am using a slightly modified version (of pget).

I'll update again, soon.
Advert #16
Posted 14 February 2012 - 11:11 AM
Updated to v0.50v0.51:

Changed filename from pget to tmart;
Removed –test
Indicators of what you have selected in the menu.
v0.51: Fixed error when using an invalid pastebin code.
The next update will take a while unless it's a bugfix, as I'm rewriting most of it.

Still in need of code authors; read OP for details.
Xemiru #17
Posted 15 February 2012 - 02:23 AM
y u so boss program.
Advert #18
Posted 15 February 2012 - 03:21 AM
y u so boss program.
Thanks, I still have (many) plans for it, though. Not sure when those'll be coded, but when they do, the boss-factor will increase.