• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MSP 3.8.15 page ordering UI
#46
@Mike: Frank proposes a nice workflow to use MobileSheets for completing meta data of fakebooks. I often start also with a list of songs and just their start pages (e.g. from an OCR of the printed TOC). Frank describes a convenient way to find the end of the song.
MS is also nice to record e.g. the composers by just selecting already available entries.
Exporting the meta data that were collected like that for further use (e.g. sharing as CSV or importing into another database) still has some issues that we already discussed in several other threads. The most annoying problem, mainly for composers, is that MobileSheet's CSV import requires | as separator for multiple entries, exporting a song list always uses a comma.
https://www.zubersoft.com/mobilesheets/f...-5213.html

@Frank: I already know the task to find the last page of a song when only the first page is given, see above. 
I often use this workflow:
- I create a bookmark file for jPDFBookmarks, this requires only title and startpage
- I import that bookmark file into the PDF using jPDFBookmarks
- I create a CSV file with Sciurius' PDF2CSV tool
- I merge the CSV that was provided by PDF2CSV with already available metadata (if any exist) using LibreOffice Calc
More effort, but in the end the PDF also has got PDF bookmarks which are nice to have and using tools avoids errors that happen when I type manually.
first language: German
Acer A1-830, Android 4.4.2 - HP x2 210 G2 Detachable, Win 10 22H2 - Huawei Media Pad T5, Android 8.0 - Boox Tab Ultra C, Android 11
www.moonlightcrisis.de - www.basdjo.de - www.frankenbaend.de


Reply
#47
You're doing something similar to what I do but unless I'm missing something you're not getting the last page automatically set in your csv file.

My workflow is this:

Either:
Create a csv file of the table of contents either by typing it manually or by ocr-ing it with tesseract, which works more-or-less well depending on the source material.
Edit the csv file with vim since it's very easy to to delete junk characters en masse using macros and regular expressions.

or:
Yank the existing bookmarks out of the pdf file using this script:

#!/bin/bash
echo Extract bookmarks from pdf and convert to csv file \(April 22, 2022\)
if [ $# -eq 0 ]; then
    echo "pdf filename must be specified on commandline"
    exit 1
fi
pdftk "$1" dump_data | grep -e BookmarkTitle -e BookmarkPageNumber  > 1.tmp
sed  -e "s/\™//g" -e "s/\"/\'/g" -e "s/\&/\&/g" -e "s/\'/\'/g" -e "s/\’/\'/g" -e "s/BookmarkTitle: //g" -e "s/BookmarkPageNumber: /;/g" 1.tmp > 2.tmp
paste -s -d' \n' 2.tmp > 1.tmp
file_name=${1%.pdf}.csv
sed "s/ ;/;/g" 1.tmp > "$file_name"
rm 1.tmp 2.tmp

Then I use libreoffice calc to recalcuate the page numbers if the toc doesn't match the actual page numbers.  You can do that in one shot by creating the formula and copying it into the entire column then save-and-reload the csv file and delete the original column.  (If you don't do the save-and-reload before deleting the original column it loses the page numbers altogether since it's still working off of the original formula.)

If I want to add bookmarks to my original pdf file (which I usually do if the original pdf file doesn't have any) I use this script:

#!/bin/bash
echo Convert csv file to bookmarks for use with pdftk update_info command
echo This expects the input file to be formatted as title\;pagenumber
if [ $# -eq 0 ]; then
    echo "input csv filename must be specified on commandline"
    exit 1
fi
sed "s/^/BookmarkBegin\nBookmarkTitle: /" "$1" > 1.tmp
sed "s/;/\nBookmarkLevel: 1\nBookmarkPageNumber: /" 1.tmp > "$1".formatted
rm 1.tmp
pdfname=${1%.csv}.pdf
pdftk "$pdfname" update_info "$1".formatted output "$pdfname".new
rm "$1".formatted

This works fine but I don't get the last page of each song when I import the file into mobilesheets.

One nifty side-effect of this is that I end up with a csv file of every song in my mobilesheets setup, which allows me to do this:

#!/bin/bash
cd ~/misc/sheet\ music\ csv\ files/sheet\ music/
SEARCHTERM=$(zenity --entry --title="Sheet Music Lookup" --text "Enter Search Term")
grep -R "$SEARCHTERM" . | zenity --text-info --title="Sheet Music Lookup Results" --height=800 --width=1500

That just reads my csv files and lists every song that matches the SEARCHTERM.

Since I keep a backup copy of the mobilesheets database file on my computer I could just read that directly and get the same information (and I've considered writing a little frontend program to do that) but so far I haven't put in the effort since the grep command here works fine even though it's rather inflexible compared to a direct lookup.
If you're a zombie and you know it, bite your friend!
We got both kinds of music: Country AND Western
Reply
#48
> You're doing something similar to what I do but unless I'm missing something you're not getting the last page automatically set in your csv file.
Yes, you missed something:
- I create a CSV file with Sciurius' PDF2CSV tool
PDF2CSV is part of MSPro-Tools https://github.com/sciurius/MSPro-Tools
The output it creates looks like this:
   
I used LibreOffice Calc before to calculate the last page of a song as <startpage of the next song> - 1
PDF2CSV is more convenient. Both methods need some manual checking because they go wrong when a song is split up on two pages where other songs are also located - you probably know this.
first language: German
Acer A1-830, Android 4.4.2 - HP x2 210 G2 Detachable, Win 10 22H2 - Huawei Media Pad T5, Android 8.0 - Boox Tab Ultra C, Android 11
www.moonlightcrisis.de - www.basdjo.de - www.frankenbaend.de


Reply
#49
I considered calculating the last page the way you show there as well but never bothered to actually set up the formula to do it since, as you say, you have to manually check it anyway so I might as well just deal with it when I actually start playing the song.

This new add-a-page button will be a great way to deal with the entire issue.  Wink
If you're a zombie and you know it, bite your friend!
We got both kinds of music: Country AND Western
Reply
#50
In most cases calculating the last page works correctly, that's why I keep using PDF2CSV. 
Nevertheless that add-a-page button that you are proposing is a great idea and very useful for correcting these cases that go wrong.
first language: German
Acer A1-830, Android 4.4.2 - HP x2 210 G2 Detachable, Win 10 22H2 - Huawei Media Pad T5, Android 8.0 - Boox Tab Ultra C, Android 11
www.moonlightcrisis.de - www.basdjo.de - www.frankenbaend.de


Reply




Users browsing this thread:
8 Guest(s)


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