Textpattern CMS support forum

You are not logged in. Register | Login | Help

#41 2008-06-14 14:16:28

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

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

Okay — I looked a little closer at the database, and with your helpful explanation, I can see why my counter isn’t working.

I had to upgrade to TXP 4.0.6 from 4.0.4 in order to be able to use the plugin. There are several new columns in the file table that did not exist in 4.0.4 — size, created, modified, and status. When I upgraded, TXP did not update the size column, so all the files have a size of “NULL.” If I manually update the .link file by overwriting the URL using the form field your plugin provides in the TXP admin interface, the size field is properly updated and downloads are then counted for that file.

What I need to do is find a way to force Textpattern to re-update the size column for all the rows in the table without having to go through the Admin UI and update each file, one-by-one. Any clues on how I might do that?

As for the download versus delivering the file to a browser window problem — I am convinced that it’s an issue with how the Akamai server is configured. I’m working on that problem from a different angle. If I find that there’s a way to finesse the issue from within Textpattern, I’ll report back.

Thanks, Bloke, for the help!

Mark

Offline

#42 2008-06-14 14:38:50

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,787
Website

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

Glad you (sort of) found the problem.

hurty wrote:

What I need to do is find a way to force Textpattern to re-update the size column for all the rows in the table without having to go through the Admin UI and update each file, one-by-one. Any clues on how I might do that?

Erm, ummm, errrr… ruud? :-) Anyone?

Sorry, no idea at the moment. If I have a brainwave I’ll yell.

Last edited by Bloke (2008-06-14 14:39:11)


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

#43 2008-06-14 17:09:04

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

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

okay — I couldn’t figure out a way to force textpattern to automatically update the size column in the file table, but it was easy enough to write a php script that grabbed the filename and the filesize from the filesystem and save the results of that script as an SQL query, which can insert the filesize for each file in the size column in the table.

Here’s that query:

  UPDATE txp_file SET size = CASE filename
      WHEN 'DCFC_DaytrotterSession_1.mp3.link' THEN '2129403'
      WHEN 'DCFC_DaytrotterSession_2.mp3.link' THEN '2759231'
          [ ... repeat 1500 times ...]
      ELSE size END

Which gets me most of the way to the goal. Last thing is to figure out how to force AKAMAI to honor the content disposition headers so that the file is delivered as a download and not displayed in a browser window.

Mark

Offline

#44 2008-06-14 17:14:18

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,787
Website

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

Nice!

Thanks for keeping us updated on your progress. The server config part is where I bow out graciously and leave it to people who understand stuff like 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

#45 2008-08-20 04:01:22

marazmus
New Member
Registered: 2006-04-25
Posts: 9
Website

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

Hello.

Can you add the “show and edit current (existing) remote link(s)” feature, please?

I mean, when I click “edit file”, Textpattern should show me current remote URL assigned to this file. And I can edit them.

Thank you.

Offline

#46 2008-08-20 11:12:27

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,787
Website

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

marazmus wrote:

Can you add the “show and edit current (existing) remote link(s)” feature, please?

It’s a nice idea and I’d like to offer that, but I don’t know how to do it. My early attempts when initially writing the plugin failed :-( Since it’s not possible to edit normal ‘local’ files from the TXP interface, do you know any way I can make remote files behave differently? At no place in the current interface is there anywhere that allows you to download the file from the files directory, edit it and re-upload it automatically, nor a facility to edit the file in situ.

Off the top of my head, the only option open to me is to (somehow) read the contents of the .link file and display each URL in a list (a column of text boxes?), somewhere in the edit window. Then, if you edit the URLs, they are written back to the file again when you hit ‘save’. Normally, any edits in that window only change what’s stored in the database so to edit the files as well is not a simple change.

The other problem with that approach is that the remote filename is tied to the local file; the filenames MUST match or it all falls apart (it’s the same reason you cannot edit the filename of the file once it’s uploaded; the file itself is not touched, only the database details that relate to the file are updated). If I could restrict editing to the ‘path’ part of the URL only, that would perhaps be better. Might be a way of doing that universally, if I put my mind to it but I’m not sure at this stage.

At the moment, the simplest thing to do is probably to use a text editor that is capable of editing and auto-re-uploading files on servers. Then you can open the .link files directly from your desktop, edit the URLs and hit save, triggering the upload.

Of course, if you or anyone else can think of a way of handling this situation cleanly in the plugin, then please let me know. It would be a very useful feature.


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

#47 2008-08-20 11:39:45

marazmus
New Member
Registered: 2006-04-25
Posts: 9
Website

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

Bloke wrote:

Off the top of my head, the only option open to me is to (somehow) read the contents of the .link file and display each URL in a list (a column of text boxes?), somewhere in the edit window. Then, if you edit the URLs, they are written back to the file again when you hit ‘save’. Normally, any edits in that window only change what’s stored in the database so to edit the files as well is not a simple change.

You’re absolutely right. Ok, I just will try to explain my situation. I have many large files, and uploading they via ftp only. No “inner” uploads from Textpattern, because they are large (up to 500 Mb). And the tasks steps is simple:

1) upload file via ftp
2) create new file link in Textpattern and use remote URL via your plugin
3) publish link in article or news or elswhere in this Textpattern site

