Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#25 2008-05-01 10:52:03

aswihart
Member
From: Pittsburgh, PA
Registered: 2006-07-22
Posts: 345
Website

Re: smd_remote_file: Manage remote URL downloads via TXP's Files tab

I would think you could use it with anything, the ones that “make you wait 30 seconds” or whatever usually have a direct link somewhere on that “waiting” page that you could copy and paste.

Offline

#26 2008-05-01 10:54:46

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,456
Website GitHub

Re: smd_remote_file: Manage remote URL downloads via TXP's Files tab

nardo wrote:

does it only work with the services that allow a direct link to the file (as opposed to the ones that make you wait 30 seconds, etc)?

Yes I believe so; I’ve only used fileden in anger because they allow direct URLs. I would suspect any services with a time-out system in place would fail, however, sites that allow you to protect your files with a password should work, and prompt for p/w on download. Untested.

EDIT: As aswihart says, if you can hack the URL out of the ‘please wait’ page then even better. If it’s that simple why doesn’t everyone do it :-)

Last edited by Bloke (2008-05-01 10:59:38)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#27 2008-05-02 22:46:09

aswihart
Member
From: Pittsburgh, PA
Registered: 2006-07-22
Posts: 345
Website

Re: smd_remote_file: Manage remote URL downloads via TXP's Files tab

Bloke, just wanted to say, this is the dream plugin for me, you really outdid yourself. I spend an extra few cents each month with Amazon S3 to host a few movie files for my site. The number of files will continue to grow over time, meanwhile, I may actually downgrade my web hosting to the very minimal one with very low storage space. Most place give you like 10 gigs, I use “A Small Orange” (amazing customer service) and they give me just 400mb on a $5 / month plan. I’m thinking with your plugin I could get by with the “Tiny plan” that gives 75mb for $25 / year, not a huge savings probably, but cool nonetheless.

Do you think you could extend the plugin or write another one to work with remote images as well, retaining all the images functionality in Txp? That would be really sweet.

Last edited by aswihart (2008-05-02 22:47:30)

Offline

#28 2008-05-05 12:10:55

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,456
Website GitHub

Re: smd_remote_file: Manage remote URL downloads via TXP's Files tab

aswihart wrote:

this is the dream plugin for me, you really outdid yourself.

:-) Glad it’s useful. Certainly helps me out, as I have a fairly low bandwidth hosting plan too.

Do you think you could extend the plugin or write another one to work with remote images as well

I did consider it, and may still find a way to extend it for images as well. I wasn’t sure the bandwidth saving would be worth it — which is one of the reasons I went for the big fish of the Files tab first — but I guess with image-heavy or photography sites the bandwidth mounts up.

The only tricky part is that images don’t have the concept of file_download and with so many image/gallery plugins out there it would mean either a dedicated tag (which would be a direct replacement for <txp:image> and thus potentially rather limiting) or intercepting any image calls to the database from any image plugin. Not sure if that’s possible but I’ll certainly look into it when I have time and see if it’s feasible.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#29 2008-06-09 15:49:10

iblastoff
Plugin Author
From: Toronto
Registered: 2006-06-11
Posts: 1,197
Website

Re: smd_remote_file: Manage remote URL downloads via TXP's Files tab

oh sweet sugary balls bloke this is a great plugin! i’ve been away for a while but this was worth coming back to!

Offline

#30 2008-06-09 22:31:39

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,456
Website GitHub

Re: smd_remote_file: Manage remote URL downloads via TXP's Files tab

iblastoff wrote:

this is a great plugin! i’ve been away for a while but this was worth coming back to!

Thanks, and no probs. Glad it’s useful.

Good to see you back. I’ve been recommending your plugins to a whole bunch of people who have contacted me these past few months about image management and improving the admin experience.

P.S. you may have missed smd_query and smd_vars. Might be worth a look, even if it’s to scoff at the code or suggest improvements.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#31 2008-06-10 01:26:37

iblastoff
Plugin Author
From: Toronto
Registered: 2006-06-11
Posts: 1,197
Website

Re: smd_remote_file: Manage remote URL downloads via TXP's Files tab

