Author Topic: ticalc.org "Package Manager"  (Read 17683 times)

0 Members and 1 Guest are viewing this topic.

Offline TravisE

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 182
  • Rating: +33/-0
    • View Profile
    • ticalc.org
Re: ticalc.org "Package Manager"
« Reply #15 on: November 30, 2010, 01:01:57 am »
Looks nice! This can actually be a more convenient way to do quick, basic searches in some cases than ticalc.org's own search system.

Works fine on my Linux system. You might want to change the first line from “#!usr\bin\env python” to “#!/usr/bin/env python” and set the line ending format of the script to Unix so that it's possible to call it directly without prefixing the command line with “python”.

A couple of other ideas:

* Case-insensitive searching (currently, for instance, searching for “quad” gives different results from “Quad”, so you have to try both to make sure you find everything)

* When downloading, handle duplicate filenames (from files in different directories on the ticalc.org server) by renaming them rather than having them overwrite each other. Example: If you get “Frogger”, you'll end up with several missing files because they're named “frogger.zip” and only one “frogger.zip” remains after the download process)
ticalc.org staff member—http://www.ticalc.org/

Offline DJ Omnimaga

  • Now active at https://codewalr.us
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55816
  • Rating: +3151/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • CodeWalrus
Re: ticalc.org "Package Manager"
« Reply #16 on: November 30, 2010, 02:33:02 am »
Maybe sort files by directories on the computer too? (and specify the amount of levels to memorize,  for example if you want to sort by calc models and language instead of calc model, language, program type and genre.
In case you are wondering where I went, I left Omni back in 2015 to form CodeWalrus due to various reasons explained back then, but I stopped calc dev in 2016 and am now mostly active on the CW Discord server at https://discord.gg/cuZcfcF


Bandcamp|Reverbnation|Facebook|Youtube|Twitter

Offline TC01

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 344
  • Rating: +9/-0
    • View Profile
Re: ticalc.org "Package Manager"
« Reply #17 on: November 30, 2010, 06:59:00 am »
Oops. I always seem to end up with the slashes the wrong way around, thanks for pointing that out.

Case insensitive searching is a good idea too.

I'll also set up a system of some sort to handle duplicate filenames.

I'm thinking of adding a switch for searching by directory as well, something like "-d ti89\" or "-d "ti83plus\basic\math\".

Thanks for the feedback!



The userbars in my sig are links embedded links.

And in addition to calculator (and Python!) stuff, I mod Civilization 4 (frequently with Python).

Offline DJ Omnimaga

  • Now active at https://codewalr.us
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55816
  • Rating: +3151/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • CodeWalrus
Re: ticalc.org "Package Manager"
« Reply #18 on: November 30, 2010, 02:37:20 pm »
No problem. :) I might actually use this at one point to search for some files in particular, just out of curiosity, plus it can be useful to find a program in particular that we didn't download in a long while, like an ASM utility. Sometimes, authors upload in 83 misc programs, other times 83 libs, etc.
In case you are wondering where I went, I left Omni back in 2015 to form CodeWalrus due to various reasons explained back then, but I stopped calc dev in 2016 and am now mostly active on the CW Discord server at https://discord.gg/cuZcfcF


Bandcamp|Reverbnation|Facebook|Youtube|Twitter

Offline TC01

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 344
  • Rating: +9/-0
    • View Profile
Re: ticalc.org "Package Manager"
« Reply #19 on: November 30, 2010, 04:37:53 pm »
I've fixed the #!/usr/bin/env python and added case insensitive searching. I think it'll just be best to distribute one copy for Windows and one for Unix/Linux, with the different line endings set.

I still need to get multiple files with the same name working, and a switch for searching in a specified directory. Once that is done, I'll upload a new version.

I also integrated it with an IRC bot... sort of. The bot can do "!calcpkg count text" and say in the channel the number of results. It can do "!calcpkg list text", but since saying it all in the channel would be bad, it pastebins the results and just gives back a link to that Pastebin. And "!calcpkg update" can be ran as well.

The Twisted framework for Python doesn't support sending files to people with dcc, so I can't make it download the files and send them to you.



The userbars in my sig are links embedded links.

And in addition to calculator (and Python!) stuff, I mod Civilization 4 (frequently with Python).

Offline DJ Omnimaga

  • Now active at https://codewalr.us
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55816
  • Rating: +3151/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • CodeWalrus
