forum

Auto-downloader for Bloodcat (osu! beatmap mirror)

posted
Total Posts
60
show more
Avail
import simplejson

url = "http://bloodcat.com/osu/?mod=json"
json = simplejson.load(url)

id = json[0]['id']
artist = json[0]['artist']
source = json[0]['source']
title = json[0]['title']
date = json[0]['date']

Or something like that.
Topic Starter
RavenMac
To be honest, i only thought JSON was something for bloodcat.
I've never herd of if before looking at the information page.
There are still a lot of things with Python i still don't know about.

Thank you Hexide and Avail for showing me this.
I'll look into this a little more and will see about updating it.

Edit: I have changed the code a little bit to use the json module.
I will have this test for about an hour while i get lunch.
If there are no errors by the time i get back, i'll update my code using the same link on my first post.

Edit 2: It's been running well for an hour now and have just updated the file. Same link in the first post.
ps. i love mediafire's edit file. Don't have to reupload files if it's a small change and keeps the same link.
Topic Starter
RavenMac
I have just finished the code working with Python 3.3 and added a couple extra things.
Piotrekol
Good way to start!
(I would release my downloader months ago but it's based on some parts of osu site(but uses bloodcat to dl) so it's no-go for mass use)
suggestions:
-Ask if user want to download only ranked beatmap sets or all (or only unranked?)
-ability to download upto ~60(or more)last ranked maps(I think I could provide public api for this- not promising tough)
Topic Starter
RavenMac

Piotrekol wrote:

-Ask if user want to download only ranked beatmap sets or all (or only unranked?)
This wouldn't be too difficult to add.
Having 2+ windows pop-up isn't something i like for small options like this.
Definitely something to remember if / when i make a GUI for it.

Piotrekol wrote:

-ability to download upto ~60(or more)last ranked maps(I think I could provide public api for this- not promising tough)
I don't think checking the last 60 updated songs every time will do much. Maybe at just the start.
20 is what json brings up by default, and that seems to work quite well.
- Marco -
22:45:04 - Downloading: 60309 nano - Omoide Kakera
Creator: 1065180 Smoothie
(<class 'KeyError'>, KeyError('source',), <traceback object at 0x00000000065E1E0
8>)

And it will continue beeping :c
Woddles

marcostudios wrote:

22:45:04 - Downloading: 60309 nano - Omoide Kakera
Creator: 1065180 Smoothie
(<class 'KeyError'>, KeyError('source',), <traceback object at 0x00000000065E1E0
8>)

And it will continue beeping :c
Thread is about 5months old, would not surprise me if the program was broken by an update to the bloodcat website or something similar
Topic Starter
RavenMac

marcostudios wrote:

22:45:04 - Downloading: 60309 nano - Omoide Kakera
Creator: 1065180 Smoothie
(<class 'KeyError'>, KeyError('source',), <traceback object at 0x00000000065E1E0
8>)

And it will continue beeping :c
I'm sorry for not replying earlier.
I've fixed the issue. Bloodcat no longer provides the source of the songs any more.

I've been busy with my Java class in college and have had hardly any time for anything else.
I'm thinking of making a Java version of this. Almost everyone has java so no need to install python or downloading the appropriate version of the code depending on what version of python you're using.
Also, GUI's in Java is much easier to understand than python, imo.
I'm still not very good with them though.
Topic Starter
RavenMac
Just updated my program again. Bloodcat no longer stores the genre or status as an integer. Everything is strings.
Was asked by neptune23 how to get it working and decided to check to see if it was still working. It wasn't.

I can no longer use my own program every day. My ISP has put a data cap on my house. 300GB split 5 ways.
One more reason why i hate Comcast. No matter how fast your internet is, the cap is the same.
And I've checked other ISPs. It's all i have in the area...

Edit.
One more small edit. I don't know why this wan't in there in the first place.
Added status code 8 for Qualified maps.
Aistify
How do we make it so that it downloads to a specific folder without asking us to later on?
Topic Starter
RavenMac

Aistify wrote:

How do we make it so that it downloads to a specific folder without asking us to later on?
I did not add anything like that to this program. I haven't touched this program for quite some time now, so it's kinda dated.
321jurgen
It throws me a permission error while it downloaded the map succesfully.
http://puu.sh/9KW6g.png
Topic Starter
RavenMac

321jurgen wrote:

It throws me a permission error while it downloaded the map succesfully.
http://puu.sh/9KW6g.png
I'll take some time to look into this tonight. I'm a bit busy setting up my computer and a few other things while watching over someone's house for a few days.
YAY for no data caps over here.
Topic Starter
RavenMac
I've looked around and the only things i can find are:
1) The file is being used by something already, but the file is saved once the program has the entire file and once the file is opened by the default program (osu!) it's moved to the songs directory and unpackaged as all the files for the map. (what i guess happens. i could be wrong, but not too far off)
2) You or the user you are logged in as doesn't have permission to write to that directory. However, it looks like you were able to write one file there in the first place... I assume you're the owner of the computer and also have admin privileges. If not, try with the admin/owner of the computer.

