• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Swapping files, pages issue
#1
Mike,

an old bug came back it seems:
When swapping an existing 2 pages PDF with a new 4 pages PDF, only the first two pages are shown after swap, even in Edit mode.
Similarly, when swapping an existing 5 pages PDF with a 4 pages PDF, an empty fifth page is shown.
Swapping an existing 1 page PDF with a 2 pager seems to work fine though.

Thanks!
Ben
Reply
#2
I just tested using these steps:

1) Imported a 2 page PDF. I didn't change any of the default settings.
2) Swapped in a 4 page PDF. Verified that all four pages are shown correctly.
3) Swapped in a 6 page PDF. Verified all six pages are shown correctly.

I performed these using the latest Windows 10 version of MobileSheets. Is there something I'm missing?

Thanks,
Mike
Reply
#3
Using version 1.9.4. The behaviour is described as in my post. Same file names. No idea what prevents from the successful swapping. Workaround is to remove the existing file a and select the new one (both done in the Editor).
Reply
#4
Did you try repeating the steps with a fresh import, as I described in my post? I want to verify that the issue isn't related to settings you may have changed in the songs (such as the page order).

Thanks,
Mike
Reply
#5
Hi Mike,

I always leave the songs/pdfs as is. Create New Song, select PDF and Audio, fill in the fields, and that's it.
Never use the import function.

Thanks
Ben
Reply
#6
(10-08-2017, 06:36 PM)Ben Wrote: I always leave the songs/pdfs as is. Create New Song, select PDF and Audio, fill in the fields, and that's it.
Never use the import function.

I manage all my scores outside of MS and have the MS data folder pointed to a parent directory. After having imported a (new) score once all subsequent changes I do outside of MS are visible in MS without any further intervention on my part.

All annotations drawn into the scores are left in place. Therefor when the page layout changes which happens from time to time when I'm working on the lilypond sources of a score, I have to erase the old ones and redo them which seems to be the only intervention occasionally required.

Regards,
Michael
Reply
#7
(10-15-2017, 05:00 PM)mgd Wrote:
(10-08-2017, 06:36 PM)Ben Wrote: I always leave the songs/pdfs as is. Create New Song, select PDF and Audio, fill in the fields, and that's it.
Never use the import function.

I manage all my scores outside of MS and have the MS data folder pointed to a parent directory. After having imported a (new) score once all subsequent changes I do outside of MS are visible in MS without any further intervention on my part.

All annotations drawn into the scores are left in place. Therefor when the page layout changes which happens from time to time when I'm working on the lilypond sources of a score, I have to erase the old ones and redo them which seems to be the only intervention occasionally required.

Regards,
Michael

While trying to reproduce a problem with initialization of MS I now have a PDF in MS for which only the first 3 pages are shown while it definitely has 5 pages. The path shown by MS points to the correct file which outside of MS is shown correctly. An earlier Version of the file had indeed 3 pages.

Rebooting the machine did not change anything, touching the PDF (to change the timestamp) did not help either.

Anything I can do to help track down this problem?

I'm using MS 1.9.5 on Win10 Pro and have not yet installed Win10 Creators Update.

I'd assume I could remove the file from MS, then reimport and expect it to show all 5 pages then, but then the current error state would have gone as well.

FWIW I just edited the MS SQlite DB. In table Files column PageOrder there was 1-3 which I changed to 1-5. After that MS displayed all 5 pages. After restoring the value to 1-3 it was displaying 3 pages again. The filesize showed the correct value.

Could it be that the logic that is updating Files.PageOrder in special situations does not correctly determine the right pagecount?

Kind regards,
Michael
Reply
#8
You can also just edit the song and change the page order in the song editor in MobilesheetsPro. I'm not sure why the page order isn't being set to 1-5 though.  The logic is supposed to determine if the page order previously used all pages of the file, then the new page order should switch to using all of the pages in the new file. I've tested this many times and it's always worked for me. I'm not sure why it's not working your case. It's possible something is different about the environments/folders/files we are using with MobileSheets. I know for certain that the page order will be updated correctly if you use the swap file feature (Select song, tap overflow menu->Swap File). Are you just replacing the file on the file system? That probably won't update the page order in the same way. I may have to look into that.

Mike
Reply
#9
Most of the time MS adjusts correctly when I change the number of pages. This particular case is actually the first time I've seen it not working.

When I swap files I do replace them on the filesystem since usually that's all that's required. Basically I have the MS storage location pointed to where I have all my lilypond scores and as I said, it usually works like a charm. As a corollar it happens that files "vanish" (from MS point of view) when I move them into a different subfolder. In that case I'll reimport them and remove the old reference in MS.

