Mod Archive Forums Mod Archive Forums
Advanced search  

News:

Please note: Your main modarchive.org account will not work here, you must create a forum account to post on the forums.

Pages: [1] 2   Go Down

Author Topic: Python App - Song "Sorter"  (Read 15145 times)

0 Members and 1 Guest are viewing this topic.

AsSlowAsHell

  • Wants more Pie
  • Offline Offline
  • Posts: 6
    • View Profile
Python App - Song "Sorter"
« on: November 09, 2007, 08:50:55 »

I have made a simple app that makes a "sorted" "collection" of any mod files you want it to sort.  Any mod file or zip of a mod file or group zip of a mod file from the 2007 mod archive torrent will be imported correctly.  Source code is included.

The files are renamed to a more descriptive format:
for example:
from sm-unbreakable.it
to    7.00 sm-unbreakable.it (Unbreakable Barrier) ID158134 Hits-53

It organizes the files in the following format:
if the song has a rating:
rated\genre\rating (one of bad, good, great, zomg)\descriptive file name
if the song does not have a rating:
unrated\(genre)\popularity (one of obscure, seldom seen, known, popular, hit, mega-hit)\descriptive file name

How to use:
-Make sure python interpreter is installed (http://www.python.org/download/).  for those that dont know what it is its a multiplatform interpreter for the python programming language.  kind of like java, but without aids :P
-Download program and extract somewhere http://rapidshare.com/files/68466783/ModuleImportFixed.zip.html
-Put mod files into the import folder
-Run ModImport.py
-Output will go to the collection folder

Notes:
The modules you put in the import folder need to be unmodified names of the original file you downloaded from this website (modarchive) for the songs to be properly organized.  They can also be zipped, but if they are zipped the zip file name should be the original file name of the module with a .zip on the end just as they are downloaded from modarchive.  You can also import zips of these zipped files.

IMPORTANT!  When the songs are imported to the collection folder, the original named songs in the import folder are moved/deleted and end up in the collection folder with the transformed file name.  if you want to maintain the original file please perform the import on copies of the files and not the originals.

If there are any problems let me know, also if anyone finds it useful let me know.


EDIT: haha i after posting this i saw the mod library thing XD.  Mine has a slightly different goal, the main goal was to take the 120,000 module 2007 torrent pack and to put the files into a more usable structure for exploring and finding new songs you may like.  Module Database seems to be more of a library for mod song you already know you like ;)

EDIT2: I forgot to include the BeautifulSoup.py file in the package, so i repackaged it.
« Last Edit: November 09, 2007, 09:33:57 by AsSlowAsHell »
Logged

m0d

  • Architect v3-4.0b
  • Administrator
  • Lerd of the Pies
  • ****
  • Offline Offline
  • Posts: 1848
  • M0d
    • View Profile
    • http://winter.pics
Re: Python App - Song "Sorter"
« Reply #1 on: November 09, 2007, 09:05:17 »

How exactly are you obtaining the genre info and so on?
Logged
The Architect 🤔

AsSlowAsHell

  • Wants more Pie
  • Offline Offline
  • Posts: 6
    • View Profile
Re: Python App - Song "Sorter"
« Reply #2 on: November 09, 2007, 09:23:40 »

Its all in a file included with the app.  Basically it was scraped from the site over the course of a couple days.  I did it that way so that each person using it wouldn't be hammering the site. :angel:

The main downside is that its also a snapshot  :-\

EDIT: and I forgot to put in a required dependency in the zip, so i added it just now and made it slightly more user friendly by saying "Complete press any key to quit" instead of just making the window disappear.  This way if there are errors or problems they can actually be reported :P 
« Last Edit: November 09, 2007, 09:35:34 by AsSlowAsHell »
Logged

m0d

  • Architect v3-4.0b
  • Administrator
  • Lerd of the Pies
  • ****
  • Offline Offline
  • Posts: 1848
  • M0d
    • View Profile
    • http://winter.pics
Re: Python App - Song "Sorter"
« Reply #3 on: November 09, 2007, 09:40:07 »

I'm glad you did it that way, else I would have kicked your arse big time :) I wouldn't worry about it being a snapshot, because I am not planning on updating the torrent. Several of those that have grabbed it have come to me complaining in the most ungrateful circumstance, so I doubt it will ever get recreated due to the amount of resources needed to create it.

Overall I think your script is just the ticket for what the torrent leechers want. Good work on that.

