MobileSheets Forums

Full Version: FixBrokenFilePaths
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I already used "Fix Broken File Paths" several times successfully. Now I'm confused by a combination that doesn't work.
MSP version is 2.5.8, Android 4.4, MobileSheets Storage Location is /storage/emulated/0/_MobileSheets

Some songs were imported from _MobileSheets\Fkbk0\Django-in-June-compilation-book\Django-in-June-compilation-book.pdf

I renamed the folder and kept the name of the PDF file unchanged
_MobileSheets\Fkbk0\DjangoInJune_Compilation\Django-in-June-compilation-book.pdf
as expected the respective songs were reported as missing
[attachment=1071]

I tried to correct that using "Fix Broken File Paths" and selected the new folder via MSPs file manager
[attachment=1072]
and inserted the previous folder via copy/paste from the files tab of the song editor
[attachment=1073]

I wonder why replacing the folder doesn't work, it reports "Total number of updated paths: 0" and the files remain missing
[attachment=1074]

CSV import from the new folder works successfully. Copying the PDF file into both folders fixes the "missing files" error.
Any idea what confuses the "Fix Broken File Paths" mechanism?

A backup of my library will be available soon in my GoogleDrive.
I'm making some changes for this with the next update, so you may want to hold off. The bottom line is that due to all paths in the database being relative to the storage location by default, you have to figure out whether you are replacing an absolute path or relative path. The easiest way to figure this out is with a tool that can run a SQL query on the Files table. So if you remove the storage location from the first part of the path in your screenshot, then it should work.

Mike
Thank you for the clarification. Now I understand what's going on.

I used copy/paste form the file tab to make sure that I use the correct path and avoid typos.
The path shown on the files tab is completed to an absolute path by adding the MSP folder path, but "Fix Broken File Paths" works with the exact database content. I could have noticed that: I selected an absolute path for "Replace with:" but the dialog displays it as a relative path, exactly as it will be stored in the database.
Yeah, it's a little confusing, but the manual option is literally just invoking a query on the database to replace one string with another. So if the path is stored as a relative path, then you have to use relative paths on the dialog. If you have an absolute path that you need to replace with another absolute path, that should work on Android, but it will not be allowed on Windows 10 (as all paths must be under the storage location).

Mike
Knowing now how things work, I'm able to handle that, both on Android and Win10. Thanks again Mike.
If you add file paths (%FILE_PATHS%) to the list of searchable fields in the filter toolbar as I proposed here
https://zubersoft.com/mobilesheets/forum...304&page=2
a search for paths containing "storage" would find all non-relative paths.
I assume that this easy to implement and it stays nicely within the concept that already exists.
Hello Mike,
did you already think about adding FILE_PATHS to the list of fields to be filtered?

That should be fully sufficient to find and handle non-relative paths, so all additional efforts could be skipped to fix the issue that I reported here:
https://zubersoft.com/mobilesheets/forum...p?tid=5304

And I recently came across another use case where filtering on file paths would be useful:
I regularly import songs from complete fakebooks. In those cases I use one "Albums" entry per fakebook. But in case a Bb- or Eb-Version of the fakebook is available, I use the same album name for all of them. That's my decision, I know, but I think that this is a good way to keep similar layouts of the same song in different keys closely together.
In that case the file path or file name is the only criteria to filter by C-, Bb- or Eb-Version.
FYI, I use also the Key tab not only to indicate the key but for which instrument the sheet is.

So I have 

Bb-Instrument
Eb-Instrument
Bass-Instrument

(not using C-Instrument, since that's the standard for me)

It's useful that all the tabs can be used for additional entries like this even if it's not "tab-specific".

Maybe that's a trick you like to use as well.
I'll see what I can do for the next update.

Mike
@Mike: That would be great, thanks
@Brix: Thank you for the tip. I know about the possibility of editing the groups e.g. I have completely replaced "Source Types" with my personal list. But I had not thought of adding the instrument information to the Keys group. In fact that's the perfect place to do that.
Doing that for already imported songs is another example where filtering by file name would be helpful.
I've added "File Paths" to the search dropdown so that you can filter on just that and then enter a file path. Hopefully this will work for what you need.

Mike
Many thanks. I'll give it a try, I'm pretty sure it will do what I need.