Welcome Guest

Pages: 1
Sorting Disks in subdirectories
hoeniPostMay 1, 2014, 11:28
Newbie
Posts: 19
Registered:
April 30, 2014, 07:38
Normal topicSorting Disks in subdirectories

Hi,

Im trying to sort all albums consisting of more than one disk into a sub-structure:

Artist
+-AlbumWithOneDisk
+- Song
+- Song
+-MultiDiskalbum
+ Disc 1
+- Song
+- Song
+ Disc 2
+- Song
+- Song

First I tried to do that by using different file rename operations for single- and multidisk albums, but can't manage to create the subdir in the rename template as the '/' is escaped.

My next idea was to use the 'Move' operation. I read the disk number to Variable1 and then use 'Disc \v1' as a path element. But that didn't work out, as \v1 was taken literally.

Someone got an idea, what I could try next?

Thanks for any help, Hoeni

2MR2PostMay 1, 2014, 12:26
Avatar photo
Administrator
Posts: 2079
Registered:
August 23, 2012, 19:27
Normal topicRe: Sorting Disks in subdirectories

I'm assuming that the tracks are one level below your desired structure.

current: ....../music/album/tracks
desired: ....../music/artist/album{/Disc n}/tracks

If this is not what you want you'll have to tweak the Move statements in the following description. I'm also not renaming the tracks which you could do with a rename template in the Move statements.

I'm also assuming that the 'Disk Of' field is set, indicating how many discs there are. If not, you can calculate this via the 'Calculate Disc Of' function or menu item.

This should do it...(acton statements are in bold type)

Force Grouped Execution

- make sure each track is processed separately

Test if the numeric value of the Disc of field > "1" (Set result)

- test if you have more than one disc

if true

- execute the next few statements if more than one disc

Copy the Disc Field to Variable1
Make Variable1 numeric
Set Variable2 to 'Disc \v1'

- construct the 'disc' folder path. The 'Make numeric' step ensures a 'clean' number

Move to ../Artist/Album/Variable2/{filename}

- move/create the new multi disc folder structure. (Relative one level up)

else
Move to ../Artist/Album/{filename}

- If there is only a single disc do not create the 'disc' folder

endif

I've posted the action at:

http://2manyrobots.com/actions/MoveWithDiscFolder.zip

Unzip the file and import it via Yate>Import Preferences. Things to think about.

- possibly enable Select All in the Action Manager Window
- possibly use Album Artist as opposed to Artist

Have fun. 🙂

hoeniPostMay 1, 2014, 14:56
Newbie
Posts: 19
Registered:
April 30, 2014, 07:38
Normal topicRe: Sorting Disks in subdirectories

Hi,

thank you so much, that helps me with many missing parts to understand ...
I'm still struggeling with the relative paths though...

At the moment I don't process my complete library, but take one artist from the old lib to my "Operation room" directory for messing around. (For example for updating album art with perfectTunes in a virtual machine). Then I take album by album of that artist with drag and drop to Yate to edit and update metadata, rename files, etc..
This is where Yate comes in at the moment (taking more and more of the whole process. Yate seems to be the swiss army chainsaw of music library cleanup 😉 ). When everything is perfect, I move those files to the new and shiny library which only contains the new, clean stuff 🙂

So whenever I take a multidisk Album for editing the approach above works fine for the first time when the songs are in a flat structure. When I restart the action everything slides down one level.

Example:
Working on
Elliott Smith/2007 - New Moon/song a...
Elliott Smith/2007 - New Moon/song b...
the songs are flat inside that "2007 - New Moon" directory. I drag that "2007 - New Moon" folder to yate for editing it.

Now I start my action:
Elliott Smith/2007 - New Moon/Disc 1/song a...
Elliott Smith/2007 - New Moon/Disc 2/song b...
which is exactly how it should be

When I start that action again (which is is possible with all the other cleanup stuff it is performing), there will be
Elliott Smith/2007 - New Moon/Disc 1/Disc 1/song a...
Elliott Smith/2007 - New Moon/Disc 2/Disc 2/song b...

Next time I have 3 layers etc...

So how can I "anchor" that to the starting directory like the album name, which stays always inside the folder I dragged to Yate?

Hoeni
Image
Image

