INTERACT FORUM

Please login or register.

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

Author Topic: Sync files keeping relevant folder path the same  (Read 2828 times)

Llannis

  • Junior Woodchuck
  • **
  • Posts: 94
Sync files keeping relevant folder path the same
« on: May 29, 2018, 11:31:36 am »

Is it possible to sync files (and playlist) with an external device keeping the folder path of my original files? (i.e. c://music/1/2/3/file0.mp3 to z://1/2/3/file0.ogg)
Logged

Llannis

  • Junior Woodchuck
  • **
  • Posts: 94
Re: Sync files keeping relevant folder path the same
« Reply #1 on: May 29, 2018, 11:55:13 am »

I could maybe
clone my library --> delete all the files that I don't want to transfer --> convert the playlist files from whatever to .ogg (without deleting the original ones (is this possible?)) --> and then move the converted files from c://... to z//...

Is this solution feasible (especially the conversion part)? How can I keep the .ogg files in the playlist instead of the original ones?

Can you think of any other easier workarounds?

Thanks in advance
Logged

BryanC

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2666
Logged

Llannis

  • Junior Woodchuck
  • **
  • Posts: 94
Re: Sync files keeping relevant folder path the same
« Reply #3 on: May 29, 2018, 01:43:23 pm »

Hi BryanC,

I already know and use the functions of JRiver you are referring to (above link). Unfortunately, I don't ask how I can use the same library to another/additional location... Please, re-read my post and if you think something is not clear I will be happy to try and rephrase it.

If anyone has any suggestions on my situation I would be glad to try them out,

Regards
Logged

BryanC

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2666
Re: Sync files keeping relevant folder path the same
« Reply #4 on: May 29, 2018, 02:07:22 pm »

Just move the files as I outlined in the previous link, backup and restore the library on the new device, and use the RM&C too (that you are familiar with) to update the database to point to the new location in the same manner you used to copy the files (using the update database option in lieu of copy).
Logged

Llannis

  • Junior Woodchuck
  • **
  • Posts: 94
Re: Sync files keeping relevant folder path the same
« Reply #5 on: May 29, 2018, 02:42:56 pm »

Great, but how about the conversion from .mp3 to .ogg? Can I convert them without breaking the link with the playlists they are in?
Logged

BryanC

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2666
Re: Sync files keeping relevant folder path the same
« Reply #6 on: May 29, 2018, 03:37:19 pm »

I'm finally understanding what you are trying to achieve.

You can use the handheld sync tool to treat an external drive path as a handheld device and convert on sync. You can specify the configurable folder path to match whatever layout you have on your source filesystem. You can also choose which playlists to sync and they will also be transferred to the device with absolute or relative paths.

If your source filesystem is poorly organized such that you cannot use the expression language to recreate your folder hierarchy, you may be able to use the following expression in the handheld sync folder path if you are using the root of your destination drive as the handheld path: RemoveLeft([Filename (path)], 3)

Note that is untested since I don't have access to a Windows machine atm.

https://wiki.jriver.com/index.php/Handheld_Sync_Options
Logged

Llannis

  • Junior Woodchuck
  • **
  • Posts: 94
Re: Sync files keeping relevant folder path the same
« Reply #7 on: May 29, 2018, 11:48:05 pm »

This seems a more feasible process than the one I suggest at my second post.

Since my library is poorly organized, I have to use the expression that you suggest.

Thank you BryanC
Logged

Llannis

  • Junior Woodchuck
  • **
  • Posts: 94
Re: Sync files keeping relevant folder path the same
« Reply #8 on: May 30, 2018, 03:37:52 pm »

I just tried the RemoveLeft function.
Instead of creating the folder path the function returned a folder for each song with FolderName the folder path (i.e. instead of music/rock/GunsNRoses/song.ogg it created music_rock_GunsNRoses/song.ogg).

Can you think of any workarounds on this?
Logged

Llannis

  • Junior Woodchuck
  • **
  • Posts: 94
Re: Sync files keeping relevant folder path the same
« Reply #9 on: May 30, 2018, 04:00:09 pm »

The following expression works when I don't have any conversions
\RemoveLeft((filepath(), 3)\

As soon as  I convert files to ogg, I get the following path at the handheld folder
AppData\Roaming\J River\Media Center 24\Temp
Logged

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: Sync files keeping relevant folder path the same
« Reply #10 on: May 30, 2018, 10:24:05 pm »

You have found a couple of Unintended Features Llannis.  8)

First, I like BryanC's expression more. The two are supposed to be equivalent, but as per the Wiki, "The field [filename (path)] is equivalent to FilePath(), and is generally preferred." FilePath() requires evaluating the path, while [filename (path)] just requires looking up a field. It should be faster.

However, they do produce two slightly different results. I was playing around with Handheld Sync today so I had a look at your issue.

I have a base path for syncing some tracks to a local hard drive directory of "F:\iPhone 3GS\". Using that setup, I synced a few FLAC files to that Device, with conversion to MP3s. The results for the two expressions are shown below.

Expression "RemoveLeft((filepath(), 3)\" produced: "F:\iPhone 3GS\Users\UserID\AppData\Roaming\J River\Media Center 24\Temp"
So MC took the location of the temporary file created during the conversion, and used that as input to the "filepath()" value. That isn't right. It should be using the original file location.


Expression RemoveLeft([Filename (path)], 3) produced:
F:\iPhone 3GS\Users_UserID_AppData_Roaming_J River_Media Center 24_Temp_
Same as above, but in this case MC is treating the output of "Filename (path)" in the same way as it treats a filename that includes backslashes. That is, it is replacing the backslashes with underscores. That isn't right at all for creating an Audio Path for Handheld Sync. There is a setting in the "Rename, Move, & Copy File" function to turn on or off backslash replacement in expressions that create paths, but there is no equivalent in Handheld Sync.

I can't think of any way to get around the two problems above, particularly the first one. I think those issues need to be fixed by JRiver before you can do what you want with Handheld Sync. I don't think what you are trying to do is unreasonable either, although the normal solution is to make sure that all files you want to sync are tagged properly with enough information to build the correct (in this case existing) path.

Thinking about the process you suggest in your second post, an alternative to cloning your library would be to convert to ogg in your current library using the "Convert to same folder as original files" and one of the "Leave original file" options. Probably the "add destination file to library" version, so that you can use the "Rename, Move, & Copy File" function to move just the ogg files to the external device. That would be as simple as selecting the files in your current library either by searching for just ogg files, or more easily by using the "Recently Imported" playlist, then pressing F6, unticking the Directories and Filename boxes, ticking "Find & Replace" tickbox, and setting "Find What" to "C:\music\" and "Replace With" to "Z:\". You could then delete the ogg files from your current library, but not from the external device! Just the library. Easy while you still have them selected for the RM&CF function. Note: Use Shift+Delete and select the correct option when items are highlighted in a Playlist, otherwise the item is just deleted from the playlist itself, and not the library or the disk. Lastly, export the original playlists, edit them externally to point to the new location and ogg files instead of the original format, and then do whatever you wish with them.

Easy huh? As you can see, it would be better if the Handheld Sync was fixed!  ;D

Some questions for you.
What is the device you want to transfer the converted files to?
Do you need a MC library to manage the converted files?
Do you just need the files and playlists to be on the device, for some other software to use?

PS: You posted in the Windows forum, so I assume that you are actually using a Windows version of MC. Your use of the forward slash in you first post made me wonder though.
(i.e. c://music/1/2/3/file0.mp3 to z://1/2/3/file0.ogg)
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

Llannis

  • Junior Woodchuck
  • **
  • Posts: 94
Re: Sync files keeping relevant folder path the same
« Reply #11 on: May 31, 2018, 02:49:45 am »

Hi RodericGI,

thank you for taking the time to work on my problem and give such a detailed response. I just hope JRiver people check this post and fix the inconsistencies in the code.

To answer your questions I need to tell you about my setup. I have a library of about 150k tracks on my desktop pc. For my Laptop (1tb SSD) needs I copied the library, shrunk it to 30k and converted it to .ogg. I did everything through JRiver, so that I keep my (a couple of hundreds) playlists. Now, there are sometimes that I need to create a playlist at my Desktop and pass it to my Laptop's JRiver with all its tracks converted, without getting duplicates (that's why I need to keep the original relative paths).

If you have any other thoughts please share them with me  8)