Re: ticalc.org "Package Manager"
« Reply #20 on: December 01, 2010, 03:50:10 am »
That bot seems interesting, I think it would be good to flood control the command, though, so it can only be used every 30 seconds publicly, otherwise it forces you to do /msg botname !calcpkg instead. This would be to prevent abuse. Also, I'm glad it won't output the results on IRC, even privately, because the bot would quit for excess flood all the time. X.x
In case you are wondering where I went, I left Omni back in 2015 to form CodeWalrus due to various reasons explained back then, but I stopped calc dev in 2016 and am now mostly active on the CW Discord server at https://discord.gg/cuZcfcF


Bandcamp|Reverbnation|Facebook|Youtube|Twitter

Offline TC01

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 344
  • Rating: +9/-0
    • View Profile
Re: ticalc.org "Package Manager"
« Reply #21 on: December 01, 2010, 09:01:11 pm »
Attached is the current version of the package manager (adapted slightly for IRC) and the bot. (The bot imports the package manager).

It uses the Twisted framework for Python 2.x- which requires both Twisted and Zope.Interface to run.

It is set to join #cemetech and #omnimaga by default on whatever IRC network you specify when you run it- you specify the network by:

"python calcpkgbot.py #otherchan irc.efnet.net"

#otherchan could be anything- making it #cemetech or #omnimaga would make it only join the two default channels.

There are five commands in there- in addition to !calcpkg list, !calcpkg count, !calcpkg update, and !calcpkg help, I added a !nick to change the bot's nickname remotely (the default is set to "Hex", a Terry Pratchett reference and most likely a nick already in use somewhere).

The update command can only be ran by operators because it's a time/resource intensive operation.

If you send commands to a private message, it will return them to you via private message- so if it's spamming up the channel you can make people take it to privmsg (or just silence it). DJ suggested flood control of some sort- that is the closest I came to doing it now.



The userbars in my sig are links embedded links.

And in addition to calculator (and Python!) stuff, I mod Civilization 4 (frequently with Python).

Offline DJ Omnimaga

  • Now active at https://codewalr.us
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55816
  • Rating: +3151/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • CodeWalrus
Re: ticalc.org "Package Manager"
« Reply #22 on: December 01, 2010, 11:36:07 pm »
Cool, I hope people won't all run their own copies of the bot, though, now that you made it public. ???

Glad it has flood control, though.
In case you are wondering where I went, I left Omni back in 2015 to form CodeWalrus due to various reasons explained back then, but I stopped calc dev in 2016 and am now mostly active on the CW Discord server at https://discord.gg/cuZcfcF


Bandcamp|Reverbnation|Facebook|Youtube|Twitter

Offline TC01

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 344
  • Rating: +9/-0
    • View Profile
Re: ticalc.org "Package Manager"
« Reply #23 on: December 04, 2010, 12:44:19 pm »
Getting ready to release an update.

In addition to case insensitive searching and the #! fix, I've:

1. Changed the way downloaded files are named- they contain the path (so "83plus-asm-games-generate.zip" rather than just "generate.zip") to fix the issue with multiple files containing the same name.

2. Added command-line opts for searching. The opts are:

-c [name]: --category=[name]: some category to search in. This can be high level like "83plus" or "win", and it can also be "games" or "math" or "basic" or "os" or whatever.
-g: --game: Searches for games only ("-c games")
-m: --math: Searches for math and science only ("-c math" and "-c games")

These switches only work with the list and get commands. I also added a switch for update, -s or --silent, which keeps output to a minimum. All switches can be viewed with "calcpkg.py -h".

I'm also just going to have a separate Unix and Windows version on ticalc.org (and Cemetech) with the different line endings.

I just need to rewrite the readme, boot into Windows and test the Windows version, and then I'll release.



The userbars in my sig are links embedded links.

And in addition to calculator (and Python!) stuff, I mod Civilization 4 (frequently with Python).

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: ticalc.org "Package Manager"
« Reply #24 on: December 04, 2010, 02:37:57 pm »
Getting ready to release an update.

In addition to case insensitive searching and the #! fix, I've:

1. Changed the way downloaded files are named- they contain the path (so "83plus-asm-games-generate.zip" rather than just "generate.zip") to fix the issue with multiple files containing the same name.

2. Added command-line opts for searching. The opts are:

-c [name]: --category=[name]: some category to search in. This can be high level like "83plus" or "win", and it can also be "games" or "math" or "basic" or "os" or whatever.
-g: --game: Searches for games only ("-c games")
-m: --math: Searches for math and science only ("-c math" and "-c games")

These switches only work with the list and get commands. I also added a switch for update, -s or --silent, which keeps output to a minimum. All switches can be viewed with "calcpkg.py -h".

I'm also just going to have a separate Unix and Windows version on ticalc.org (and Cemetech) with the different line endings.