In the specific case at hand the filesize had been updated correctly, so MS must have knowledge about "something has changed". I haven't checked the timestamp in the DB but I'd be surprised if it weren't updated as well.

Since I think I've seen this particular scenario (adding pages to a file imported into MS) working already I speculate that only in special circumstances the pagecount update process gets disrupted (or so).

Kind regards,
Michael
Reply
#10
So I looked at the code, and if you just replace the file on the file system, it will not update the page order. There are a couple of reasons why this is so:

1) I no longer have access to the previous version of the file, so I don't know if the full range of pages was being used (I don't save that information currently). 

2) If you had a page order of 1-3 in a 5 page file, and that was intentional, and then you update to a 6 page file, you probably don't want the application resetting your page order just because an extra page was added to the file

The only time I will update the page order is if the previous page order references a page greater than the maximum page of the new file. In that case, I have to reset the page order because it's invalid at that point.  So if you want the page order to be correctly updated when swapping in a new version of a file where the number of pages has changed, you'll have to use the swap file feature. The other option would be for me to start adding additional information in the database about the properties of the file such as the maximum number of pages so that I can access this information even if the file no longer exists. I'm not opposed to that, but the problem is if I add that field to the database, I then need to populate it, which is only possible by opening every single file in the library. I'm not sure I want to do that as part of the database upgrade phase, as some people have huge libraries and that could take a long time. That means I would have to populate it the next time a song is loaded and I detect that information about the file is missing in the database. If you replaced files you hadn't loaded recently, then I wouldn't be able to properly handle those.  This new database field also would only make sense for PDFs, as text/chord pro files have dynamic content with no fixed number of pages and image files are always just one page. 

Kind regards,
Mike
Reply
#11
(10-21-2017, 02:11 AM)Zuberman Wrote: So I looked at the code, and if you just replace the file on the file system, it will not update the page order. There are a couple of reasons why this is so:

1) I no longer have access to the previous version of the file, so I don't know if the full range of pages was being used (I don't save that information currently). 

2) If you had a page order of 1-3 in a 5 page file, and that was intentional, and then you update to a 6 page file, you probably don't want the application resetting your page order just because an extra page was added to the file

The only time I will update the page order is if the previous page order references a page greater than the maximum page of the new file. In that case, I have to reset the page order because it's invalid at that point.  So if you want the page order to be correctly updated when swapping in a new version of a file where the number of pages has changed, you'll have to use the swap file feature. The other option would be for me to start adding additional information in the database about the properties of the file such as the maximum number of pages so that I can access this information even if the file no longer exists. I'm not opposed to that, but the problem is if I add that field to the database, I then need to populate it, which is only possible by opening every single file in the library. I'm not sure I want to do that as part of the database upgrade phase, as some people have huge libraries and that could take a long time. That means I would have to populate it the next time a song is loaded and I detect that information about the file is missing in the database. If you replaced files you hadn't loaded recently, then I wouldn't be able to properly handle those.  This new database field also would only make sense for PDFs, as text/chord pro files have dynamic content with no fixed number of pages and image files are always just one page. 

Kind regards,
Mike
Hi Mike,

I gave this a few thoughts and I mostly agree with you on this.

I also agree that probably adding a field PageCount (or however you'll name it) would be a good idea.

However I don't see that adding such a field would require to access each and every file. As I see it a good estimate of its value would be to just copy the upper bound of PageOrder. In all cases where this has not been adjusted manually this already holds the correct value. In all other cases (presumably a small number anyway) the value being too low will not cause any harm. And when this filke is updated the next time it will be corrected "automagically".

Therefor I'd propose to add a column PageCount and populate it with the current maximum page as of PageOrder. That should be possible with 2 SQL stmts and would not involve scanning all the files.

Am I overlooking something?

Kind regards,
Michael
Reply
#12
The only situtation I can think of at the moment where that would be a problem would be if you had a large realbook PDF and were using a small page range such as 45-46 out of 530 pages (for example). I would then save 46 as the page count for that PDF. Now if you tried to modify the page order to 45-47, I would need to make sure I go and update that page count field otherwise the page order would be erased if the file was replaced with a new version. So there's just some new logic I'm going to have to insert in a couple of places to ensure that the page count is updated if necessary.

I'll probably target this for an update after the one I'm planning on releasing today. Anytime I change a database table, it has to be updated in all three applications at once (MobileSheetsPro, MobileSheetsPro Companion and MobileSheets for Win 10).
Reply




Users browsing this thread:
2 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2024 MyBB Group.