ps. About the slashes, back at the DOS-UNIX ages, I played with different setups, so sometimes I mix up things, but it is rare that someone realizes... ;)

Logged

BryanC

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2666
Re: Sync files keeping relevant folder path the same
« Reply #12 on: May 31, 2018, 07:34:52 am »

I've wondered whether the RM&C tool could just be simplified (for instance, by removing the Copy/Rename/Move/Update dialog) and repurposed for setting the folder path (and additionally the filename) in handheld sync. It would be a much more powerful solution than what is currently available. Issues with esoteric filename-based hardware (usually OEM car headunits) are very common.
Logged

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: Sync files keeping relevant folder path the same
« Reply #13 on: May 31, 2018, 11:56:53 pm »

If you have any other thoughts please share them with me  8)

I see what you are doing now. Because you are sharing files from the PC to the laptop, converted to ogg format, using Playlists as the selection method, one or more ogg files could already exist on the laptop due to use in a prior Playlist. Hence one solution is to use exactly the same folder structure on both the PC and laptop to avoid duplicates, as the PC would try to write the new off files to exactly the same place, and depending on the method used, either not transfer the new ogg file, or at a minimum just overwrite existing file.

=======================
A.
First, the method I described above would still work.

=======================
B.
Second, if the Handheld Sync function did work with the expressions we discussed, you would still need to edit the Playlists created to point them to the correct disk drive, even though they would have the correct folder structure in them. At least, with the setup you described, assuming that both the PC and laptop have just a C:\ drive, or you are using the C:\ drive in both cases to store your music, and that now you have established the library on the laptop, you won't be copying the library from the PC again in the future. Basically, you will be running two separate libraries permanently. Here is why.