I just need to rewrite the readme, boot into Windows and test the Windows version, and then I'll release.

I just checked this project, WOW, very good indeed, those new features also look blasting!

Features Request:

> Can you make it not run using cmd? I think I may help you with that :), if it is python-possible;
> Is this a bug?
>> I updated, it took a while but was finished, then searched for formulum, my program in Ticalc, but it wasn't found... (here)
« Last Edit: December 04, 2010, 02:44:05 pm by ScoutDavid »

Offline TC01

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 344
  • Rating: +9/-0
    • View Profile
Re: ticalc.org "Package Manager"
« Reply #25 on: December 04, 2010, 06:07:02 pm »
ScoutDavid: By "not run using cmd", you mean "not be a command line program and have a GUI", I assume. (Please clarify if I'm mistaken).

Honestly, I prefer it to be a command line program. (Wow! Three months ago I hated command line programs. Too much Linux...)

Personally, I feel like this is best suited for the command line. In Linux, I think package managers in the terminal are much simpler to use than the GUIs. That's just a personal preference though.

I could make a GUI for it in Python, yes- but I would much rather devote time to perfecting the existing tool. After that... I could try to hack out a Tkinter GUI (I'd rather not, but Tkinter is built-in to Python as opposed to PyGTK/wxPython/PyQT).

Whatever I did, I would make it a frontend that wouldn't remove any functionality from the command line tool- much like the IRC bot.

For the bug: did you search for "Formulum" or "formulum"? At the present it doesn't do case-insensitive searching. When I did "Formulum" I got 2 results.



The userbars in my sig are links embedded links.

And in addition to calculator (and Python!) stuff, I mod Civilization 4 (frequently with Python).

Offline DJ Omnimaga

  • Now active at https://codewalr.us
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55816
  • Rating: +3151/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • CodeWalrus
Re: ticalc.org "Package Manager"
« Reply #26 on: December 04, 2010, 06:11:38 pm »
I like the update! As for a version that isn't for command line, could you maybe create a bat file for those who don't want to Google how to write batch files? It might be enough. I don't know if a GUI is necessary for such program, though, plus it is more convenient to use through command line, but we have to understand that some people (like me) are more visual and prefer GUIs, so certain type of softwares may be better in GUI form for those people, like emulators.
« Last Edit: December 04, 2010, 06:12:19 pm by DJ Omnimaga »
In case you are wondering where I went, I left Omni back in 2015 to form CodeWalrus due to various reasons explained back then, but I stopped calc dev in 2016 and am now mostly active on the CW Discord server at https://discord.gg/cuZcfcF


Bandcamp|Reverbnation|Facebook|Youtube|Twitter

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: ticalc.org "Package Manager"
« Reply #27 on: December 04, 2010, 06:12:05 pm »
Quote
ScoutDavid: By "not run using cmd", you mean "not be a command line program and have a GUI", I assume. (Please clarify if I'm mistaken).

Not-GUI, that would make it slow.
Not cmd, since we need to cd the location.
Python but non-GUI!

If you make it Python but non-GUI I can make a GUI out of it, I'm one awesome (sorry for this) python GUI programmer actually.

Hum... I got none and updated, gonna try again

Offline TC01

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 344
  • Rating: +9/-0
    • View Profile
Re: ticalc.org "Package Manager"
« Reply #28 on: December 04, 2010, 06:36:14 pm »
Ah, I get what ScoutDavid was saying now (after our conversation over IRC).

A batch file is fairly straightforward to implement for this. Very, in fact.

But you could use this as part of another Python module (in this case, a wxPython GUI) without any modifications. (now that I come to think of it). :)

If you import calcpkg, you can call various functions like "ticalcSearch", "ticalcUpdatePackageLists", "ticalcCount", and "ticalcGet" without needing to invoke the program on the command line (which you could do anyway using the subprocess module). You'd just pass them arguments and they'd do stuff. The IRC bot is a good example of how you could run ticalc.org searches from another module.



The userbars in my sig are links embedded links.

And in addition to calculator (and Python!) stuff, I mod Civilization 4 (frequently with Python).

Offline TC01

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 344
  • Rating: +9/-0
    • View Profile
Re: ticalc.org "Package Manager"
« Reply #29 on: December 05, 2010, 05:29:07 pm »
Also, the new version has been uploaded to ticalc.org here. And there's a version with the Unix line endings here. (Copies are also available in Cemetech's archives- and I'll replace the one in the first post in a second).
« Last Edit: December 05, 2010, 05:30:03 pm by TC01 »



The userbars in my sig are links embedded links.

And in addition to calculator (and Python!) stuff, I mod Civilization 4 (frequently with Python).