2MR2PostMay 1, 2014, 16:40
Avatar photo
Administrator
Posts: 2079
Registered:
August 23, 2012, 19:27
Normal topicRe: Sorting Disks in subdirectories

The action as pictured above should not run as Disk Of and Track Of are not valid in grouped execution mode.

This is tricky but I think I've got it.

I've written the action to copy as much of what you are doing above. You will have to insert your Run External statements. BTW: I am going to add exclusions to the Move non Audio Files and Delete audio files so that you do not have to call an external script.

As long as you drag the 'album' folder it seems to me that it is doing what you want. You can run the action multiple times without having a nesting effect. The Album folder and Disc folders will be named appropriately. The parent folder of the Album folder is assumed to be correct.

The action can be found at:
http://2manyrobots.com/actions/MoveWithDiscFolder2.zip

When imported you will get an action named MoveWithDiscFolder2 and two rename templates named:
H: Track & Folder
H: TrackP2 - Title

Looks good to me 🙂

hoeniPostMay 2, 2014, 13:20
Newbie
Posts: 19
Registered:
April 30, 2014, 07:38
Normal topicRe: Sorting Disks in subdirectories

Hi,

wow. That does the trick. 🙂 Thank you for your effords!
While I'm trying to understand waht you're doing in there, I see that I still can't understand clearly what exact are the impacts of 'grouped' and 'stepwise' execution. Even when I look around in the function descripions, maybe I'm just overlooking it...

Regarding the shell scripts, now that I had included them anyway I started to use them for lots of other stuff like converting my old Windows EAC logfiles from UTF16 to UTF8 and renaming them and so on... But I'm looking forward to that file exception though, the more I can handle inside Yate, the better. 🙂

# Any logfiles in UTF-16? Convert to UTF-8
for i in `find . -type f -depth 1 -iname '*.log'` ; do
hexdump -n2 "$i" | grep -q '0000000 ff fe'
if [ $? -eq 0 ] ; then
iconv -f UTF-16 -t UTF-8 "$i" > "$i.tmp" && mv "$i.tmp" "$i"
fi
done

# Rename EAC.log
EACLOG=`grep -sl 'EAC extraction logfile' *.log|head -1`
if [ 'x' != "x$EACLOG" -a "x$EACLOG" != "x./eac.log" ] ; then
mv "$EACLOG" eac.log
fi
EACLOG=`grep -sl 'Exact Audio Copy V' *.log|head -1`
if [ 'x' != "x$EACLOG" -a "x$EACLOG" != "x./eac.log" ] ; then
mv "$EACLOG" eac.log
fi

# Canonical Folder.jpg capitalization
FOLDERJPG=`find . -type f -depth 1 -iname 'folder.jpg'|head -1`
if [ 'x' != "x$FOLDERJPG" -a "x$FOLDERJPG" != "x./Folder.jpg" ] ; then
mv "$FOLDERJPG" Folder.jpg
fi

Best Regards, Tobi

2MR2PostMay 2, 2014, 13:40
Avatar photo
Administrator
Posts: 2079
Registered:
August 23, 2012, 19:27
Normal topicRe: Sorting Disks in subdirectories

Here's the 2 cent Stepwise/Grouped explanation:

file1, file2, file3. Action contains func1,func2,func3

stepwise execution: file1 func1, file2 func1, file3 func1, file1 func2, file2 func2, file3 func2, file1 func3, file2 func3, file3 func3

groupwise execution: file1 func1, file1 func2, file1 func3, file2 func1, file2 func2, file2 func3, file3 func1, file3 func2, file3 func3

Groupwise execution treats an entire action as a single statement. Stepwise actions can call groupwise actions but the reverse is not true.

More information off the main help page under 'Topics: How Actions Execute'

I'm glad the script worked.

Regular Expression Replace and exclusions in Delete Non Audio Files and Move Non Audio Files are implemented and will be released in v2.7.3 shortly. 🙂

I must confess that I don't personally use Run Script all that much. However, whenever I add a new album, my standard workflow uses Run Application to launch a compiled AppleScript to tell my Sonos system to update its library.

Pages: 1
Mingle Forum by Cartpauj | Version: 1.1.0beta | Page loaded in: 0.036 seconds.