INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Replace Special Characters  (Read 10137 times)

jeffcdo

  • Recent member
  • *
  • Posts: 41
Replace Special Characters
« on: August 21, 2015, 09:33:59 am »

I'm in the process of backing up my music library to OneDrive, which doesn't like special characters.  Is there a way to configure JRiver (other than manually) to replace special characters in folder/directory names?  For example, an artist like Béla Fleck, the é is a problem for OneDrive.
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Replace Special Characters
« Reply #1 on: August 21, 2015, 10:01:22 am »

This is a tough one.  I'm going to assume that your tags (Album, Artist, Name, etc) have these same non-ascii characters in them.  Is that true?  If your tags were all pure ASCII, then you could use Rename, Move, and Copy Tool to rename based on the tags.

What you are really trying to do is:

1.  Rename all of your files to remap non-ascii characters to ascii.
2.  Have JRiver know about these changes to preserve all of your database entries.

You can almost certainly find some sort of utility to rename the files externally in OS X.  JRiver will re-import anything you rename in an Auto Import monitored directory, but I don't know if it will keep all of it's properties.  I don't have a good answer for this.  Hopefully someone else has a good idea.

Brian.
Logged

jeffcdo

  • Recent member
  • *
  • Posts: 41
Re: Replace Special Characters
« Reply #2 on: August 21, 2015, 10:20:08 am »

I'm going to assume that your tags (Album, Artist, Name, etc) have these same non-ascii characters in them.  Is that true?  If your tags were all pure ASCII, then you could use Rename, Move, and Copy Tool to rename based on the tags.

Yes this is correct, and I'm generating the folders/directories via the Rename, Move and Copy Tool.
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Replace Special Characters
« Reply #3 on: August 21, 2015, 03:35:52 pm »

Ok, I've figured out a general approach, that I've tested the concept on, but I haven't completely implemented it.  Because it's sort of ugly and it requires more work than I'm willing to put into it right now.  Here's the idea:

For each field that you want to use in your filename, you develop an MC expression based on replace() for each accented character that you want to translate.  For example, you probably want to translate é to e.  There are a LOT of these to translate if you want to catch absolutely everything.  Here's an example I did based on some songs in my library.  This is NOT an exhaustive list.  It's just a test I was working with.

Code: [Select]
replace(replace(replace(replace([Name],à, a),á, a), é, e), ó, o)
This works on the name field, but could be applied to Artist or Album or whatever.  Next step:

Build a new Library field for each field you want to use in your file name.  This is necessary because you don't want to overwrite the data in your Name, Album, or Artist fields.  You just want a container to hold the new strings that don't have accents.  For my tests, I called these:

Name_ascii
Artist_ascii
Album_ascii

To add these fields, go to:  Tools > Options > Library & Folders > Manage Library Fields > Add New Field

Now, to populate these fields:

1.  Highlight a group of files you want to work on.  This could be just a few files, or hundreds or thousands.  Please test on a few first!
2.  Press Alt-<enter> to bring up the tagging pane on the left.
3.  Find the field you want to build.  Let's say you are working on Name, so we are going to find the Name_ascii field.  Click in that field to edit it.
4.  Paste in the replace expression with an = sign in front like this:
Code: [Select]
=replace(replace(replace(replace([Name],à, a),á, a), é, e), ó, o)
Repeat the above with Artist and Album if you want, pasting into the Artist_ascii and Album_ascii fields.  Make sure your replace() expression references the correct field: [Artist] to populate Artist_ascii and [Album] to populate Album_ascii.

Now all of your new non-accented fields are populated.  So now you can use Rename, Move, and Copy to rename the files based on these new fields.  For example, you might make the directory rule:

[Artist_ascii]/[Album_ascii]

The file rule might be something like:

[Track #]_[Name_ascii]

The real work here is building up the replace() expressions.  My example above only replaces 4 sets of characters.  If your song collection only references 4, 5, 6 characters with accents, this might not be too bad.  If it uses a dozen or more, it's going to require a lot of careful evaluation and testing.  The nice thing is, once you've built the replace() expression for one category (like Name for example), you can reuse it for the others.  Just change the field name inside.

I hope this makes sense.  Let me know if I can help further.

Good luck.

Brian.
Logged

jeffcdo

  • Recent member
  • *
  • Posts: 41
Re: Replace Special Characters
« Reply #4 on: August 21, 2015, 07:17:14 pm »

Thank you for your clever solution!  While I'm a stickler for accurate tags, I might simply end up replacing my relatively few é, ñ etc with their more conventional counterparts.  The problem really lies with OneDrive and not JRiver.
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Replace Special Characters
« Reply #5 on: September 12, 2015, 01:39:20 pm »

Did you ever get a solution to this that you liked?

I've got a very Alpha version of a program I've been working on to manipulate MC's data using Export MPL and Import MPL.  As one of my tests, I've written a little routine that maps accented characters to their ASCII equivalents.  I do this for Album, Artist, and Name, and write them into NEW fields:

Album_ascii
Artist_ascii
Name_ascii

You can then use these fields to rename your files using the Rename, Move, and Copy Tool.  I just tested it and it works fine.  Export MPL of the songs you want to change.  Run my program.  Import the new MPL file.  Verify new fields are there.  Rename using RM&C.

If there's any interest I'll post it.

Brian.
Logged

jeffcdo

  • Recent member
  • *
  • Posts: 41
Re: Replace Special Characters
« Reply #6 on: September 12, 2015, 03:20:45 pm »

Thank you for the follow-up.  I didn't not find a solution I was happy with, my plan was to let my OneDrive backup continue (it will take months) and then manually rename/backup the straggler files it skipped with the non-ascii characters.

I would be interested in trying your program should you make it available.
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Replace Special Characters
« Reply #7 on: September 12, 2015, 05:13:32 pm »

As I said, my program is very Alpha quality... it's just a first version that's not at all polished.  If you're willing to do it this way, I could run my script against your MPL export file and re-attach the output file back here, or dropbox or something.  I'd bet that an exported MPL of a few thousand files would zip up to be very, very small.

If you're not comfortable doing that, I could attach my program here, but the amount of support I can give for it is limited.  You're on a Mac (like me) so it should "just run", but you never know...  :)

