How to write script to download spreadsheet? - download

Yahoo Finance provides spreadsheets of historical data for every symbol. But I don't want to download each of them manually. Is there any way I can write a script to download all of them? For example, I have a list of symbols in a file. I'd like the script to go through the file, and download the spreadsheet for that symbol in a specified directory.
Edit: I'm on OSX 10.8.3

If your OS is linux based just do
wget "download path1"
Read more here
http://www.simplehelp.net/2008/12/11/how-to-download-files-from-the-linux-command-line/
If you are using Windows :
Follow this
http://gallery.technet.microsoft.com/scriptcenter/files-from-websites-4a181ff3

A simple http get on the download link worked.

Related

How to change the path/filename format iTunes organises files

first, I know this is a question is asked very frequently all around the internet. And in 99% the answer is 'it's not possible'.
BUT I'm sure I had a solution once.
I just can't remeber the site. I even can't remember the key words I searched for.
Question:
How can I change/define the path and filename (the format of it) iTunes stores the media, if I let iTunes organise my media?
I would like to have a format like
.../artist/if[album]/artist - title.mp3
I know there is a solution!
If I remember correctly, I had to change something in a xml file.
Note: It might be, that it's not possible with the current version of iTunes.
I don't have an actual answer but I used the keywords 'itunes directory structure xml' and got Folder Structure in iTunes.
One link to About iTunes library files shows how to access the xml file and unfortunately also says this:
The iTunes Library.xml file is no longer used by the latest versions of Apple media applications on OS X Yosemite and later.
Once I had this, I googled 'itunes song artist album directory structure library.xml'. This had many links including Hacking iTunes which looks like it covers everything relevant to this subject.
Hope this helps...
The iTunes library is stored as XML in a file called iTunes Music Library.xml. Using OSX you can find it using command line or Finder at the path:
I think you speak about the XSLT script to generate album listing from iTunes XML or the fantastic iTunes podcast XML generator (you can find this kind of tool when you searching for "itunes xml generator") but here you can modify your playlist, I knew there is no way to change song filenames.
Unfortunately, as explained in the Apple support, "The iTunes Library.xml file is no longer used by the latest versions of Apple media applications on OS X Yosemite and later.." .
In fact, since the iTunes version 12.2 the program does not create XML files. But, as explained in the support page, if you want to re-make the XML files you can change this setting by flag this option:
So , what can be the solution? I think you can work with your XML files to change whatever you want with scripts or online tools as explained above, change your song filenames as recommended here below and , then, try to rebuild your iTunes library:
How to change your song filenames as you wish? You can find tons of multiple filename changer scripts but I think the best you can use is a specific program for Windows called The godfather (the fact that the program have this name and I am Italian is a pure coincidence..), maybe there are also other programs like that but this one doing exactly what you are looking for (some details about it)
A good OSX alternative to the godfather for Windows, according to the alternativeTo site, seems MusicBrainz which make similar things but I've never tried it.

Encoding of SMS-files from Nokia backup (.nbf)?

I am using a Mac and have a Nokia phone. Therefore I cannot sync it with my computer, but I found out, that making a backup on the creates a .nbf-file, which contains all the data I want (contacts and messages).
The contacts are stored easily accessible as vCards, so that's cool. Unfortunately the messages are stored each text separately in one file, which looks pretty weird when I open it with a text editor (for example TextWrangler). I can see the numbers and the text, but no information about date.
I uploaded the file here: http://www.4shared.com/file/7LNsuPbF/00000A123EB640F500002010005000.html
I already tried out different encodings, but it never looks good.
Maybe someone has a clue how to read that file? Could it be encrypted or something?
Try https://sourceforge.net/projects/nbuexplorer/ - it should be able to open .nbf files.
It is/was a C# project, and it only provides Windows exe as release download, however, I could get this .exe to run on Ubuntu 18.04 using mono; and I could also get the project sources to compile on Ubuntu using xbuild (the result again being an .exe file that can be run with Mono), see comments in my build script get-nbuexplorer.svn.sh.

Lua Love2D - How can I make it download a file?