Okay, let’s differ situation. Now we have another server (mirror) for our files. We should use remote URL’s in ONE file link. But I can’t see from Textpattern admin side what link’s IS used. Only go to ftp and see .link file manually. We need there just a way to parse .link file, create inputs for remote URL’s and fill them with URL’s that .link file contains. Then edit and save they to .link file again.

The other problem with that approach is that the remote filename is tied to the local file; the filenames MUST match or it all falls apart (it’s the same reason you cannot edit the filename of the file once it’s uploaded; the file itself is not touched, only the database details that relate to the file are updated). If I could restrict editing to the ‘path’ part of the URL only, that would perhaps be better. Might be a way of doing that universally, if I put my mind to it but I’m not sure at this stage.

Yes, “edit path” feature. Yes, this is mean that you really know what you do when changing the path of the file, but this is not plugin problem :)

At the moment, the simplest thing to do is probably to use a text editor that is capable of editing and auto-re-uploading files on servers. Then you can open the .link files directly from your desktop, edit the URLs and hit save, triggering the upload.

Got it :) I’m using it, but changing paths from inside Textpattern will be really cool :)

Of course, if you or anyone else can think of a way of handling this situation cleanly in the plugin, then please let me know. It would be a very useful feature.

I’m not the programmer, only “txp tag user” :) But maybe some programmers will see our problem and help us.

p.s. Way to change path of file links will give us simple download system. Not so monsteriously like PAFileDB or OLate Download, but functionally cool. Upload file from Txp inside, or upload file via ftp and use remote URL. If remote URL was broken (site is down, at example), just place file to another server and change path.

Offline

#48 2008-08-20 11:56:13

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,787
Website

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

marazmus

Thanks for clarifying. I think we are on the same page. Yes, it would be cool to do this. Yes I’d like to do it now I’ve thought about it these past few minutes. Yes, if I can figure it out, I will do it. When that takes place I currently cannot say, sorry. I have this new plugin hanging round my neck which desperately needs finishing, some updates to smd_if planned and I really want to revisit smd_query and smd_vars to get them roadworthy. After that I’ll probably look at this.

Yes, “edit path” feature. Yes, this is mean that you really know what you do when changing the path of the file, but this is not plugin problem :)

True, I could put it as a disclaimer, but since TXP itself disallows editing of the filename I should probably do likewise. Will think about it.

If remote URL was broken (site is down, at example), just place file to another server and change path.

Yes. But with a lot of files, this is cumbersome. The ability to add more than one URL and pick randomly was a nice idea I had but it’s incomplete. I did start work a long time ago on a companion plugin called smd_ping that checked remote files for a (set) timeout period and if no response was received would take one action or another. I intended to either use that or build something similar into this plugin so the choice of server was not entirely random but based on a fixed, random, start point and a test for “is the server up”. If not it’d try another random server until it found one that worked or exhausted the list. Yet again, it never made it past dev status before I moved on. One day…!


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

#49 2008-08-20 12:15:28

marazmus
New Member
Registered: 2006-04-25
Posts: 9
Website

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

Thanks for clarifying. I think we are on the same page. Yes, it would be cool to do this. Yes I’d like to do it now I’ve thought about it these past few minutes. Yes, if I can figure it out, I will do it. When that takes place I currently cannot say, sorry. I have this new plugin hanging round my neck which desperately needs finishing, some updates to smd_if planned and I really want to revisit smd_query and smd_vars to get them roadworthy. After that I’ll probably look at this.

Okay, I’m not boring you, this is only “feature request” :)

True, I could put it as a disclaimer, but since TXP itself disallows editing of the filename I should probably do likewise. Will think about it.

In the ideal case, there should be an option in Advanced Settings. Something like “Allow changing paths in file links (on Files tab)”.

Yes. But with a lot of files, this is cumbersome. The ability to add more than one URL and pick randomly was a nice idea I had but it’s incomplete. I did start work a long time ago on a companion plugin called smd_ping that checked remote files for a (set) timeout period and if no response was received would take one action or another. I intended to either use that or build something similar into this plugin so the choice of server was not entirely random but based on a fixed, random, start point and a test for “is the server up”. If not it’d try another random server until it found one that worked or exhausted the list. Yet again, it never made it past dev status before I moved on. One day…!

“Is file live?” ping feature will be really cool :) You can add this as option in smd_file_download_link. Something like choose=“live” :)

Okay, just crossing fingers and waiting for :) Thank you.

Offline

#50 2009-04-27 10:32:29

kostas45
Member
From: Greece
Registered: 2007-11-08
Posts: 61

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

Hi Stef,

This is a (I hope not pushy) reminder about the bug described as:
URL does not resolve (even if the file is accessible via http://) when the remote file is actually not remote, but at same domain TXP is installed.
Thank you for all your great work :-)

-Kostas

Offline

Board footer

Powered by FluxBB