Brian.
Logged

clpetersen

  • Recent member
  • *
  • Posts: 28
Re: Replace Special Characters
« Reply #8 on: September 21, 2015, 02:42:17 pm »

I used a program called 'Name Mangler' . Very good support, quite powerful and from the site you can download a few ready-made macros (the one I used eliminated all special characters that a Windows PC might like - I use Macs primarily).  Worked great. Free download - I used on 500 tracks/files (the limit of the freeware) - no issues. Paid $19.- and did the next 7,000. No issues. Done in ten minutes - so money well-spent.  Cleaned up about ~150 randomly located tracks in the JRiver ripped-and-managed library that Sonos did not see - now all good.  Compared to the hours of manual searching or writing my own tools, I am glad I bought the code.
Logged

jeffcdo

  • Recent member
  • *
  • Posts: 41
Re: Replace Special Characters
« Reply #9 on: September 21, 2015, 08:58:04 pm »

Name Mangler looks nice, but if you use something like that to rename files independently of JRiver, doesn't it break the links to those files in the JRiver database?

As an aside, I've hit a frustrating wall with my OneDrive backup.  It appears that Microsoft has "changed their minds" (without telling anybody) about offering unlimited OneDrive space with Office 365.  They insist now there is a 1TB limit, even though there are ample links still online, less than a year old, trumpeting the announcement of unlimited space.
Logged

Chiarina

  • Member
  • *
  • Posts: 1
Re: Replace Special Characters
« Reply #10 on: June 11, 2019, 04:26:29 pm »

Ok, I've figured out a general approach, that I've tested the concept on, but I haven't completely implemented it...Here's the idea:

I've just implemented this on my library of around 36,000 mp3s because my Sony NW-A35 either doesn't recognize m3u8 playlist format, that I gather from elsewhere in the forum is needed to deal with non-ASCII characters, or it can't find the playlists as the option that works for generating the right file paths for the playlists (... - full path without drive letter) is only available for m3u. I did a lot of tests of different playlist formats/path creation rules and it just didn't like any of them. Even when I had replaced all the special characters in the "container" fields and used them to renamed the files, it also didn't like any non-ASCII characters in the Name - Artist field either, so I went ahead and replaced all those too, copying them back across from the "container" fields. I listen to a lot of world music so there were several thousand replacements made relatively painlessly! And it maintained all the changes in my 200+playlists. And I got everything on the Sony Walkman. I built this expression and used it for Artist and Album too. It's not 100% comprehensive or systematic (sorry!) but these were the ones I found in a good sized sample of my world music. I was willing to sacrifice the special characters for painless syncing :) Media Centre is awesome, thanks everyone :) Just wanted to share the experience in case useful for anyone, and to say thank you for outlining the idea!

Code: [Select]
=replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace([Name],à,a),á,a),é,e),è,e),ó,o),ç,c),å,a),ö,o),ä,a),æ,ae),Å,A),õ,o),ã,a),Á,A),ê,e),ú,u),ù,u),ô,o),É,E),º,o),í,i),ì,i),ü,u),Ê,E),Ø,O),ñ,n),ø,o),ò,o),î,i),&, and),#,no.),ć,c),!,),+,and)
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Replace Special Characters
« Reply #11 on: June 16, 2019, 06:24:49 pm »

Wow.

Almost 4 years after I posted a weirdo half way done idea, someone used it for an actual project.  Awesome!

I'm glad you were able to make this work for you.  :)

Brian.
Logged

lightningbit

  • Regular Member
  • Recent member
  • *
  • Posts: 10
  • I am .... Just me.....
Re: Replace Special Characters
« Reply #12 on: August 03, 2022, 10:37:04 am »

I started using this solution in order to be able to sync (audio files and playlists) to a linux server with Airsonic.
Because Airsonic on Linux seems to have similar issues as mentioned above.
Logged
Pages: [1]   Go Up