I made a small script to check if you've got permission to write to a directory. You can paste it into a text file, make sure it has the .py extension, and the save type as "all files" to prevent it from making it a .txt file. If it passes, try the downloader again in the same folder.

And for anyone else who wants to try this, this is for python 3.x.
import tkinter, tkinter.filedialog, tkinter.messagebox, os
root = tkinter.Tk()
root.withdraw()
folder = tkinter.filedialog.askdirectory(parent=root, initialdir='/', title='Select folder to test read/write permissions.')

if os.access(folder, os.W_OK):
if os.access(folder, os.R_OK):
tkinter.messagebox.showinfo('Directory permission','You are allowed to read/write here.')
else:
tkinter.messagebox.showinfo('Directory permission','You are NOT allowed to write here.')
else:
if os.access(folder, os.R_OK):
tkinter.messagebox.showinfo('Directory permission','You are NOT allowed to read here.')
else:
tkinter.messagebox.showinfo('Directory permission','You are NOT allowed to read/write here.')
321jurgen

RavenMac wrote:

I've looked around and the only things i can find are:
1) The file is being used by something already, but the file is saved once the program has the entire file and once the file is opened by the default program (osu!) it's moved to the songs directory and unpackaged as all the files for the map. (what i guess happens. i could be wrong, but not too far off)
2) You or the user you are logged in as doesn't have permission to write to that directory. However, it looks like you were able to write one file there in the first place... I assume you're the owner of the computer and also have admin privileges. If not, try with the admin/owner of the computer.

I made a small script to check if you've got permission to write to a directory. You can paste it into a text file, make sure it has the .py extension, and the save type as "all files" to prevent it from making it a .txt file. If it passes, try the downloader again in the same folder.

And for anyone else who wants to try this, this is for python 3.x.
import tkinter, tkinter.filedialog, tkinter.messagebox, os
root = tkinter.Tk()
root.withdraw()
folder = tkinter.filedialog.askdirectory(parent=root, initialdir='/', title='Select folder to test read/write permissions.')

if os.access(folder, os.W_OK):
if os.access(folder, os.R_OK):
tkinter.messagebox.showinfo('Directory permission','You are allowed to read/write here.')
else:
tkinter.messagebox.showinfo('Directory permission','You are NOT allowed to write here.')
else:
if os.access(folder, os.R_OK):
tkinter.messagebox.showinfo('Directory permission','You are NOT allowed to read here.')
else:
tkinter.messagebox.showinfo('Directory permission','You are NOT allowed to read/write here.')
I don't know how but it seems to have fixed itself. Thanks alot though for looking into it.
Sandalot
RavenMac, you should make it in java. 1+ is a good idea
Also if it sorted all the ranked from the unranked in 2 folders and kept that up to date would be an awesome addition.
321jurgen
So this is maybe a bit far fetched but it would be awesome if you could make a program that runs in the background that downloads and updates all the maps. Maybe I should start programming something myself sometime :/ I only do web related stuff and it would be good to explore some different areas. If so in what language should I write it?
Sandalot

321jurgen wrote:

So this is maybe a bit far fetched but it would be awesome if you could make a program that runs in the background that downloads and updates all the maps. Maybe I should start programming something myself sometime :/ I only do web related stuff and it would be good to explore some different areas. If so in what language should I write it?
Python would be a good place to start but java would make it a lot more easier for other people to use it.

I had the same idea as you.
Zallius

321jurgen wrote:

So this is maybe a bit far fetched but it would be awesome if you could make a program that runs in the background that downloads and updates all the maps. Maybe I should start programming something myself sometime :/ I only do web related stuff and it would be good to explore some different areas. If so in what language should I write it?
Keeping every map would be quite space consuming, and would also make the game run inefficiently and become a nightmare for reprocessing.
321jurgen

Zallius wrote:

321jurgen wrote:

So this is maybe a bit far fetched but it would be awesome if you could make a program that runs in the background that downloads and updates all the maps. Maybe I should start programming something myself sometime :/ I only do web related stuff and it would be good to explore some different areas. If so in what language should I write it?
Keeping every map would be quite space consuming, and would also make the game run inefficiently and become a nightmare for reprocessing.
That's what I would've thought at first but it will only take like 100gb (I'm guessing) which isn't that much to me and reprocessing (25k beatmaps) only takes like 2 minutes for me and doesn't happen that often.
show more
Please sign in to reply.

New reply