I however would like to ask you not to spider the site in future in such a short time frame. In a couple of days that is really pushing the server hard. I allow search engines to spider the site because they adhere to the robots.txt and do not present overbearing load on the server. When the server is serving thousands of people per week, one person hammering requests into the server either a) closes it to those other people or b) you get bounced to page load quota notices.

There are easier ways of obtaining the information you want. How? Ask me nicely and tell me what data you want :)
Logged
The Architect 🤔

AsSlowAsHell

  • Wants more Pie
  • Offline Offline
  • Posts: 6
    • View Profile
Re: Python App - Song "Sorter"
« Reply #4 on: November 09, 2007, 09:57:51 »

Ah, haha I see. Sorry about that.  I did get a temporary ban at one point, thats when i slowed down :P.  Hopefully I didn't cause too much of a burden; at least i was going letter by letter 100 modules per page scraping instead of song by song for 120,000 + modules  ;D

Haha, yeah I didn't think of just asking for the data.  A SQL dump or something of the sort would have been much nicer to work with than scraping HTML and wouldn't have put load on the server.  Lesson learned.

PS: People are crazy. How in the world can people complain about a torrent snapshot?  Its amazing that you even considered rolling one in the first place!  The torrent pack + the little "collection maker" app I slapped together are perfect for me because I like to listen to mods at work but browsing the site and looking for more good ones at work is no good (I should be working! :P).  This allows me to bring the mods on an external and right click the Demo Style genre songs (for example) and Play All in Winamp (using the bass.dll plugin of course).  Thank you for rolling the torrent snapshot(s) and I hope more people than just me will benefit from the app. 
Logged

m0d

  • Architect v3-4.0b
  • Administrator
  • Lerd of the Pies
  • ****
  • Offline Offline
  • Posts: 1848
  • M0d
    • View Profile
    • http://winter.pics
Re: Python App - Song "Sorter"
« Reply #5 on: November 09, 2007, 10:05:56 »

I can't offer you an SQL dump. Im afraid I will not release my site secrets ;) If you just want a formatted file with data either between tags, or CSV form that you can parse yourself then that is more of the direction I was thinking.
Logged
The Architect 🤔

AsSlowAsHell

  • Wants more Pie
  • Offline Offline
  • Posts: 6
    • View Profile
Re: Python App - Song "Sorter"
« Reply #6 on: November 09, 2007, 10:13:35 »

CSV would be preferred; don't know if there is any good reason to dump it since I have already built the lookup table from song file name -> song info from the HTML.  Unless it contains information about songs that have been removed from the site (there are a couple hundred songs, 150 or so, that the importer did not find info for, so I'm assuming those songs were removed from the site but still exist in the snapshot torrent.  Of course it could be that my HTML parse did not complete all the way...)  If you want to , you can e-mail me the CSV (asslowashell [at] gmail dot com)

[edited your email. dont want your email harvested by spam bots do we :) -m0d]
« Last Edit: November 09, 2007, 13:28:37 by m0d »
Logged

m0d

  • Architect v3-4.0b
  • Administrator
  • Lerd of the Pies
  • ****
  • Offline Offline
  • Posts: 1848
  • M0d
    • View Profile
    • http://winter.pics
Re: Python App - Song "Sorter"
« Reply #7 on: November 09, 2007, 10:26:12 »

You gotta tell me which fields you want and in which order.
Logged
The Architect 🤔

AsSlowAsHell

  • Wants more Pie
  • Offline Offline
  • Posts: 6
    • View Profile
Re: Python App - Song "Sorter"
« Reply #8 on: November 09, 2007, 10:48:43 »

haha, sorry.  How about genre, rating, title, number of downloads, module ID#, file name?
Logged

m0d

  • Architect v3-4.0b
  • Administrator
  • Lerd of the Pies
  • ****
  • Offline Offline
  • Posts: 1848
  • M0d
    • View Profile
    • http://winter.pics
Re: Python App - Song "Sorter"
« Reply #9 on: November 09, 2007, 13:39:52 »

Ok, I have created a CSV for you after building a script to make it.

Be aware that I have deliberatly removed commas from within the titles, would mess up your parser otherwise.

Here is the Download

*m0d looks fondly at the empty server donation box*  :angel: Hey, you can't blame me for trying :)

« Last Edit: November 09, 2007, 13:43:20 by m0d »
Logged
The Architect 🤔
Pages: [1] 2   Go Up