As you would be transferring files from the C:\ drive on the PC to a mapped drive you have called Z:\, all the Playlists would point to the Z:\ drive, but they would actually be on the C:\ drive of the laptop. When you tried to use them on the laptop, none of the files would be found. So you would have to edit the playlists and Replace Z:\ with C:\ preferably before opening MC on the laptop so that the Playlists aren't imported with the incorrect data. If they were, you would have to specifically re-import them after the editing. Not a big issue, but a bit of a nuisance.

I can think of a few ways to avoid the extra step.
1. One that I thought would not work but actually does is sharing the C: drive on the laptop and then mapping it to Z: as a Network Drive, also on the laptop, so that Windows refers to the C: drive as both C: and Z: on the laptop. That seems pretty easy. On the PC you would then also map a network drive called Z: to the C: drive on the laptop for file transfers. While you probably wouldn't need to, you probably should do a mass change in your laptop MC Library to change the location of files from C: to Z: using the RM&CF function, but it might work without doing that, just reading Z: from the Playlists and finding the ogg files via that mapped drive just fine. It might get a little confusing though.

2. Another way to fix the Playlist drive designation issue would be to split the laptop drive into two partitions, C: for all programs an whatever you currently have on the PC, and let's call it M: for all your media (ogg) files. You would then move all you existing ogg files to the M: drive just using Windows Explorer, and then do a mass change in your laptop MC Library to change the location of files from C: to M: using the RM&CF function. In this case, when working on the PC you would map drive M: to the laptop drive M:. All Playlists would then contain M: as the drive to find the ogg files, and that is where they would be found. This method has the disadvantage of splitting one large drive on the laptop into two of course, which means that you would have to guess the correct size, but there are tools available these days to resize partitions without losing data, if you needed to do that in the future.

3. Another way would be to start using URIs within the MC Library on your laptop, so that both the PC and the laptop refered to files on the C: drive using the same URI, and therefore so would the Playlists created by the Handheld Sync process... I think. I can't really test this one as my network doesn't want to play nicely just at the moment.  ::) But anyway, let's assume that you create a Share on your laptop called "\\LAPTOP\Music". Then you create a Device in MC on the PC that points to that Share. MC requires a Share to be visible in the dialogue that creates a Device, so your network needs to be playing ball and displaying that share on the PC. You can't just type the Share into the dialogue, unfortunately. So Network Discovery needs to be working properly and active. Now when you transfer files using the Handheld Sync fucntion, and when it creates Playlists, they will refer to the URI/Share on the Laptop, "\\LAPTOP\Music", as the root location. Hence, the Playlists should work, and the ogg files will be copied to the correct place. Again, you may not need to update the existing records in the MC Library on the laptop, but it may work better if you do. Some people use URI's in their library all the time, and it works fine. Again, you do a mass change in your laptop MC Library to change the location of files from C: to \\LAPTOP\Music using the RM&CF function.

Ah wait. I forgot that when using Handheld Sync to sync to a hard drive location, you can now create custom Playlists and specify relative paths in the Playlist. So the drive naming issue becomes moot. Silly me, to not think of that until I had written all the above. I'll leave it there as a thought exercise.
Quote
24.0.28 (5/15/2018)
5. NEW: Added an option to choose the playlist format when syncing to Handhelds.[/color]
Actually, that change may have added custom playlists for Devices such as Android phones, rather than for Hard Drive locations. I forget which way around it was now. It is in a thread around here somewhere...  ;D

=======================

C.
Here is another thought though; You don't have to use the exact same folder structure on the laptop as you do on the PC, as long as the folder structure on the laptop is consistent every time you use the Handheld Sync function to copy ogg files and Playlists from the PC to the laptop. That way, if an ogg file exists on the laptop when you run a Handheld Sync, MC will know about it, and won't transfer it over again, unless your settings say it should.

