Exporting Script


Every Sunday morning, I have to post a couple files up to a website. While retaining the previous 8 weeks in descending order.

I have an export script right now, that generates the audio.xspf file correctly, but it requires a couple manual steps before execution.

  1. select latest audio file
  2. run Action to generate tags, and correctly name file for web posting
  3. sort file names in descending order
  4. select all files
  5. run the export "xspf generator"


$filename(audio.xspf)<?xml version="1.0" encoding="uft-8"?>
    <annotation>%title% - %artist%</annotation>

Is there an export command that I can add to the xspf generator that will select all files, and sort them by filename in descending order? I want to reduce the chances for error since I'm going to be handing the process off to the operators soon.

Thank you for your help.

Use $loop(%_filename%) or $loop(%_path%) instead of $loop(a) for correct sorting.

Thanks For trying Pone...

Unfortunately, the %_filename% or %_path% don't appear to sort the files in the order of newest to oldest. That is why I use the screen layout sort of $loop(a).

The list of files defaults to before processing:
(new) 2012-03-05 - junk - Artist - Title
(new) 2012-03-02 - junk - Artist - Title
(late arrival) 2012-03-04 - junk - Artist - Title (2012-03-06 arrival)
(new) 2012-03-06 - junk - Artist - Title
(replacement) 2012-03-02 - junk - Artist - Title

The action file I have converts the names to the right format, and places the tags, but the sort is still incorrect.

I need the output sort to be this way (newesst to oldest).

$loop(%_filename%) and $loop(%_path%) sort by filename and path.
The problem seems to be your (new) / (late arrival) / (replacement) expressions in your filenames. These crash your own system for sorting after date.

that should ignore everything before the first number

I don't know what these date means, but maybe these placeholder can also help you for sorting your files:
%_file_create_date% Short creation date
%_file_create_datetime% Long creation date

%_file_mod_date% Short modification date
%_file_mod_datetime% Long modification date

sorting from newest to oldest is complicated as you have to reverse the sorting.
If you can extract the numbers, it is possible.

This should work if all files have the date in the YYYY-MM-DD format somewhere in the title. For files which have the more that one date (like I see it in your example) the first date will be taken for sorting. If you want the second date, leave the ? away in the $loop string.

Hi Pone

Thanks for your help on this. The $loop($sub.... worked in the test run. I'll try it on the production script later. I think I might just save the output to a filesorting feild for later use too.

Sorry the second date added confusion. I was orriginally planning to show why I can't count on the placeholders. I forgot to delete that part of the line.
All I can go on is the information provided in the filenames, which thankfully is always the same pattern.
After the action script runs. The filenames are just CodeDate_Title.