Title. It's only allowed to save to a certain directory, but is there a way of making an executable made with it update itself? I've got the code to check if it's out of date (HttpGet), but not sure how to intall the newer update.
Main reason is people are complaining about having to repeatedly redownload my RPG. Would it be easier to package it with a C# auto-Updater they can run?
You can not make the .love file "update itself". That is not possible, unless you use the operative system's package manager or something similar (apt-get in Ubuntu, the app store on mac, and whatever microsoft uses, if it has it).
If you don't want to do that, then the second best way to make that work would be making your love2d executable a "shell"; an "empty game" that simply downloads stuff from the internet, and later on it executes some function that initializes everything, including the proper game.
As jpjacobs says, you can download stuff from the web using LuaSocket (which is already included in LÖVE 0.7). For example, this is how you download a png (I've copied the code from here):
if not love.filesystem.exists("expo.png") then
local http = require("socket.http")
local b, c, h = http.request("http://love2d.org/w/images/e/e3/Resource-AnalExplosion.png")
love.filesystem.write("expo.png", b)
end
There's also a way to uncompress data using the GNU unzip algorithm using pure lua. It's implemented by the /AdvTiledLoader/external/gunzip.lua file in Kadoba's Advanced TileLoader.
So I guess you can make a game that:
Starts by reading a file called version.lua, and comparing it to a file in your server (http://www.your-server.com/latest-version-number). That file simply contains a number, like "48".
If no file and server could not be contacted, then error "could not download game".
If no file, or current version < latest version from the server, download zip file from server (http://www.your-server.com/latest.zip)
If latest.zip downloaded successfully, erase everything inside the /latest directory and uncompress latest.zip on the new latest. Update version.lua with the new version (return 48)
Detect when you are working offline - If could not download latest.zip or version, but there's already a version.lua and latest folder, give just a warning, not an error.
Require the file that contains the real game; probably something like require 'latest.main'
Notes:
I'm not familiar with luasocket. It is possible that there's a way to get the 'last updated' date from http://www.your-server.com/latest.zip, so you can simply get rid of the latest-version-number stuff.
I haven't used gunzip.lua myself. I don't know how it handles multiple files, or directories.
My first guess would be using LuaSocket. You can have a small file containing the current version number, have that downloaded on startup, and then decide whether an upgrade is necesarry or not.

MacOSX open file with an application: where does it go to?

I posted this basic question before, but didn't get an answer I could work with.
I've been writing applications on my Mac, and have been physically making them into .app bundles
(i.e., making the directories and plist files by hand). But when I open a file in the application by right clicking on the file in finder and specifying my app, how do I then reference that file?
I mostly use python, but I'm looking for a way that is fairly universal.
My first guess was as an argument, as were the answers to my previous post, but that is not the case.
Py:
>>> print(sys.argv[1:])
'-psn_0_#######'
Where is the file reference?
Thanks in advance,
The file is passed by the Apple Event, see this Apple document. You need to receive that from inside your Python script. If it's a PyObjC script, there should be a standard way to translate what's explained in that Apple document in Objective-C to Python.
If your script is not a GUI app, but if you just want to pass a file to a Python script by clicking it, the easiest way would be to use Automator. There's an action called "Run Shell Script", to which you can specify the interpreter and the code. You can choose whether you receive the file names via stdin or the arguments. Automator packages the script into the app for you.
This is not an answer but it wouldn't fit in the comments. To respond to #Sacrilicious and to give everyone else insight on this:
#Sacrilicious You're talking about something different. Download this sample application, it's a python script wrapped as an "App". Look inside and find a 4-line python script: myscript.app/Contents/MacOS/myscript - which will print the arguments using
file = open("/tmp/test.txt", "w")
file.writelines(sys.argv[1:])
Stick it in your Applications folder. Then right click some file and choose "Open With" and select this myscript.app.
Now take a look at /tmp/text.txt and you'll see that something like -psn_0_####### is there and not the name of the file you had selected "open with". This is because the file is passed using Apple Events and not a filename as an argument.
So this question is asking how can you access the filename of the thing that was passed in the python script wrapped in an OS X .app application wrapper, and if someone can let me know that they'll get the Bounty :)
Are we referring to the file where per-user binding of file types/extensions are set to point to certain applications?
~/Library/Preferences/com.apple.LaunchServices.plist
The framework is launchservices, which had received a good amount of scrutiny due to 'murkiness' early in 10.6, and (like all property list files) can be altered via the bridges to ObjectiveC made for Python and Ruby. Here's a link with Python code examples for how to associate a given file type with an app.
I've never heard of it being done without a Cocoa / Carbon wrapper.
I described how to link certain filetypes to py2app-bundled Python applications at https://moosystems.com/articles/8-double-click-on-files-in-finder-to-open-them-in-your-python-and-tk-application.html

Downloading Dropbox files one by one with wget

I have some huge images in a folder on the web version of Dropbox that I need to make a shell script to download them one by one (There isn't enough room on my SDD and can't download the whole folder). I know using "wget" I can download a file:
wget link_to_the_file
However since I have many images it is not feasible to get the download link of each of them manually. I'm looking for a way of obtaining downloading link for each of them through the shell. Any suggestions?
Dropbox offers an API you can use to write a program to list and download multiple files.
For instance, you can use /2/files/list_folder[/continue] to list files, and then use /2/files/download to download them.
Those are links to the HTTPS endpoints, but there are corresponding native methods in the official SDKs, if you want to use one of those.

Resources