Batch case update

Any trouble you encounter with the Pedias, here's the place to ask for help.
Post Reply
Childeric
Contributor
Contributor
Posts: 5
Joined: Sat Jun 12, 2010 6:26 pm

Batch case update

Post by Childeric »

I have unfortunately entered all my DVD collection with the titles in full capitals, such as RIO BRAVO. I would like now all of them transformed to lower case except first letter of each word : Rio Bravo.

This is feasible one by one, but I haven't found a way to apply this transformation to all the library at once. Is there a way to do this ?

Thanks for your help,
kbarnes70
Addicted to Bruji
Addicted to Bruji
Posts: 333
Joined: Tue Nov 11, 2008 3:15 pm
Location: United Kingdom

Re: Batch case update

Post by kbarnes70 »

Childeric wrote:I have unfortunately entered all my DVD collection with the titles in full capitals, such as RIO BRAVO. I would like now all of them transformed to lower case except first letter of each word : Rio Bravo.

This is feasible one by one, but I haven't found a way to apply this transformation to all the library at once. Is there a way to do this ?

Thanks for your help,
If they have an IMDb reference number in the record, you could select ALL of your collection, then open the edit window and tick the box next to Title (leaving the field blank). When you have done that all of your titles will be removed in one pass. Then select ALL and do "Get Advanced Information' using IMDb as the source and the titles will be located from the reference number and added to each record in the Upper and Lower case form you want. The same idea may also work if you have used Amazon initially to add the records but Amazon data is, in my experience, less reliable than IMDb.

Kind regards,

Keith
Childeric
Contributor
Contributor
Posts: 5
Joined: Sat Jun 12, 2010 6:26 pm

Re: Batch case update

Post by Childeric »

Thanks for your answer. But unfortunately, this can't help, as I have manually updated all the titles to the french titles, and kept the imdb original title in the "original title" field.

Best regards.
kbarnes70
Addicted to Bruji
Addicted to Bruji
Posts: 333
Joined: Tue Nov 11, 2008 3:15 pm
Location: United Kingdom

Re: Batch case update

Post by kbarnes70 »

Childeric wrote:Thanks for your answer. But unfortunately, this can't help, as I have manually updated all the titles to the french titles, and kept the imdb original title in the "original title" field.

Best regards.
Doesn't the French version of IMDb use the French titles? There's an option in IMDb settings that allows you to choose the local title or the original title I think. If you set it to use the name the movie was known by in France, then followed the procedure I mentioned before, that may work for you.

Ah, sorry - ignore that. I have just remembered that DVDpedia always uses the American site for its information. Maybe at some time in the future, Conor could implement a setting to use the IMDb site local to the DVDpedia user.

The only other thing I could suggest is that someone who is proficient with the database coding language might be able to write some code that looks directly at the Title field in the database and changes the case of whatever it finds there to Upper and Lower. Word does this efficiently enough so it must be possible to write the code - all it needs to do is Capitalise the initial letter of each word and make the rest lower case.

Kind regards,

Keith
User avatar
Conor
Top Dog
Posts: 5346
Joined: Sat Jul 03, 2004 12:58 pm
Contact:

Re: Batch case update

Post by Conor »

DVDpedia does not have a find and replace but you can tap into the open source SQL backend to update the titles from all capitals. While not running DVDpedia make a backup of your data file by copying ~/Library/Application Support/DVDpedia/Database.dvdpd. Then with the program called Terminal you could run the following commands (unfortunately SQLite does not have a capitalize function but the following should work. ):

Code: Select all

sqlite3 ~/Library/Application\ Support/DVDpedia/Database.dvdpd
update zEntry set zTitle = upper(substr(zTitle,1,1)) || lower(substr(zTitle,2));
update zEntry set zTitle = replace(zTitle,' a',' A');
update zEntry set zTitle = replace(zTitle,' b',' B');
update zEntry set zTitle = replace(zTitle,' c',' C');
update zEntry set zTitle = replace(zTitle,' d',' D');
update zEntry set zTitle = replace(zTitle,' e',' E');
update zEntry set zTitle = replace(zTitle,' f',' F');
update zEntry set zTitle = replace(zTitle,' g',' G');
update zEntry set zTitle = replace(zTitle,' h',' H');
update zEntry set zTitle = replace(zTitle,' i',' I');
update zEntry set zTitle = replace(zTitle,' j',' J');
update zEntry set zTitle = replace(zTitle,' k',' K');
update zEntry set zTitle = replace(zTitle,' l',' L');
update zEntry set zTitle = replace(zTitle,' m',' M');
update zEntry set zTitle = replace(zTitle,' n',' N');
update zEntry set zTitle = replace(zTitle,' o',' O');
update zEntry set zTitle = replace(zTitle,' p',' P');
update zEntry set zTitle = replace(zTitle,' q',' Q');
update zEntry set zTitle = replace(zTitle,' r',' R');
update zEntry set zTitle = replace(zTitle,' s',' S');
update zEntry set zTitle = replace(zTitle,' t',' T');
update zEntry set zTitle = replace(zTitle,' u',' U');
update zEntry set zTitle = replace(zTitle,' v',' V');
update zEntry set zTitle = replace(zTitle,' w',' W');
update zEntry set zTitle = replace(zTitle,' y',' Y');
update zEntry set zTitle = replace(zTitle,' x',' X');
update zEntry set zTitle = replace(zTitle,' z',' Z');
.exit
Childeric
Contributor
Contributor
Posts: 5
Joined: Sat Jun 12, 2010 6:26 pm

Re: Batch case update

Post by Childeric »

Thanks, this works just great for most of the cases !!! This reminded me of my ancient SQL learning...

Only issue is accentuated letters. I would like É replaced by é, Ç by ç, etc. But I just can't enter these letters in sqlite, I wonder why. Would you know how to cope with this ?
User avatar
Conor
Top Dog
Posts: 5346
Joined: Sat Jul 03, 2004 12:58 pm
Contact:

Re: Batch case update

Post by Conor »

SQLite should not have a problem with the non-ASCII characters. But I see what you mean that the Terminal access won't let you enter those. Save all the "update" commands bellow plus the new ones with diacritics into a text file in UTF-8 format. Then in Terminal open SQLite3 and the DVDpedia database and have it read the commands from the file directly (tested that out and it worked).

Code: Select all

sqlite3 ~/Library/Application\ Support/DVDpedia/Database.dvdpd
.read /Desktop/fileWithCommands.txt
.exit
Post Reply