You can just use rules in the Handheld Sync function that are based on known reliable tags in the MC Library, such as [Album], [Album Artist (auto)], and maybe [Disc #] if you want to include that in the laptop library. Even using the default basic Device Audio Path of "[Album Artist (auto)]\[Album]\" would result in consistent and repeatable folder structures on the laptop, so "no" duplicates.

The catch is that you have 150K tracks, and your tags may not all be perfect, so that if you change the tags that are used in rules on your PC, you may still get some duplicates of ogg files on the laptop. But probably not many.

One big advantage of this method is that it would work with the Handheld Sync functionality right now, as it doesn't rely on the expressions we discussed. Of course in order to use this method you would have to update the file locations of existing files on the laptop, so that they were consistent with the rules you decide to use in the Handheld Sync functionality. Again, the RM&CF function can do that for you quite easily.

You would still need to deal with the drive naming issue, or use custom Playlists with relative paths.

=======================

How is that? Enough to think about?
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

stiv32

  • World Citizen
  • ***
  • Posts: 162
Re: Sync files keeping relevant folder path the same
« Reply #14 on: June 01, 2018, 03:41:19 am »

This is Llannis
I am on my old laptop and I can't remember the pass to my Llannis account. But still ;)

More than enough!!!  ;D

Actually the ability to get the handhelds' playlists (m3u, m3u8 etc.) with relative paths has been around for some time now, so I don't really understand what this change has caused
Quote
24.0.28 (5/15/2018)
5. NEW: Added an option to choose the playlist format when syncing to Handhelds.[/color]

My library is at a V:\Music\ which makes it convenient to load it over the Network from Desktop and Laptop pcs. I just backup my Desktop library and restore it to Laptop's MC, in order to have all the updates in both places. (OneDrive aids here in finding the Backup files right at my laptop's folders, without further hassle). So, as soon as I export the tracks to the new location I can load at the Laptop's JRiver (C:\Music\) the new playlist which points to the relative paths of the tracks. You can see that I could extract them in my Desktop's C:\Music\ folder and then just copy them and the extracted playlists. The only problem is how I can replicate the original structure of my folders, where you and BryanC gave a few great suggestions.


Especially, your C. solution about redirecting all Laptop's tracks based on specific rules and then use the same rules at my transfers seem viable. What makes me a bit skeptical about this is that MC sometimes behaves in mysterious ways... I just worry what can happen to my library files in terms of dual-tripple instances of linked files (an issue that has been discussed in the past and thought to have been resolved). I already have a few duplicated links to the same file, that I don't know how they were created (which might be altered or tagged individually).

I could surpass my reluctance though, by creating a backup of my current library and copying and pointing the library to a new place based on my custom rules. I need primarily to check whether my freespace is enough for this trial.

I will keep you updated how it goes...
Logged

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: Sync files keeping relevant folder path the same
« Reply #15 on: June 01, 2018, 05:45:25 pm »

Actually the ability to get the handhelds' playlists (m3u, m3u8 etc.) with relative paths has been around for some time now, so I don't really understand what this change has caused

Yeah I couldn't remember what this applied to, but it was actually for non-hard drive Devices such as my Android phone, which could only use "*.pla " playlists up until this change.

It's good that you like some of the ideas I have thrown into the mix. I was just doing a brain dump of the things I could think of at the time.

Do try the option C. It should work for you.
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

Llannis

  • Junior Woodchuck
  • **
  • Posts: 94
Re: Sync files keeping relevant folder path the same
« Reply #16 on: June 04, 2018, 03:18:55 pm »

I tried today to recreate the folder structure of my laptop's library by copying and pointing the files to a new location. Unfortunately, I have too many tracks with the same names (which are different recording of the same song from the same artist or denoised tracks or even some other unique cases).

So, I will have to wait until MC fixes the filepath() and Filename(path) problems...
Logged

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: Sync files keeping relevant folder path the same
« Reply #17 on: June 04, 2018, 06:06:29 pm »

That is a shame. Hopefully a fix is implemented at some time soon.

Some people with multiple versions of a track will add a field such as [Version] or [Source], and there is already a field called [Work] for Classical music, and a few others such fields. If you had such a field filled for your Library to differentiate versions of a track you could include that field in the folder structure rule in Handheld Sync, and then you wouldn't get clashes when the filename is the same. Something like  "[Album Artist (auto)]\[Album]\[Work]\" for example.

Just a thought if the fix takes too long to get done.
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

Llannis

  • Junior Woodchuck
  • **
  • Posts: 94
Re: Sync files keeping relevant folder path the same
« Reply #18 on: June 05, 2018, 12:40:12 am »

I thought about that too, I also have a few custom fields that I could modify and use. Unfortunately, this process would take more time than I can spend right now. Thank you again for all this comprehensive information!
Logged
Pages: [1]   Go Up