Cataloging program

"Please leave a message at the beep, we will get back to you when your support contract expires."

Moderators: phlip, Prelates, Moderators General

Cataloging program

Postby dhokarena56 » Thu Mar 22, 2012 12:27 am UTC

My maths teacher used to run a Magic: the Gathering club, which was canceled, and a few months ago I asked him about it and he said he didn't really want the cards (which were sitting in shoeboxes in a classroom) anymore. So I took the cards, and now I'd like to catalog them. There's probably about 2 or 3 thousand in that box, which is too much to catalog by writing down on paper. Instead, I'm wondering if there's a simple programme that can catalog them for me- ideally that was originally written for Magic, but not necessarily. I just need, for the most part, to be able to enter the name of a card, and it'll enter it into a list, or add 1 to the count if one was already entered, and then when I'm done it'll spit out the cards in alphabetical order with the number that I have next to them.

Anybody know of such a programme?
Come join Dadapedia- the open-source Dadaist novel that anyone can edit.
User avatar
dhokarena56
 
Posts: 179
Joined: Fri Mar 27, 2009 11:52 pm UTC

Re: Cataloging program

Postby scarecrovv » Thu Mar 22, 2012 3:52 am UTC

I don't know of any such program pre-existing outside of programming tutorial examples. Here's one way to do it python:

Code: Select all
#!/usr/bin/python

from sys import stdin

cards = {}

card_list = stdin.readlines()
for card in card_list:
   card = card.rstrip()
   if card in cards:
      cards[card] = cards[card] + 1
   else:
      cards[card] = 1

for card, number in cards.iteritems():
   print card, number
User avatar
scarecrovv
It's pronounced 'double u'
 
Posts: 644
Joined: Wed Jul 30, 2008 4:09 pm UTC
Location: California

Re: Cataloging program

Postby EvanED » Thu Mar 22, 2012 4:41 am UTC

I'd type all the cards into a file and then run it through a program like scarecrovv's, so that if you get bored halfway through or the power goes out you don't have to throw away having typed a couple thousand lines.

And once that's done, you can just come back here and ask someone to pipe the file into sort | uniq -c and give you the output. :-)
EvanED
 
Posts: 4132
Joined: Mon Aug 07, 2006 6:28 am UTC
Location: Madison, WI

Re: Cataloging program

Postby Yakk » Fri Mar 23, 2012 5:49 pm UTC

I'd be tempted to write up a "tab completion" like ability, so I wouldn't have to retype the same card once for each instance.

But yes, a good old flat file with one line for each card name is a half decent (and simple) way to store it or write it up.
One of the painful things about our time is that those who feel certainty are stupid, and those with any imagination and understanding are filled with doubt and indecision - BR

Last edited by JHVH on Fri Oct 23, 4004 BCE 6:17 pm, edited 6 times in total.
User avatar
Yakk
Poster with most posts but no title.
 
Posts: 10418
Joined: Sat Jan 27, 2007 7:27 pm UTC
Location: E pur si muove


Return to The Help Desk

Who is online

Users browsing this forum: No registered users and 2 guests