I have done a lot of research but I can find a way to get the url of a file already downloaded..
I want to get the urls to make a program to sort my files by them.
If anyone have an idea to get that or to make that in an other way im glade to hear it !
Sorry for my bad English !
I doubt that it is in general possible, because data like these is not stored in file's metadata. If your script makes the download, you can save the link in code and then use it to sort your files, but if files are downloaded by the user it is impossible.
Related
I'm doing python coding self study and not a programmer.. this is my first entry here. Not sure if this is doable, (I have a very little knowledge about programming) but here it is.
Is it possible to insert a file, like a template, for the user to download in a standalone program? Tried searching online but have not been successful, maybe I just don't know how to term it.
Any suggestion is very welcome.. thanks in advance..
When user clicks 'Download template', they can download an Excel template
User can download the template that I inserted in a program, that is if inserting file in a standalone program is possible.
I think what you are asking is if you can embed a file into the .py itself (which is what I think you mean when you are saying standalone), to which the answer is no. It might be possible to compile the program into an exe using pyinstaller, but not sure how efficient or feasible that is.
If you really need this to be only one .py, I would suggest hosting it somewhere online for free and having python download the file from the url.
If I am being honest, the best way to go about doing this is to ditch the "standalone program" requirement and just shipping the template in a zip file with the .py file.
Edit: Creating the file on-demand
This slipped my mind as an idea (probably because it is the most involved and difficult way to do it), but you may be able to use something like XSLX writer to create the excel file on demand. Would require you to code a function that makes a brand new excel file from scratch, but this would not require downloads, zip files, or an executable, so it would be truly standalone (minus the added pip dependency).
Be warned though, I think python and XLSX can be finicky at times.
I have a problem with links on my website. Please forgive me if this is asked somewhere else, but I have no idea how to search for this.
A little background on the current situation:
I've created a python program that randomly generates planets for a sci-fi game. Each created planet is placed in a text file to be viewed at a later time. The program asks the user how many planets he/she wants to create and makes that many text files. Then, after all the planets are created, the program zips all the files into a file 'worlds.zip'. A link is then provided to the user to download the zip file.
The problem:
The first time I run this everything works perfectly fine. When run a second time, however, and I click the link to download the zip file it gives me the exact same zip file as I got the first time. When I ftp in and download the zip file directly I get the correct zip file, despite the link still being bad.
Things I've tried:
When I refresh the page the link is still bad. When I delete all my browser history the link is still bad. I've tried a different browser and that didn't work. I've attempted to delete the file from the web server and that didn't solve the problem. Changing the html file providing the link worked once, but didn't work a second time.
Simplified Question:
How can I get a link on my web page to update to the correct file?
I've spent all day trying to fix this. I don't mind looking up information or reading articles and links, but I don't know how to search for this, so even if you guys just give me links to other sites I'll be happy (although directly answering my question will always be appreciated :)).
I don't know anything about Python, but in PHP, in some fopen modes, if a file is trying to be made with the same name as an existing file, it will cancel the operation.
I've been slowly writing a little project to create a Movie/TV Show/Music ID3 tag editor that can be used on batches of files from my iTunes library. I started designing the GUI in python after finding a bunch of ID3 tag editors here: http://wiki.python.org/moin/UsefulModules#ID3Handling
Unfortunately when it came time to set up the actual ID3 tag editor I discovered that none of the libraries on the page, or any of the other ones that I found, like eyeD3, could handle actual movie files. I've already put a lot of effort into the python app and I was hoping someone could tell me one of three things (if not, I have to switch to Java, which, according to an earlier post apparently has a library for handling mp4 files' ID3 tags):
Is there some library/package that you know can be used to edit the ID3 of MOVIES (the vast majority of the stuff out there that I've been able to find, and I have done my homework well on this, is for audio only) MP4 files specifically.
I have to point out that eyeD3 was actually great for mp3's and REALLY easy to use, so the more like eyeD3 the better.
Is there some sort of file reader-like library that would allow me to read the entire file, change the ID3 tag to what I want, and then write it. In desperation I tried to open the MP4 file with notepad++ and found that the first line of the file is the ID3 tag, but I was unable to decode it. If you guys know something on this level, like how to go in and edit it manually with python, then that would be appreciated.
or
Some sort of script in another language which I would be able to execute with python (keep in mind however that I only know Java and Python at the moment), but this would have to be something ridiculously simple to use like:
edit_MP4_Tag(filename, title, artist, etc...) which I doubt exists.
Thanks in advance for any help.
Massively overdue, but if you're on OSX, you can use appscript to alter metadata via iTunes itself, which is very easy if slow.
The great thing about this is that it works on any kind of media and you can alter iTunes-specific metadata, too.
If not, you can use Atomic Parsley via subprocess or similar.
To start, I do not know much about python so I'm just gonna give you my 2 cents as no one answered you yet.
Second, if you know where in the string is the id3, it should be workable. You will need to write your code from scratch as there is nothing really out there for id3 in python in movies.
Now, this all has to do with STRING and SUBSTRING. You got to open the file and grab the substring you need and modify with try and fail. A great example, is made in this by Prashant Khandelwal.
Good luck.
im working a project lately to get download progress info remotely when im away.
i googled a bit but i couldnt find any useful info. on this issue
im using Internet Download Manager.
please help :/ i appreciate any suggestions
im thinking about making software with python but Also C is Ok. if there is a solution
I dont know exactly how to do it but you can get IDM download progress( such as Transfer rate, TimeLeft... ) by reading the values of the ListView of Internet Download Manager windows (they call it "hook"? )
i just found idm has log file for every download in its temporary folder im trying to parse information from log file i dunno if it is possible sync.ly get info..but i'll try
ive looked through the current related questions but have not managed to find anything similar to my needs.
Im in the process of creating a affiliate store using zencart - now one of the issues is that zencart is not designed for redirects and affiliate stores but it can be done. I will be changing the store so it acts like a showcase store showing prices.
There is a mod called easy populate which allows me to upload datafeeds. This is all well and good however my affiliate link will not be in each product. I can do it manually after uploading the data feed and going to each product and then adding it as an image with a redirect link - However when there are over 500 items its going to be a long repetitive and time consuming job.
I have been told that I can add the links to the data feed before uploading it to zencart and this should be done using python. Ive been reading about python for several days now and feel im looking for the wrong things. I was wondering if someone could please advise the simplest way for me to get this done.
I hope the question makes sense
thanks
abs
You could craft a python script using csv module like this:
>>> import csv
>>> cartWriter = csv.writer(open('yourcart.csv', 'wb'))
>>> cartWriter.writerow(['Product', 'yourinfo', 'yourlink'])
You need to know how link should be formatted hoping that it could be composed using the other parameters present on csv file.
First, use the CSV module as systempuntoout told you, secondly, you will want to change your header to:
mimetype='text/csv'
Content-Disposition = 'attachment; filename=name_of_your_file.csv'
The way to do it depends very much of your website implementation. In pure Python you would probably do that with an HttpResponse object. In django, as well, but there are some shortcuts.
You can find a video demonstrating how to create CSV files with Python on showmedo. It's not free however.
Now, to provide a link to download the CSV, this depends of your Website. What is the technology behinds it : pure Python, Django, Pylons, Tubogear ?
If you can't answer the question, you should ask your boss a training about your infrastructure before trying to make change to it.