oh btw, it seems <txp:smd_file_download_link> works as a container tag but as a single tag (<txp:smd_file_download_link id=”#” />) it returns the url with the .link still at the end plus an an additional double quote at the end so it looks like

http://blahblah.com/file_download/id/band-song.mp3.link"

just a heads up!

Last edited by iblastoff (2008-06-10 01:27:26)

Offline

#32 2008-06-10 08:36:14

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,456
Website GitHub

Re: smd_remote_file: Manage remote URL downloads via TXP's Files tab

iblastoff wrote:

<txp:smd_file_download_link> works as a container tag but as a single tag… it returns the url with the .link still at the end plus an an additional double quote at the end

Nuts, you’re right. Never tested it as a single tag and made a stupid assumption. Fixed in v0.43 | compressed

Thanks for spotting that.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#33 2008-06-11 18:07:24

hurty
Member
Registered: 2004-07-17
Posts: 28

Re: smd_remote_file: Manage remote URL downloads via TXP's Files tab

I have a site with a couple thousand mp3 files that I need to move to be served from Akamai. Currently I’m just serving those files from the files directory on the local server. I’d like to update the file listings in the textpattern database (in the files table) using an SQL query so I don’t have to pfutz with the Texpattern files tab interface and make the change one file at a time.

Once I have the plugin installed (which I will do when I upgrade to TXP 4.0.6) can I just change the value in the filename field in the files table to my Akamai URL with .link appended to the filename? I.E. is it sufficient to change filename from:

DCFC_DaytrotterSession_1.mp3”

to

“http://my.akamai-url.com/path/DCFC_DaytrotterSession_1.mp3.link”

??

Thanks! (changing a couple of thousand files, one at a time, using the TXP files tab is a task I could not imagine undertaking.)

Mark

Offline

#34 2008-06-11 18:44:09

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,456
Website GitHub

Re: smd_remote_file: Manage remote URL downloads via TXP's Files tab

hurty wrote:

can I just change the value in the filename field in the files table to my Akamai URL with .link appended to the filename?

Sadly, no :-(

Since URLs are not exactly valid file names (and base64ing them made them too ugly), all remote files are stored as standard placeholder text files in the files directory. They take on the filename of your remote file + “.link”, i.e. “DCFC_DaytrotterSession_1.mp3.link”. Inside each file is the full URL “http://my.akamai-url.com/path/DCFC_DaytrotterSession_1.mp3”. Optionally you can specify alternate URLs — one per line — inside the text file so the load can be spread if required. I guess in this case, one place to manage a few thousand mp3s is enough!

But all is not lost. You could do a <txp:file_download_list category="somecat" /> and add some PHP trickery inside a files form. With each file, grab its file_download_name, create a file in the files dir with the same name + .link, write the URL to it (I’m assuming each TXP file category will be a separate dir on the remote server, hence the category filter in the file_download_list), close the file then update that particular txp_file entry in the database, appending .link to the filename already there. And go and make a cuppa while it’s working.

[ I suppose you could even arrange to have the script FXP the files across too if you were so bold ]

I think that’s all you’d need to do(!) Best thing is to create a dummy file using the smd_remote_file interface, check what it creates in txp_file and in the files dir, compare it to a regular file and then emulate the changes programmatically. I did plan to offer an extra tag to move a file to a URL and back again but never managed it; it was quite complex to make a generic process, sorry.

Needless to say, backup first and test it on a small subsection of files :-)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#35 2008-06-11 19:57:20

hurty
Member
Registered: 2004-07-17
Posts: 28

Re: smd_remote_file: Manage remote URL downloads via TXP's Files tab

thanks for the quick response.

Just to clarify, then, the filename in files table in the textpattern database should be something like:

DCFC_DaytrotterSession_1.mp3.link

The file stored in the local files directory (“DCFC_DaytrotterSession_1.mp3.link”) is just a text file which contains the URL for the actual file, which in my case would be something like:

http://my.akamai.com/directory_path/DCFC_DaytrotterSession_1.mp3

Sounds pretty simple. I need to create an SQL query to change all the filenames listed in the files table, and a script to create a bunch of text files that have the proper URL in them.

Thanks Again!

Mark

Last edited by hurty (2008-06-11 19:58:23)

Offline

#36 2008-06-11 20:04:05

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,456
Website GitHub

Re: smd_remote_file: Manage remote URL downloads via TXP's Files tab

Yup. Enjoy!

And if you fancy sharing your SQL/script here it might help others in the same boat. Thanks in advance.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB