Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sun 21 Sep 2014, 08:18
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
Use FATSORT to sort mp3 files & folders alphabetically
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [14 Posts]  
Author Message
r__hughes

Joined: 13 Apr 2006
Posts: 342
Location: Canada

PostPosted: Sat 16 May 2009, 21:40    Post subject:  Use FATSORT to sort mp3 files & folders alphabetically
Subject description: For mp3 players that play files in the order they were saved
 

How to copy files/folders to a mp3 player alphabetically

My mp3 player has 2G base FAT32 memory & takes an additional FAT16 or FAT32 SD memory card.

It can handle folders, subfolders and sub-subfolders and keep all their files grouped properly - it also remembers the place in a file where it is stopped.

Just the thing I thought for audio-books where the files can be split into convenient 20-min segments.

But it will only play mp3 files in the order they were written to the memory card(s) - it doesn't read playlists & the onboard op-system can't sort filenames or folder names.

This puts me at the mercy of the copy algorithms used by the operating systems since I need the book chapters in the right order.

Puppy Linux can only do an alphabetic copy within folders by use of the 'select-all' icon in the top toolbar and a drag/drop to the target folder - this gets tedious and multi folder alphabetic copies don't work.

The solution is FATSORT - this is a command-line program that alphabetically sorts the FAT16/FAT32 name table of a memory card in a matter of seconds no matter what order you copied the files or folders!!!

I downloaded the (25K) fatsort-0.9.10-187.tar.gz from http://fatsort.berlios.de/
extracted it to / then compiled & installed as per included instructions. Fatsort installed to /usr/local/sbin which is not in the PATH declaration so I made a symlink to access it from /usr/sbin which is in the PATH

I can report that it works excellently on my frugal puppy411

The helpfile gives the following options:-
-------------------------------------------------
Usage: fatsort [options] device

Options:
-c Ignore case of file names
-f Force sorting even if filesystem is mounted
-h Print some help
-i Print file system information only
-l Print current order of files only
-o flag Sort order of files where flag is one of
d : directories first (default)
f : files first
a : files and directories are not differentiated
-n Natural order sorting
-d dir Sort directory dir only
-D dir Sort directory dir and all subdirectories
-q Be quiet
-r Sort in reverse order
-v Print version information

Device must be a FAT16 or FAT32 file system. FAT12 is not supported yet.

Example: fatsort /dev/sda
-----------------------------------------------------

Fatsort normally only works on unmounted devices.

FATSort Utility 0.9.10 by Boris Leidner <fatsort(at)formenos.de>
fatsort-0.9.10-187.tar.gz
Description  This version of fatsort available 16MAY09
gz

 Download 
Filename  fatsort-0.9.10-187.tar.gz 
Filesize  24.94 KB 
Downloaded  404 Time(s) 

_________________
--- quad booting pup431, Slacko55PAE, Slacko56NPAE (with OO3/LO4, devx, Gimp) & WXP on DELL Dimension 2400 PC & DELL Latitude 630 Laptop using grub.
---USB-Flash booting same on Samsung N110 WXP Netbook and Lenovo q100 WXP netPC.
Back to top
View user's profile Send private message 
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 11068
Location: Arizona USA

PostPosted: Sat 16 May 2009, 23:13    Post subject:  

When I first tried to use Puppy to load an audio book into my mp3 player I found that ROX loaded the mp3 files in some random order, which is the order the mp3 player played them. I discovered that if I open in ROX the folder containing the mp3 files I want to transfer to the mp3 player, ctrl-a to Select all the mp3 files then click 12 times the Change sort criteria icon at the top of the ROX window, when I drag the mp3 files to the mp3 player (which I also open With ROX) they will load in alphabetical (or numerical) order. Shocked
Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 5728
Location: Valåmoen, Norway

PostPosted: Sun 17 May 2009, 01:48    Post subject:  

Just to mention that Pmusic can copy files in the playlist to your mp3 player, and number the copied files to keep sort order on your mp3-player.
_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
r__hughes

Joined: 13 Apr 2006
Posts: 342
Location: Canada

PostPosted: Mon 18 May 2009, 12:34    Post subject:  

Thanks for all your comments - it seems that we have all experienced the same sort of copy problem.

Fatsort deals with my particular problem since my mp3 audiobooks are stored in the following manner

author folder -- eg A_Christie
series folder --- eg H_Poirot, M_Marples
book folder --- eg Murder_is_Announced
mp3 files --- eg 01_Murder_is_Announced etc etc

I sometimes copy all my A_Christie to the same SD card as another author eg B_Bova (Mars & Return_to_Mars). I copy all the nested folders as appropriate.

Fatsort arranges everything in the correct Author, Series, Book, mp3 file
order. (Previously I had to create each individaual folder/subfolder manually in the order I wanted then go back and populate each folder individually using the 'select-all' / drag'n'drop method. This could take over an hour with a full 2G SD card. Now with Fatsort I can bulk copy the nested folders in 10mins (with USB2) + 10sec for sorting.
Smile Smile Smile

_________________
--- quad booting pup431, Slacko55PAE, Slacko56NPAE (with OO3/LO4, devx, Gimp) & WXP on DELL Dimension 2400 PC & DELL Latitude 630 Laptop using grub.
---USB-Flash booting same on Samsung N110 WXP Netbook and Lenovo q100 WXP netPC.
Back to top
View user's profile Send private message 
Monsie


Joined: 01 Dec 2011
Posts: 633
Location: Kamloops BC Canada

PostPosted: Mon 19 Nov 2012, 01:37    Post subject: Use FATSORT to sort mp3 files & folders alphabetically  

Update:

Following a discussion in this thread over here about copying multiple files from one place to another in some sort of order, I came across FATSort as one of the possible solutions for this scenario.

Quote:
DESCRIPTION
FATsort sorts directory structures of FAT filesystems. Many MP3 hardware players don't sort files automatically but play them in the order they were transmitted to the device. FATSort can help here.


FATSort was last updated to V. 0.9.17 as of April, 2012 so I made a new package. I removed the /local directory in the source code, so it (FatSort) will be found in the regular location. Although this is a Pet it is a command line based utility only, for example:
Code:
fatsort -option path/to/device #or specifically
fatsort -c /dev/sdc1

The option above ignores the case of the letters in the filenames when sorting.

For specific help using FATSort, type:
Code:
man fatsort

at the terminal.

I compiled FATSort in Wary 5.3 but I expect it will work with any breed of Puppy. While this utility appears to have installed properly with no errors, I was not able to test it with an old mp3 player of mine... apparently because it's been sitting and gathering dust for a long time and needs a recharge... so for those who want to test this utility, your feedback on how well it works is welcome.

Monsie
fatsort-0.9.17.269-i486.pet
Description 
pet

 Download 
Filename  fatsort-0.9.17.269-i486.pet 
Filesize  14.67 KB 
Downloaded  375 Time(s) 

_________________
My username is pronounced: "mun-see". Derived from my surname, it was my nickname throughout high school.
Back to top
View user's profile Send private message 
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 11068
Location: Arizona USA

PostPosted: Mon 19 Nov 2012, 08:56    Post subject:  

I'm not clear on how Fatsort works. Does it first copy the stuff over to the mp3 player, then sort everything properly, or does it just create the proper directory structure in the mp3 player, then copy all the files into the correct place and in the correct order, more or less the way rsync -a seems to do?
Back to top
View user's profile Send private message 
r__hughes

Joined: 13 Apr 2006
Posts: 342
Location: Canada

PostPosted: Mon 19 Nov 2012, 16:55    Post subject:  

Fatsort doesn't copy anything - it sorts the File Allocation Table (FAT) of the requested device partition. It is assumed that the user has already named the directory/subdirectory/filenames in alphabetic order and that the operating system has copied the files to the mp3 device partition in some arbitrary order which results in a non-sequential playback order.

After Fatsort the operating system sees (via FAT) all directories and included subdirectories/files in the selected partition in alphabetic order but the original files are not moved in any way.

A non-intelligent mp3 player which relies on operating system access now plays music files or book chapter files in correct alphabetical order of directory/subdirectories/filename.

_________________
--- quad booting pup431, Slacko55PAE, Slacko56NPAE (with OO3/LO4, devx, Gimp) & WXP on DELL Dimension 2400 PC & DELL Latitude 630 Laptop using grub.
---USB-Flash booting same on Samsung N110 WXP Netbook and Lenovo q100 WXP netPC.
Back to top
View user's profile Send private message 
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 11068
Location: Arizona USA

PostPosted: Mon 19 Nov 2012, 22:26    Post subject:  

So Fatsort doesn't copy anything at all, it just sorts the files and directories in the mp3 player after they've been copied to it by another program such as cp or rsync?
Back to top
View user's profile Send private message 
Monsie


Joined: 01 Dec 2011
Posts: 633
Location: Kamloops BC Canada

PostPosted: Tue 20 Nov 2012, 03:34    Post subject: Use FATSORT to sort mp3 files & folders alphabetically  

Flash wrote:
So Fatsort doesn't copy anything at all, it just sorts the files and directories in the mp3 player after they've been copied to it by another program such as cp or rsync?


Flash, that's basically it. From what I have read, (and you probably know more about this than me) many mp3 players --especially the older ones-- are not able to store the music in any alphabetical or numerical order. Apparently, this is a limitation of FAT in that it reads the files in the order that it finds them. The fact that we can see files in order on a flash drive that is formatted either FAT16/32 is a function of the operating system which does the sorting for us. From further reading, some newer mp3 players can store the files in any given order, and I believe that others can store files alphabetically after a firmware update.

So, it turns out that there are such utilities for Windows users also, including a program with a gui called FATSort found here that was written by someone else... not the same person who wrote FATSort over here for Linux based systems Confused

I was not able to test FATSort on my mp3 player, as it seems to have bit the dust... However, I copied about 16 mp3 files to one of my FAT16 formatted flash drives, put them into a random order, and FATSort re-arranged the files alphabetically.

In further testing, I used another FAT16 formatted flash drive that had an assortment of files of all kinds, and I found that FATSort corrupted some of the files Sad So, even though some of the info at http://sourceforge.net/projects/fatsort/ seems to indicate this utility will sort any kind of file on a FAT formatted storage device, I did not find this to be the case... Furthermore, the developer indicated that he wrote this program especially for mp3 players. Therefore, I recommend only using FATSort for audio type files on a media player and if in doubt, be sure to have those files backed up.

Hope this clarifies things a bit,
Monsie

_________________
My username is pronounced: "mun-see". Derived from my surname, it was my nickname throughout high school.
Back to top
View user's profile Send private message 
chrome307


Joined: 15 Jan 2009
Posts: 713

PostPosted: Tue 20 Nov 2012, 05:22    Post subject:  

Attached pet for Lucid 528-005
fatsort-0.9.17.269-i686.pet
Description 
pet

 Download 
Filename  fatsort-0.9.17.269-i686.pet 
Filesize  14.71 KB 
Downloaded  379 Time(s) 
Back to top
View user's profile Send private message 
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 11068
Location: Arizona USA

PostPosted: Tue 20 Nov 2012, 09:00    Post subject:  

Monsie, thanks for the testing and the explanation. You more than answered my question about FATsort.

A typical case for me would be a folder containing 200 mp3 files of various sizes, but the size clusters around 1 MB. Copying the folder with the cp command or by dragging in ROX gives the same result. Cp copies them to my mp3 player in not exactly random order, but not strictly numerical order either. ROX seems to do the same, so perhaps it uses the cp command. I can force ROX to copy the files in strict numerical order, but the workaround is tedious and slow. Rsync -a seems to copy them in strictly numerical order. Today I'll be listening to the first book I copied with rsync, so pretty soon I'll know for sure if rsync -a did the trick. If it did, I won't need to use FATsort, but it's nice to know it's here if I do. Smile
Back to top
View user's profile Send private message 
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 11068
Location: Arizona USA

PostPosted: Fri 30 Nov 2012, 00:07    Post subject:  

I installed the fatsort .pet in Precise Puppy. When I enter
Code:
fatsort --help
in a console I get the list of options for fatsort. However, I get nothing but error messages of various kinds when I try to use fatsort on a directory full of mp3 files.
Back to top
View user's profile Send private message 
Monsie


Joined: 01 Dec 2011
Posts: 633
Location: Kamloops BC Canada

PostPosted: Sat 01 Dec 2012, 04:34    Post subject: Use FATSORT to sort mp3 files & folders alphabetically  

Flash,

To get help with fatsort, in the terminal I can type either:
Code:
fatsort -h

or
Code:
man fatsort


The latter command brings up a html file in the browser which I find easier to read and to follow.

That said, I find the directions a bit confusing because it appears that you can reverse the order in fatsort when specifying either the options or the device... for example, to sort a selection of mp3 files while ignoring the file letter case (upper or lower) I can type:

Code:
fatsort -c /dev/sdc

or
Code:
fatsort /dev/sdc -c

and both commands appear to work. I do prefer the syntax of the first command.

Now I haven't been able to fully test fatsort, because I wasn't able to use my old mp3 player. Further, when testing fatsort with a flash drive, I can only infer that fatsort is working from the output at the terminal, and this is because fatsort will not work on a drive that is mounted, and also because the operating system compensates by displaying the files in alphabetical order whether they are in actual order on the device or not.

It would be helpful to know what options you are trying to use and what kind of errors you are getting...

Here is a screen-shot of fatsort at the command line.

Hope this helps,
Monsie
fatsort.jpg
 Description   
 Filesize   13.72 KB
 Viewed   794 Time(s)

fatsort.jpg


_________________
My username is pronounced: "mun-see". Derived from my surname, it was my nickname throughout high school.
Back to top
View user's profile Send private message 
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 11068
Location: Arizona USA

PostPosted: Sat 01 Dec 2012, 11:20    Post subject:  

OK, I think I see what I did wrong. I tried to FATsort a single directory on a mp3 player rather than the whole drive. I'm afraid to run FATsort on the whole mp3 player for fear it will mess up the player's primitive operating system. Sad

Also, from your screenshot, FATsort apparently runs without giving any idea whether it did anything, unlike running rsync with the -v option.

On the other hand, rsync -av copies directories of mp3 files very fast and in the correct order, so there's no need for FATsort. Smile
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [14 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » HOWTO ( Solutions )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1036s ][ Queries: 12 (0.0045s) ][ GZIP on ]